diff options
author | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-27 07:23:13 +0000 |
---|---|---|
committer | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-27 07:23:13 +0000 |
commit | c8d4028a56c2baf53a33f94656c72d68c83bf46a (patch) | |
tree | feb8699122c3c6940ac3f67232d1b6b3747b8e5d /media/mp4 | |
parent | cea1dd7e12a2aba1d1ef7015c4e0d0dd826466bc (diff) | |
download | chromium_src-c8d4028a56c2baf53a33f94656c72d68c83bf46a.zip chromium_src-c8d4028a56c2baf53a33f94656c72d68c83bf46a.tar.gz chromium_src-c8d4028a56c2baf53a33f94656c72d68c83bf46a.tar.bz2 |
Add "type" in GenerateKeyRequest() and OnNeedKey().
The "type" information could help the CDM to parse the initialization data correctly.
See for details: https://www.w3.org/Bugs/Public/show_bug.cgi?id=19096
TBR=viettrungluu@chromium.org
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/11313016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164522 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/mp4')
-rw-r--r-- | media/mp4/mp4_stream_parser.cc | 5 | ||||
-rw-r--r-- | media/mp4/mp4_stream_parser_unittest.cc | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/media/mp4/mp4_stream_parser.cc b/media/mp4/mp4_stream_parser.cc index c600537..07135d8 100644 --- a/media/mp4/mp4_stream_parser.cc +++ b/media/mp4/mp4_stream_parser.cc @@ -20,6 +20,9 @@ namespace media { namespace mp4 { +// TODO(xhwang): Figure out the init data type appropriately once it's spec'ed. +static const char kMp4InitDataType[] = "video/mp4"; + MP4StreamParser::MP4StreamParser(bool has_sbr) : state_(kWaitingForInit), moof_head_(0), @@ -287,7 +290,7 @@ bool MP4StreamParser::EmitNeedKeyIfNecessary( headers[i].raw_box.size()); pos += headers[i].raw_box.size(); } - return need_key_cb_.Run(init_data.Pass(), total_size); + return need_key_cb_.Run(kMp4InitDataType, init_data.Pass(), total_size); } bool MP4StreamParser::PrepareAVCBuffer( diff --git a/media/mp4/mp4_stream_parser_unittest.cc b/media/mp4/mp4_stream_parser_unittest.cc index 6d7221a..81dbdd8 100644 --- a/media/mp4/mp4_stream_parser_unittest.cc +++ b/media/mp4/mp4_stream_parser_unittest.cc @@ -23,6 +23,9 @@ using base::TimeDelta; namespace media { namespace mp4 { +// TODO(xhwang): Figure out the init data type appropriately once it's spec'ed. +static const char kMp4InitDataType[] = "video/mp4"; + class MP4StreamParserTest : public testing::Test { public: MP4StreamParserTest() @@ -54,7 +57,7 @@ class MP4StreamParserTest : public testing::Test { void InitF(bool init_ok, base::TimeDelta duration) { DVLOG(1) << "InitF: ok=" << init_ok - << ", dur=" << duration.InMilliseconds(); + << ", dur=" << duration.InMilliseconds(); } bool NewConfigF(const AudioDecoderConfig& ac, const VideoDecoderConfig& vc) { @@ -76,8 +79,12 @@ class MP4StreamParserTest : public testing::Test { return true; } - bool KeyNeededF(scoped_array<uint8> init_data, int init_data_size) { + bool KeyNeededF(const std::string& type, + scoped_array<uint8> init_data, int init_data_size) { DVLOG(1) << "KeyNeededF: " << init_data_size; + EXPECT_EQ(kMp4InitDataType, type); + EXPECT_TRUE(init_data.get()); + EXPECT_GT(init_data_size, 0); return true; } |