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

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: Patch demuxer. 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
Index: media/filters/ffmpeg_demuxer.cc
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index e47c59eebc5f34c201ac8dcafc3c41483f2b7a67..38e4879c7af6e3a369796cc702b41ea69428ab08 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -845,6 +845,18 @@ 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.
+ if (strcmp(glue_->format_context()->iformat->name, "ogg") == 0) {
acolwell GONE FROM CHROMIUM 2013/12/12 22:40:46 Add a TODO & crbug to get this difference between
DaleCurtis 2013/12/12 23:36:04 Done.
+ 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());
}

Powered by Google App Engine
This is Rietveld 408576698