FFmpeg Input: Retry on decode error

When feeding packet to decoder, attempt to retry another packet when it
reports invalid data.

Fixes #97

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
CQTexperiment
Christopher Snowhill 2022-02-09 22:37:26 -08:00
parent 4cdf919b45
commit 085891aff1
1 changed files with 4 additions and 1 deletions

View File

@ -578,7 +578,10 @@ int64_t ffmpeg_seek(void *opaque, int64_t offset, int whence) {
}
if((errcode = avcodec_send_packet(codecCtx, endOfStream ? NULL : lastReadPacket)) < 0) {
if(errcode != AVERROR(EAGAIN)) {
if(errcode == AVERROR_INVALIDDATA) {
ALog(@"Sync error sending packet to codec, attempting to skip it");
continue;
} else if(errcode != AVERROR(EAGAIN)) {
char errDescr[4096];
av_strerror(errcode, errDescr, 4096);
ALog(@"Error sending packet to codec, errcode = %d, error = %s", errcode, errDescr);