From 32e303366615f4d70dd2c820c2ecc294378a2cf9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 22 May 2019 21:45:54 +0200 Subject: [PATCH] ad_lavc: skip fully skipped frames Fixes stupid messages with a opus/mkv test file that had an absurdly huge codec delay. This file fully skips several frames at the start. ad_lavc.c trimmed these frames to 0 samples and returned them. The next layer (f_decoder_wrapper.c) saw discontinuous PTS values, because the PTS values increased by a frame, but amounted to 0 audio samples. This was harmless, but logged PTS discontinuity errors. --- audio/decode/ad_lavc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index 985fd58084..e323a6cbda 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -254,7 +254,11 @@ static bool receive_frame(struct mp_filter *da, struct mp_frame *out) priv->trim_samples -= trim; } - *out = MAKE_FRAME(MP_FRAME_AUDIO, mpframe); + if (mp_aframe_get_size(mpframe) > 0) { + *out = MAKE_FRAME(MP_FRAME_AUDIO, mpframe); + } else { + talloc_free(mpframe); + } av_frame_unref(priv->avframe);