Audiocodec: Update to latest FFmpeg packet pump.

This commit is contained in:
Unknown W. Brackets 2021-02-17 23:30:33 -08:00
parent 2b2dae60d3
commit b19e39efb0

View file

@ -192,7 +192,25 @@ bool SimpleAudio::Decode(void *inbuf, int inbytes, uint8_t *outbuf, int *outbyte
*outbytes = 0;
srcPos = 0;
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
if (inbytes != 0) {
int err = avcodec_send_packet(codecCtx_, &packet);
if (err < 0) {
ERROR_LOG(ME, "Error sending audio frame to decoder (%d bytes): %d (%08x)", inbytes, err, err);
return false;
}
}
int err = avcodec_receive_frame(codecCtx_, frame_);
int len = 0;
if (err >= 0) {
len = frame_->pkt_size;
got_frame = 1;
} else if (err != AVERROR(EAGAIN)) {
len = err;
}
#else
int len = avcodec_decode_audio4(codecCtx_, frame_, &got_frame, &packet);
#endif
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 12, 100)
av_packet_unref(&packet);
#else