summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-08-26 19:05:36 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-08-26 19:05:36 +0000
commitd66f6b4538f876b1868f099bc1e74ce89561ebbe (patch)
tree6e3ff17717613267804a361409a3228b5ad8151a /libmpcodecs
parent0b8fc28ba778111d166128c0480462bdfd801f62 (diff)
downloadmpv-d66f6b4538f876b1868f099bc1e74ce89561ebbe.tar.bz2
mpv-d66f6b4538f876b1868f099bc1e74ce89561ebbe.tar.xz
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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29553 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_ffmpeg.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index 06a033a60f..b7c9b5ed05 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -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;