summaryrefslogtreecommitdiffstats
path: root/media/mp4
diff options
context:
space:
mode:
authoracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-26 18:50:41 +0000
committeracolwell@chromium.org <acolwell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-26 18:50:41 +0000
commit322d22cc0ed8ba7b0c64d598c9d0502bdef83b21 (patch)
tree9ecccba2e55346e5850ba21b945164397dd04d6f /media/mp4
parent28af1231f836bbc2da6fc89a32dc8fb44ecc4d31 (diff)
downloadchromium_src-322d22cc0ed8ba7b0c64d598c9d0502bdef83b21.zip
chromium_src-322d22cc0ed8ba7b0c64d598c9d0502bdef83b21.tar.gz
chromium_src-322d22cc0ed8ba7b0c64d598c9d0502bdef83b21.tar.bz2
Change NeedKeyCB to use std::vector.
Changes various NeedKeyCB instances to use std::vector<uint8> instead of a scoped_ptr<uint8[]> and a size parameter. TEST=All tests still pass. Review URL: https://chromiumcodereview.appspot.com/23072043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/mp4')
-rw-r--r--media/mp4/mp4_stream_parser.cc6
-rw-r--r--media/mp4/mp4_stream_parser_unittest.cc7
2 files changed, 6 insertions, 7 deletions
diff --git a/media/mp4/mp4_stream_parser.cc b/media/mp4/mp4_stream_parser.cc
index fc4ee8a..51ed756 100644
--- a/media/mp4/mp4_stream_parser.cc
+++ b/media/mp4/mp4_stream_parser.cc
@@ -339,14 +339,14 @@ void MP4StreamParser::EmitNeedKeyIfNecessary(
for (size_t i = 0; i < headers.size(); i++)
total_size += headers[i].raw_box.size();
- scoped_ptr<uint8[]> init_data(new uint8[total_size]);
+ std::vector<uint8> init_data(total_size);
size_t pos = 0;
for (size_t i = 0; i < headers.size(); i++) {
- memcpy(&init_data.get()[pos], &headers[i].raw_box[0],
+ memcpy(&init_data[pos], &headers[i].raw_box[0],
headers[i].raw_box.size());
pos += headers[i].raw_box.size();
}
- need_key_cb_.Run(kMp4InitDataType, init_data.Pass(), total_size);
+ need_key_cb_.Run(kMp4InitDataType, init_data);
}
bool MP4StreamParser::PrepareAVCBuffer(
diff --git a/media/mp4/mp4_stream_parser_unittest.cc b/media/mp4/mp4_stream_parser_unittest.cc
index fa880ac..816a210 100644
--- a/media/mp4/mp4_stream_parser_unittest.cc
+++ b/media/mp4/mp4_stream_parser_unittest.cc
@@ -94,11 +94,10 @@ class MP4StreamParserTest : public testing::Test {
}
void KeyNeededF(const std::string& type,
- scoped_ptr<uint8[]> init_data, int init_data_size) {
- DVLOG(1) << "KeyNeededF: " << init_data_size;
+ const std::vector<uint8>& init_data) {
+ DVLOG(1) << "KeyNeededF: " << init_data.size();
EXPECT_EQ(kMp4InitDataType, type);
- EXPECT_TRUE(init_data.get());
- EXPECT_GT(init_data_size, 0);
+ EXPECT_FALSE(init_data.empty());
}
scoped_ptr<TextTrack> AddTextTrackF(