diff options
author | wm4 <wm4@nowhere> | 2014-11-03 19:56:38 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-11-03 19:56:38 +0100 |
commit | 93e1db0bff5fc48dffeb2dc94801436bdb459cd3 (patch) | |
tree | 87d4cf86f35d093d9dccb34333f78e9678c5c094 /audio/decode/ad_lavc.c | |
parent | 416c86f3cb3535a5b252b8c08a7f4cb253fa495a (diff) | |
download | mpv-93e1db0bff5fc48dffeb2dc94801436bdb459cd3.tar.bz2 mpv-93e1db0bff5fc48dffeb2dc94801436bdb459cd3.tar.xz |
ad_lavc: allow skip samples amount to be larger than 1 packet
Apparently we actually need this. At least the following commit would
break without this.
Diffstat (limited to 'audio/decode/ad_lavc.c')
-rw-r--r-- | audio/decode/ad_lavc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index 16a4ae45d0..31ac5f71ba 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -44,6 +44,7 @@ struct priv { struct mp_audio frame; bool force_channel_map; struct demux_packet *packet; + uint32_t skip_samples; }; static void uninit(struct dec_audio *da); @@ -107,11 +108,13 @@ static void set_data_from_avframe(struct dec_audio *da) av_frame_get_side_data(priv->avframe, AV_FRAME_DATA_SKIP_SAMPLES); if (sd && sd->size >= 10) { char *d = sd->data; - uint32_t skip = AV_RL32(d + 0); + priv->skip_samples += AV_RL32(d + 0); uint32_t pad = AV_RL32(d + 4); - if (skip <= da->decoded.samples) { + uint32_t skip = MPMIN(priv->skip_samples, da->decoded.samples); + if (skip) { mp_audio_skip_samples(&da->decoded, skip); da->pts_offset += skip; + priv->skip_samples -= skip; } if (pad <= da->decoded.samples) da->decoded.samples -= pad; @@ -222,6 +225,7 @@ static int control(struct dec_audio *da, int cmd, void *arg) mp_audio_set_null_data(&da->decoded); talloc_free(ctx->packet); ctx->packet = NULL; + ctx->skip_samples = 0; return CONTROL_TRUE; } return CONTROL_UNKNOWN; |