[MPlayer-cvslog] r29553 - trunk/libmpcodecs/ad_ffmpeg.c

reimar subversion at mplayerhq.hu
Wed Aug 26 21:05:36 CEST 2009


Author: reimar
Date: Wed Aug 26 21:05:36 2009
New Revision: 29553

Log:
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.

Modified:
   trunk/libmpcodecs/ad_ffmpeg.c

Modified: trunk/libmpcodecs/ad_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/ad_ffmpeg.c	Wed Aug 26 19:35:40 2009	(r29552)
+++ trunk/libmpcodecs/ad_ffmpeg.c	Wed Aug 26 21:05:36 2009	(r29553)
@@ -36,6 +36,7 @@ static int preinit(sh_audio_t *sh)
 
 static int init(sh_audio_t *sh_audio)
 {
+    int tries = 0;
     int x;
     AVCodecContext *lavc_context;
     AVCodec *lavc_codec;
@@ -106,7 +107,9 @@ static int init(sh_audio_t *sh_audio)
    }
 
    // 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;


More information about the MPlayer-cvslog mailing list