Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: media/formats/mp4/mp4_stream_parser_unittest.cc

Issue 616183002: Revert of Pass initDataType instead of contentType on OnNeedKey(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/formats/mp4/mp4_stream_parser.cc ('k') | media/formats/webm/webm_crypto_helpers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "media/base/audio_decoder_config.h" 13 #include "media/base/audio_decoder_config.h"
14 #include "media/base/decoder_buffer.h" 14 #include "media/base/decoder_buffer.h"
15 #include "media/base/stream_parser_buffer.h" 15 #include "media/base/stream_parser_buffer.h"
16 #include "media/base/test_data_util.h" 16 #include "media/base/test_data_util.h"
17 #include "media/base/text_track_config.h" 17 #include "media/base/text_track_config.h"
18 #include "media/base/video_decoder_config.h" 18 #include "media/base/video_decoder_config.h"
19 #include "media/formats/mp4/es_descriptor.h" 19 #include "media/formats/mp4/es_descriptor.h"
20 #include "media/formats/mp4/mp4_stream_parser.h" 20 #include "media/formats/mp4/mp4_stream_parser.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 22
23 using base::TimeDelta; 23 using base::TimeDelta;
24 24
25 namespace media { 25 namespace media {
26 namespace mp4 { 26 namespace mp4 {
27 27
28 static const char kCencInitDataType[] = "cenc"; 28 // TODO(xhwang): Figure out the init data type appropriately once it's spec'ed.
29 static const char kMp4InitDataType[] = "video/mp4";
29 30
30 class MP4StreamParserTest : public testing::Test { 31 class MP4StreamParserTest : public testing::Test {
31 public: 32 public:
32 MP4StreamParserTest() 33 MP4StreamParserTest()
33 : configs_received_(false), 34 : configs_received_(false),
34 lower_bound_( 35 lower_bound_(
35 DecodeTimestamp::FromPresentationTime(base::TimeDelta::Max())) { 36 DecodeTimestamp::FromPresentationTime(base::TimeDelta::Max())) {
36 std::set<int> audio_object_types; 37 std::set<int> audio_object_types;
37 audio_object_types.insert(kISO_14496_3); 38 audio_object_types.insert(kISO_14496_3);
38 parser_.reset(new MP4StreamParser(audio_object_types, false)); 39 parser_.reset(new MP4StreamParser(audio_object_types, false));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return false; 115 return false;
115 } 116 }
116 117
117 lower_bound_ = second_highest_timestamp; 118 lower_bound_ = second_highest_timestamp;
118 return true; 119 return true;
119 } 120 }
120 121
121 void KeyNeededF(const std::string& type, 122 void KeyNeededF(const std::string& type,
122 const std::vector<uint8>& init_data) { 123 const std::vector<uint8>& init_data) {
123 DVLOG(1) << "KeyNeededF: " << init_data.size(); 124 DVLOG(1) << "KeyNeededF: " << init_data.size();
124 EXPECT_EQ(kCencInitDataType, type); 125 EXPECT_EQ(kMp4InitDataType, type);
125 EXPECT_FALSE(init_data.empty()); 126 EXPECT_FALSE(init_data.empty());
126 } 127 }
127 128
128 void NewSegmentF() { 129 void NewSegmentF() {
129 DVLOG(1) << "NewSegmentF"; 130 DVLOG(1) << "NewSegmentF";
130 lower_bound_ = kNoDecodeTimestamp(); 131 lower_bound_ = kNoDecodeTimestamp();
131 } 132 }
132 133
133 void EndOfSegmentF() { 134 void EndOfSegmentF() {
134 DVLOG(1) << "EndOfSegmentF()"; 135 DVLOG(1) << "EndOfSegmentF()";
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // Delimiter (AUD) NALU. 243 // Delimiter (AUD) NALU.
243 TEST_F(MP4StreamParserTest, VideoSamplesStartWithAUDs) { 244 TEST_F(MP4StreamParserTest, VideoSamplesStartWithAUDs) {
244 ParseMP4File("bear-1280x720-av_with-aud-nalus_frag.mp4", 512); 245 ParseMP4File("bear-1280x720-av_with-aud-nalus_frag.mp4", 512);
245 } 246 }
246 247
247 // TODO(strobe): Create and test media which uses CENC auxiliary info stored 248 // TODO(strobe): Create and test media which uses CENC auxiliary info stored
248 // inside a private box 249 // inside a private box
249 250
250 } // namespace mp4 251 } // namespace mp4
251 } // namespace media 252 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp4/mp4_stream_parser.cc ('k') | media/formats/webm/webm_crypto_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698