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

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 100503006: Cleanup OPUS decoder. Remove extraneous transforms and copies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Trimmings. Created 7 years 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_impl.cc ('k') | media/filters/opus_audio_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_demuxer.cc
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index e47c59eebc5f34c201ac8dcafc3c41483f2b7a67..6b8027164bd5a43d1744e862e6ff1159b8f5d411 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -845,6 +845,19 @@ void FFmpegDemuxer::OnReadFrameDone(ScopedAVPacket packet, int result) {
packet.swap(new_packet);
}
+ // Special case for opus in ogg. FFmpeg is pre-trimming the codec delay
+ // from the packet timestamp. Chrome expects to handle this itself inside
+ // the decoder, so shift timestamps by the delay in this case.
+ // TODO(dalecurtis): Try to get fixed upstream. See http://crbug.com/328207
+ if (strcmp(glue_->format_context()->iformat->name, "ogg") == 0) {
+ const AVCodecContext* codec_context =
+ glue_->format_context()->streams[packet->stream_index]->codec;
+ if (codec_context->codec_id == AV_CODEC_ID_OPUS &&
+ codec_context->delay > 0) {
+ packet->pts += codec_context->delay;
+ }
+ }
+
FFmpegDemuxerStream* demuxer_stream = streams_[packet->stream_index];
demuxer_stream->EnqueuePacket(packet.Pass());
}
« no previous file with comments | « media/filters/audio_renderer_impl.cc ('k') | media/filters/opus_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698