decoder/ffmpeg: use AVSEEK_FLAG_BACKWARD for seeking
Ask FFmpeg to seek to the next packet boundary *before* the seek position, so we don't miss audio data. Now we get too much, but we'll solve that in the next commit.
This commit is contained in:
parent
f768ca3a2d
commit
d11e2724c4
@ -597,8 +597,12 @@ ffmpeg_decode(Decoder &decoder, InputStream &input)
|
||||
av_stream->time_base) +
|
||||
start_time_fallback(*av_stream);
|
||||
|
||||
/* AVSEEK_FLAG_BACKWARD asks FFmpeg to seek to
|
||||
the packet boundary before the seek time
|
||||
stamp, not after */
|
||||
|
||||
if (av_seek_frame(format_context, audio_stream, where,
|
||||
AVSEEK_FLAG_ANY) < 0)
|
||||
AVSEEK_FLAG_ANY|AVSEEK_FLAG_BACKWARD) < 0)
|
||||
decoder_seek_error(decoder);
|
||||
else {
|
||||
avcodec_flush_buffers(codec_context);
|
||||
|
Loading…
Reference in New Issue
Block a user