summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-02 02:34:34 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-02 02:34:34 +0000
commitd2cf4787e75a7f0f431dede5a86e77f275148e1b (patch)
tree38c9075ffe6e2a5bf16ff519eae5dd7f63671a2f /media
parent655051daaef6ec771e01887c4e0c7a1ad7f5702a (diff)
downloadchromium_src-d2cf4787e75a7f0f431dede5a86e77f275148e1b.zip
chromium_src-d2cf4787e75a7f0f431dede5a86e77f275148e1b.tar.gz
chromium_src-d2cf4787e75a7f0f431dede5a86e77f275148e1b.tar.bz2
Enable support for additional media formats by using the duration from AVFormatContext, if present.
Some media formats do not have a duration specified in the individual audio/video streams. However if the container itself lists a duration we can simply rely on that value. Patch by ducksource@gmail.com BUG=none TEST=additional media formats should be playable in Chrome if enabled in FFmpeg Review URL: http://codereview.chromium.org/1608005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43439 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/filters/ffmpeg_demuxer.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 94ce91c..2a205b8 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -452,7 +452,13 @@ void FFmpegDemuxer::InitializeTask(DataSource* data_source,
callback->Run();
return;
}
-
+ if (max_duration.InMicroseconds() == 0 &&
+ format_context_->duration != static_cast<int64_t>(AV_NOPTS_VALUE)) {
+ // If we could not obtain duration from an A/V stream, and file duration
+ // has been set: use the file duration as |max_duration|.
+ const AVRational av_time_base = {1, AV_TIME_BASE};
+ max_duration = ConvertTimestamp(av_time_base, format_context_->duration);
+ }
// Good to go: set the duration and notify we're done initializing.
host()->SetDuration(max_duration);
callback->Run();