From 085891aff14236de53aca2da789f35185b29f927 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Wed, 9 Feb 2022 22:37:26 -0800 Subject: [PATCH] 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 --- Plugins/FFMPEG/FFMPEGDecoder.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Plugins/FFMPEG/FFMPEGDecoder.m b/Plugins/FFMPEG/FFMPEGDecoder.m index 3c298f126..df9944dab 100644 --- a/Plugins/FFMPEG/FFMPEGDecoder.m +++ b/Plugins/FFMPEG/FFMPEGDecoder.m @@ -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);