# HG changeset patch # User reimar # Date 1251313536 0 # Node ID 2c47c6dd92b546dabeb7f5ffb037ec57d2653ad6 # Parent 8ba4a5ee14801e779c5a2fc408a50cef37bffef9 Retry deciding to get audio parameters several times on errors, this avoids failing to init the decoder completely just because the first packet is broken. diff -r 8ba4a5ee1480 -r 2c47c6dd92b5 libmpcodecs/ad_ffmpeg.c --- a/libmpcodecs/ad_ffmpeg.c Wed Aug 26 17:35:40 2009 +0000 +++ b/libmpcodecs/ad_ffmpeg.c Wed Aug 26 19:05:36 2009 +0000 @@ -36,6 +36,7 @@ static int init(sh_audio_t *sh_audio) { + int tries = 0; int x; AVCodecContext *lavc_context; AVCodec *lavc_codec; @@ -106,7 +107,9 @@ } // Decode at least 1 byte: (to get header filled) + do { x=decode_audio(sh_audio,sh_audio->a_buffer,1,sh_audio->a_buffer_size); + } while (x <= 0 && tries++ < 5); if(x>0) sh_audio->a_buffer_len=x; sh_audio->channels=lavc_context->channels;