ad_lavc: increase number of packets for initial decode

Apparently just 5 packets is not enough for the initial audio decode
(which is needed to find the format). The old code (before the recent
refactor) appeared to use 5 packets, but there were apparently other
code paths which in the end amounted to more than 5 packets being read.

The sample that failed (see github issue #368) needed 9 packets.

Fixes #368.
This commit is contained in:
wm4 2013-11-26 01:49:17 +01:00
parent bdd00d8b65
commit 8846a2f95c
1 changed files with 5 additions and 2 deletions

View File

@ -263,9 +263,12 @@ static int init(struct dec_audio *da, const char *decoder)
// Decode at least 1 sample: (to get header filled)
for (int tries = 1; ; tries++) {
int x = decode_new_packet(da);
if (x >= 0 && ctx->frame.samples > 0)
if (x >= 0 && ctx->frame.samples > 0) {
mp_msg(MSGT_DECAUDIO, MSGL_V,
"Initial decode succeeded after %d packets.\n", tries);
break;
if (tries >= 5) {
}
if (tries >= 50) {
mp_msg(MSGT_DECAUDIO, MSGL_ERR,
"ad_lavc: initial decode failed\n");
uninit(da);