diff options
author | wm4 <wm4@nowhere> | 2013-12-04 20:57:52 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-12-04 23:12:51 +0100 |
commit | 9c2858f37ff33c72550b54270122d810284cb52b (patch) | |
tree | 2c5b15100cce8dac1d502155b9572f0b1054ebae /video/decode/vd_lavc.c | |
parent | 8a84da8102cb9c436627a61cd3b674a8ad3e9708 (diff) | |
download | mpv-9c2858f37ff33c72550b54270122d810284cb52b.tar.bz2 mpv-9c2858f37ff33c72550b54270122d810284cb52b.tar.xz |
ad_lavc: deal with arbitrary decoder delay
Normally, audio decoder don't have a decoder delay, so the code was
fine. But FFmpeg supports multithreaded decoding for some audio codecs,
which introduces such a delay.
The delay means that we won't get decoded audio for the first few
packets, and that we need to do something to get the trailing audio
still buffered in the decoder when reaching EOF.
Two changes are needed to deal with the delay:
- If EOF is reached, pass a "flush" packet to the decoder to return the
buffered audio. Such a flush packet is automatically setup when
calling mp_set_av_packet() with a NULL packet.
- Use the PTS returned by the decoder, instead of the packet's. This is
important to get correct timestamps for decoded audio. Ignoring this
would result into offsetting the audio playback time by the decoder
delay. Note that we can still use the timestamp of the first packet
to get the timestamp for the start of the audio.
Diffstat (limited to 'video/decode/vd_lavc.c')
0 files changed, 0 insertions, 0 deletions