summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authoracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-18 10:29:55 +0000
committeracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-18 10:29:55 +0000
commit6ce837cc5935728fa8d506aa1ef502ae758ac745 (patch)
tree8df98d88089d9dacc0588f7c99e6133a1bed466f /media
parentabafff342a1565ca70e05e8799abb6cdc80608b5 (diff)
downloadchromium_src-6ce837cc5935728fa8d506aa1ef502ae758ac745.zip
chromium_src-6ce837cc5935728fa8d506aa1ef502ae758ac745.tar.gz
chromium_src-6ce837cc5935728fa8d506aa1ef502ae758ac745.tar.bz2
Add support for avc3 codec string.
The avc3 codec string is used for H.264 content where the SPS & PPS are included at the beginning of each access point instead of in the file headers. This change just allows these streams to be played since our decoders already support this. In fact, our avc1 code essentially creates avc3 style streams for the decoder anyways. BUG=306545 TEST=PipelineIntegrationTest.BasicPlayback_MediaSource_VideoOnly_MP4_AVC3 Review URL: https://codereview.chromium.org/27374002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229347 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/filters/pipeline_integration_test.cc21
-rw-r--r--media/filters/stream_parser_factory.cc9
-rw-r--r--media/mp4/box_definitions.cc11
-rw-r--r--media/mp4/box_definitions.h2
-rw-r--r--media/mp4/fourccs.h1
-rw-r--r--media/mp4/mp4_stream_parser.cc4
-rw-r--r--media/test/data/bear-1280x720-v_frag-avc3.mp4bin0 -> 689173 bytes
7 files changed, 39 insertions, 9 deletions
diff --git a/media/filters/pipeline_integration_test.cc b/media/filters/pipeline_integration_test.cc
index 698367fa..6f38923 100644
--- a/media/filters/pipeline_integration_test.cc
+++ b/media/filters/pipeline_integration_test.cc
@@ -34,6 +34,7 @@ const char kMP4AudioType[] = "audio/mp4";
#if defined(USE_PROPRIETARY_CODECS)
const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\"";
const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\"";
+const char kMP4VideoAVC3[] = "video/mp4; codecs=\"avc3.64001f\"";
const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\"";
const char kMP3[] = "audio/mpeg";
#endif // defined(USE_PROPRIETARY_CODECS)
@@ -69,6 +70,7 @@ const char kBenchmarkAudioFile[] = "benchmark-audio-file";
const int k640IsoFileDurationMs = 2737;
const int k640IsoCencFileDurationMs = 2736;
const int k1280IsoFileDurationMs = 2736;
+const int k1280IsoAVC3FileDurationMs = 2735;
#endif // defined(USE_PROPRIETARY_CODECS)
// Note: Tests using this class only exercise the DecryptingDemuxerStream path.
@@ -963,6 +965,25 @@ TEST_F(PipelineIntegrationTest,
source.Abort();
Stop();
}
+
+TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_VideoOnly_MP4_AVC3) {
+ MockMediaSource source("bear-1280x720-v_frag-avc3.mp4", kMP4VideoAVC3,
+ kAppendWholeFile);
+ StartPipelineWithMediaSource(&source);
+ source.EndOfStream();
+
+ EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
+ EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
+ EXPECT_EQ(k1280IsoAVC3FileDurationMs,
+ pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
+
+ Play();
+
+ ASSERT_TRUE(WaitUntilOnEnded());
+ source.Abort();
+ Stop();
+}
+
#endif
// TODO(acolwell): Fix flakiness http://crbug.com/117921
diff --git a/media/filters/stream_parser_factory.cc b/media/filters/stream_parser_factory.cc
index c41164b..b743688 100644
--- a/media/filters/stream_parser_factory.cc
+++ b/media/filters/stream_parser_factory.cc
@@ -130,8 +130,10 @@ bool ValidateMP4ACodecID(const std::string& codec_id, const LogCB& log_cb) {
return false;
}
-static const CodecInfo kH264CodecInfo = { "avc1.*", CodecInfo::VIDEO, NULL,
- CodecInfo::HISTOGRAM_H264 };
+static const CodecInfo kH264AVC1CodecInfo = { "avc1.*", CodecInfo::VIDEO, NULL,
+ CodecInfo::HISTOGRAM_H264 };
+static const CodecInfo kH264AVC3CodecInfo = { "avc3.*", CodecInfo::VIDEO, NULL,
+ CodecInfo::HISTOGRAM_H264 };
static const CodecInfo kMPEG4AACCodecInfo = { "mp4a.40.*", CodecInfo::AUDIO,
&ValidateMP4ACodecID,
CodecInfo::HISTOGRAM_MPEG4AAC };
@@ -145,7 +147,8 @@ static const CodecInfo kEAC3CodecInfo = { "mp4a.a6", CodecInfo::AUDIO, NULL,
#endif
static const CodecInfo* kVideoMP4Codecs[] = {
- &kH264CodecInfo,
+ &kH264AVC1CodecInfo,
+ &kH264AVC3CodecInfo,
&kMPEG4AACCodecInfo,
&kMPEG2AACLCCodecInfo,
NULL
diff --git a/media/mp4/box_definitions.cc b/media/mp4/box_definitions.cc
index e7f1693..218e5bb 100644
--- a/media/mp4/box_definitions.cc
+++ b/media/mp4/box_definitions.cc
@@ -399,13 +399,18 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
}
}
- if (format == FOURCC_AVC1 ||
- (format == FOURCC_ENCV && sinf.format.format == FOURCC_AVC1)) {
+ if (IsFormatValid())
RCHECK(reader->ReadChild(&avcc));
- }
+
return true;
}
+bool VideoSampleEntry::IsFormatValid() const {
+ return format == FOURCC_AVC1 || format == FOURCC_AVC3 ||
+ (format == FOURCC_ENCV && (sinf.format.format == FOURCC_AVC1 ||
+ sinf.format.format == FOURCC_AVC3));
+}
+
ElementaryStreamDescriptor::ElementaryStreamDescriptor()
: object_type(kForbidden) {}
diff --git a/media/mp4/box_definitions.h b/media/mp4/box_definitions.h
index eab8c4f..d2af86d 100644
--- a/media/mp4/box_definitions.h
+++ b/media/mp4/box_definitions.h
@@ -183,6 +183,8 @@ struct MEDIA_EXPORT VideoSampleEntry : Box {
// Currently expected to be present regardless of format.
AVCDecoderConfigurationRecord avcc;
+
+ bool IsFormatValid() const;
};
struct MEDIA_EXPORT ElementaryStreamDescriptor : Box {
diff --git a/media/mp4/fourccs.h b/media/mp4/fourccs.h
index b71d2ff3..01cce2b 100644
--- a/media/mp4/fourccs.h
+++ b/media/mp4/fourccs.h
@@ -13,6 +13,7 @@ namespace mp4 {
enum FourCC {
FOURCC_NULL = 0,
FOURCC_AVC1 = 0x61766331,
+ FOURCC_AVC3 = 0x61766333,
FOURCC_AVCC = 0x61766343,
FOURCC_BLOC = 0x626C6F63,
FOURCC_CENC = 0x63656e63,
diff --git a/media/mp4/mp4_stream_parser.cc b/media/mp4/mp4_stream_parser.cc
index 26cee44..19855ab 100644
--- a/media/mp4/mp4_stream_parser.cc
+++ b/media/mp4/mp4_stream_parser.cc
@@ -268,9 +268,7 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
desc_idx = 0;
const VideoSampleEntry& entry = samp_descr.video_entries[desc_idx];
- if (!(entry.format == FOURCC_AVC1 ||
- (entry.format == FOURCC_ENCV &&
- entry.sinf.format.format == FOURCC_AVC1))) {
+ if (!entry.IsFormatValid()) {
MEDIA_LOG(log_cb_) << "Unsupported video format 0x"
<< std::hex << entry.format << " in stsd box.";
return false;
diff --git a/media/test/data/bear-1280x720-v_frag-avc3.mp4 b/media/test/data/bear-1280x720-v_frag-avc3.mp4
new file mode 100644
index 0000000..25970ac
--- /dev/null
+++ b/media/test/data/bear-1280x720-v_frag-avc3.mp4
Binary files differ