summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-13 21:40:38 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-13 21:40:38 +0000
commitfb66cafbeadd31e8c34578e90d62c0b6ab4b8c42 (patch)
tree43648b6d359f4fb07d18a5e5e11956f3168d7f7e
parentbace3746bdb912302f0b15443ee264134ff3b7ad (diff)
downloadchromium_src-fb66cafbeadd31e8c34578e90d62c0b6ab4b8c42.zip
chromium_src-fb66cafbeadd31e8c34578e90d62c0b6ab4b8c42.tar.gz
chromium_src-fb66cafbeadd31e8c34578e90d62c0b6ab4b8c42.tar.bz2
Set AVFMT_FLAG_GENPTS when demuxing AVI content.
Storing MPEG-4 B-frames in AVI has always been a bit of a hack and by default av_read_frame() will return non-timestamped video packets for such content. AVFMT_FLAG_GENPTS takes advantage of AVI's constant framerate to generate presentation timestamps at the expense of parsing delay. BUG=169570 Review URL: https://codereview.chromium.org/12209111 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182310 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/media/media_browsertest.cc5
-rw-r--r--media/filters/ffmpeg_demuxer.cc5
2 files changed, 6 insertions, 4 deletions
diff --git a/content/browser/media/media_browsertest.cc b/content/browser/media/media_browsertest.cc
index ec70dcd..ccdd688 100644
--- a/content/browser/media/media_browsertest.cc
+++ b/content/browser/media/media_browsertest.cc
@@ -123,10 +123,7 @@ IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4) {
PlayVideo("bear_mpeg4_mp3.avi", GetParam());
}
-// TODO(scherkus): MPEG-4 ASP contains B-frames and out-of-order decoding, which
-// makes FFmpeg spit out video frames with no timestamp. As a result we DCHECK()
-// all over the place http://crbug.com/169570
-IN_PROC_BROWSER_TEST_P(MediaTest, DISABLED_VideoBearAviMp3Mpeg4Asp) {
+IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearAviMp3Mpeg4Asp) {
PlayVideo("bear_mpeg4asp_mp3.avi", GetParam());
}
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 56929bc..f1b0385 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -478,6 +478,11 @@ void FFmpegDemuxer::OnFindStreamInfoDone(const PipelineStatusCB& status_cb,
if (start_time_ == kNoTimestamp())
start_time_ = base::TimeDelta();
+ // MPEG-4 B-frames cause grief for a simple container like AVI. Enable PTS
+ // generation so we always get timestamps, see http://crbug.com/169570
+ if (strcmp(format_context->iformat->name, "avi") == 0)
+ format_context->flags |= AVFMT_FLAG_GENPTS;
+
// Good to go: set the duration and bitrate and notify we're done
// initializing.
host_->SetDuration(max_duration);