diff options
author | wm4 <wm4@nowhere> | 2015-11-08 17:22:56 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-11-08 17:22:56 +0100 |
commit | d91434756b1bd16d788d93e6b888c2d1a54f1968 (patch) | |
tree | a1960427fac54e8ecbf2f2309dafdefb2d663aaa /audio/decode/dec_audio.c | |
parent | 03013e0fd73cde9b0dc7f2d65387491000ee894b (diff) | |
download | mpv-d91434756b1bd16d788d93e6b888c2d1a54f1968.tar.bz2 mpv-d91434756b1bd16d788d93e6b888c2d1a54f1968.tar.xz |
audio: move PTS setting out of the decoder
Instead of requiring the decoder to set the PTS directly on the
dec_audio context (including handling absence of PTS etc.), transfer the
packet PTS to the decoded audio frame. Marginally simpler, and gives
more control to the generic code.
Diffstat (limited to 'audio/decode/dec_audio.c')
-rw-r--r-- | audio/decode/dec_audio.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/audio/decode/dec_audio.c b/audio/decode/dec_audio.c index edf26951f7..623951eb22 100644 --- a/audio/decode/dec_audio.c +++ b/audio/decode/dec_audio.c @@ -170,14 +170,18 @@ static int decode_new_frame(struct dec_audio *da) if (ret < 0) return ret; - if (da->pts == MP_NOPTS_VALUE && da->header->missing_timestamps) - da->pts = 0; - if (da->waiting) { + if (da->waiting->pts != MP_NOPTS_VALUE) { + da->pts = da->waiting->pts; + da->pts_offset = 0; + } da->pts_offset += da->waiting->samples; da->decode_format = *da->waiting; mp_audio_set_null_data(&da->decode_format); } + + if (da->pts == MP_NOPTS_VALUE && da->header->missing_timestamps) + da->pts = 0; } return mp_audio_config_valid(da->waiting) ? AD_OK : AD_ERR; } |