<div dir="ltr"><div class="gmail_extra"><div style="font-size:12.8px"><span style="white-space:pre-wrap"><br class="">                  </span>dataSize = av_samples_get_buffer_size(nullptr, codecCtx->channels, frame->nb_samples, codecCtx->sample_fmt, 1);</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><span style="white-space:pre-wrap">                  </span>while(totalBufferSize + dataSize > estimatedBuffSize)</div><div style="font-size:12.8px"><span style="white-space:pre-wrap">                      </span>{</div><div style="font-size:12.8px"><span style="white-space:pre-wrap">                             </span>estimatedBuffSize *= 1.1;</div><div style="font-size:12.8px"><span style="white-space:pre-wrap">                             </span>sampleBuffer = (uint8_t*)std::realloc(sampleBuffer, estimatedBuffSize);</div><div style="font-size:12.8px"><span style="white-space:pre-wrap">                       </span>}</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><span style="white-space:pre-wrap">                 </span>std::memcpy(sampleBuffer + totalBufferSize, frame->data[0], dataSize);</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">>> I think <span style="font-size:12.8px">av_samples_get_buffer_size could return negative value on error, if it's the case, what will happend at this line ? : </span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">> </span><span style="font-size:12.8px">std::memcpy(sampleBuffer + totalBufferSize, frame->data[0], dataSize);</span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div></div></div>