From 63d1d53d2fb89de0c7ff081f8b3bb78ee5e52520 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 29 Jul 2014 18:05:55 +0200 Subject: audio: ignore (some) decoding errors on initialization It probably happens relatively often that the first packet (or even the first N packets) of a stream will fail to decode, but decoding will eventually succeed at a later point. Before commit 261506e3, this was handled by an explicit retry loop (although this was also for other purposes), but with then was changed to abort on the first error. This makes it impossible to decode some audio streams. Change this so that errors are ignored for the first 50 packets, which should make it equivalent to the old code. --- player/audio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'player/audio.c') diff --git a/player/audio.c b/player/audio.c index ab42573fad..4bf032f3a2 100644 --- a/player/audio.c +++ b/player/audio.c @@ -361,7 +361,10 @@ int fill_audio_out_buffers(struct MPContext *mpctx, double endpts) int r = initial_audio_decode(mpctx->d_audio); if (r == AD_WAIT) return -1; // continue later when new data is available - if (r != AD_OK) { + mpctx->d_audio->init_retries += 1; + MP_VERBOSE(mpctx, "Initial audio packets read: %d\n", + mpctx->d_audio->init_retries); + if (r != AD_OK && mpctx->d_audio->init_retries >= 50) { MP_ERR(mpctx, "Error initializing audio.\n"); struct track *track = mpctx->current_track[0][STREAM_AUDIO]; mp_deselect_track(mpctx, track); -- cgit v1.2.3