summaryrefslogtreecommitdiffstats
path: root/player/audio.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-07-29 18:05:55 +0200
committerwm4 <wm4@nowhere>2014-07-29 18:05:55 +0200
commit63d1d53d2fb89de0c7ff081f8b3bb78ee5e52520 (patch)
tree207b73bd9bc2f0390af127a283da5ddb737a2e56 /player/audio.c
parent862d7d8a1a852fc6bb6dd13ca5db90f83b676579 (diff)
downloadmpv-63d1d53d2fb89de0c7ff081f8b3bb78ee5e52520.tar.bz2
mpv-63d1d53d2fb89de0c7ff081f8b3bb78ee5e52520.tar.xz
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.
Diffstat (limited to 'player/audio.c')
-rw-r--r--player/audio.c5
1 files changed, 4 insertions, 1 deletions
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);