summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-02-22 19:50:09 +0100
committerwm4 <wm4@nowhere>2016-02-22 19:50:09 +0100
commitd52b2981c0cdc88c6679262f26dd097c2eb4df83 (patch)
tree07979bc19c0d35c2fbf1fbe11c9b407c300041ef
parent65b858f7d34d07a3e11ef22406015b027145b5b6 (diff)
downloadmpv-d52b2981c0cdc88c6679262f26dd097c2eb4df83.tar.bz2
mpv-d52b2981c0cdc88c6679262f26dd097c2eb4df83.tar.xz
ad_lavc: move skipping logic out of the HAVE_AVFRAME_SKIP_SAMPLES block
-rw-r--r--audio/decode/ad_lavc.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index 5cd335b44c..96625cae2f 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -231,25 +231,28 @@ static int decode_packet(struct dec_audio *da, struct demux_packet *mpkt,
if (mpframe->pts != MP_NOPTS_VALUE)
priv->next_pts = mpframe->pts + mpframe->samples / (double)mpframe->rate;
+ uint32_t pad = 0;
+
#if HAVE_AVFRAME_SKIP_SAMPLES
AVFrameSideData *sd =
av_frame_get_side_data(priv->avframe, AV_FRAME_DATA_SKIP_SAMPLES);
if (sd && sd->size >= 10) {
char *d = sd->data;
priv->skip_samples += AV_RL32(d + 0);
- uint32_t pad = AV_RL32(d + 4);
- uint32_t skip = MPMIN(priv->skip_samples, mpframe->samples);
- if (skip) {
- mp_audio_skip_samples(mpframe, skip);
- if (mpframe->pts != MP_NOPTS_VALUE)
- mpframe->pts += skip / (double)mpframe->rate;
- priv->skip_samples -= skip;
- }
- if (pad <= mpframe->samples)
- mpframe->samples -= pad;
+ pad = AV_RL32(d + 4);
}
#endif
+ uint32_t skip = MPMIN(priv->skip_samples, mpframe->samples);
+ if (skip) {
+ mp_audio_skip_samples(mpframe, skip);
+ if (mpframe->pts != MP_NOPTS_VALUE)
+ mpframe->pts += skip / (double)mpframe->rate;
+ priv->skip_samples -= skip;
+ }
+ if (pad <= mpframe->samples)
+ mpframe->samples -= pad;
+
*out = mpframe;
av_frame_unref(priv->avframe);