Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Unified Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 3032030: Implement accurate seeking by decoding audio/video until we reach our desired timestamp. (Closed)
Patch Set: Fixes Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/audio_renderer_base.cc ('k') | media/filters/video_renderer_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_audio_decoder.cc
diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc
index 09b0caf107516233847120fffd2861ab16aa8aa6..133e7dc9e694852d4e76804c13aac712610ec9d9 100644
--- a/media/filters/ffmpeg_audio_decoder.cc
+++ b/media/filters/ffmpeg_audio_decoder.cc
@@ -155,6 +155,17 @@ static void ConvertAudioF32ToS32(void* buffer, int buffer_size) {
}
void FFmpegAudioDecoder::DoDecode(Buffer* input) {
+ // FFmpeg tends to seek Ogg audio streams in the middle of nowhere, giving us
+ // a whole bunch of AV_NOPTS_VALUE packets. Discard them until we find
+ // something valid.
+ // TODO(hclam): remove this once fixing the issue in FFmpeg.
+ if (input->GetTimestamp() == StreamSample::kInvalidTimestamp &&
+ estimated_next_timestamp_ == StreamSample::kInvalidTimestamp &&
+ !input->IsEndOfStream()) {
+ DecoderBase<AudioDecoder, Buffer>::OnDecodeComplete();
+ return;
+ }
+
// Due to FFmpeg API changes we no longer have const read-only pointers.
AVPacket packet;
av_init_packet(&packet);
« no previous file with comments | « media/filters/audio_renderer_base.cc ('k') | media/filters/video_renderer_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698