<div dir="ltr">Hi.I have the following case:<div>I am receiving audio stream which consist</div><div> of 2 channel float 32 (non planar) audio frames. Then I am trying to convert those into</div><div>AV_SAMPLE_FMT_FLTP in order to encode with AAC codec. The problem is that I receive that data as packets of size different from what my AVFrame has. AVFrame for <br></div><div>this codec has 2 buffers,each 1024 samples,which is 4096 bytes per channel (32bit sample size),right? So it looks like I have to fill the frame with all 4096 bytes before pushing it into encoder?Is it possible to submit 'custom' frames,with different amount of data from what I am getting in codec context? </div><div>Second question:</div><div><br></div><div>I resample from non planar FLT to FLTP as follows:</div><div><br></div><div><div><span style="white-space:pre"> </span> const unsigned char *srcplanes[2];</div><div><span style="white-space:pre"> </span> unsigned char *dstplanes[2];</div><div><span style="white-space:pre"> </span>srcplanes[0] = (unsigned char*)packet.data;</div><div><span style="white-space:pre"> </span>srcplanes[1] = NULL;</div><div><span style="white-space:pre"> </span>dstplanes[0] = (unsigned char*)mAudioInputFrame->data[0];</div><div><span style="white-space:pre"> </span>dstplanes[1] = (unsigned char*)mAudioInputFrame->data[1];</div><div><br></div><div><span style="white-space:pre"> </span>int framesToWrite = packet.dataSize / 8;</div><div><span style="white-space:pre"> </span> int samples = (int)av_rescale_rnd(NumFramesWritten, 44100, 44100, AV_ROUND_UP);</div><div><br></div><div><span style="white-space:pre"> </span>int samplesConverted = swr_convert(swrCxt, dstplanes, samples, srcplanes,
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">framesToWrite<span> </span></span>
);</div></div><div><br></div><div>Here, <b>packet.data</b> is the src audio data buffer from the stream,which has almost half of the size of the
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">mAudioInputFrame, which has 4096 bytes per channel. So how does swr_convert know how many bytes to take from the
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">srcplanes? Does it operate based on the size of the destination frame? If yes,then it means I have to provide
<span style="font-weight:400;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span> </span></span><b style="font-weight:400;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">packet.data </b><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"> with data size EXACTLY equal the size of the destination AVFrame buffers?</span></span></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div></div>