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

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

Issue 13419002: Media Source dispatches inband text tracks (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 7 years, 7 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/mp4/mp4_stream_parser.cc ('k') | media/webm/webm_parser.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 for (StreamParser::BufferQueue::const_iterator buf = bufs.begin(); 75 for (StreamParser::BufferQueue::const_iterator buf = bufs.begin();
76 buf != bufs.end(); buf++) { 76 buf != bufs.end(); buf++) {
77 DVLOG(3) << " n=" << buf - bufs.begin() 77 DVLOG(3) << " n=" << buf - bufs.begin()
78 << ", size=" << (*buf)->GetDataSize() 78 << ", size=" << (*buf)->GetDataSize()
79 << ", dur=" << (*buf)->GetDuration().InMilliseconds(); 79 << ", dur=" << (*buf)->GetDuration().InMilliseconds();
80 EXPECT_GE((*buf)->GetTimestamp(), segment_start_); 80 EXPECT_GE((*buf)->GetTimestamp(), segment_start_);
81 } 81 }
82 return true; 82 return true;
83 } 83 }
84 84
85 bool NewTextBuffersF(TextTrack* text_track,
86 const StreamParser::BufferQueue& buffers) {
87 return true;
88 }
89
85 bool KeyNeededF(const std::string& type, 90 bool KeyNeededF(const std::string& type,
86 scoped_ptr<uint8[]> init_data, int init_data_size) { 91 scoped_ptr<uint8[]> init_data, int init_data_size) {
87 DVLOG(1) << "KeyNeededF: " << init_data_size; 92 DVLOG(1) << "KeyNeededF: " << init_data_size;
88 EXPECT_EQ(kMp4InitDataType, type); 93 EXPECT_EQ(kMp4InitDataType, type);
89 EXPECT_TRUE(init_data.get()); 94 EXPECT_TRUE(init_data.get());
90 EXPECT_GT(init_data_size, 0); 95 EXPECT_GT(init_data_size, 0);
91 return true; 96 return true;
92 } 97 }
93 98
99 scoped_ptr<TextTrack> AddTextTrackF(
100 TextKind kind,
101 const std::string& label,
102 const std::string& language) {
103 return scoped_ptr<TextTrack>();
104 }
105
94 void NewSegmentF(TimeDelta start_dts) { 106 void NewSegmentF(TimeDelta start_dts) {
95 DVLOG(1) << "NewSegmentF: " << start_dts.InMilliseconds(); 107 DVLOG(1) << "NewSegmentF: " << start_dts.InMilliseconds();
96 segment_start_ = start_dts; 108 segment_start_ = start_dts;
97 } 109 }
98 110
99 void EndOfSegmentF() { 111 void EndOfSegmentF() {
100 DVLOG(1) << "EndOfSegmentF()"; 112 DVLOG(1) << "EndOfSegmentF()";
101 } 113 }
102 114
103 void InitializeParser() { 115 void InitializeParser() {
104 parser_->Init( 116 parser_->Init(
105 base::Bind(&MP4StreamParserTest::InitF, base::Unretained(this)), 117 base::Bind(&MP4StreamParserTest::InitF, base::Unretained(this)),
106 base::Bind(&MP4StreamParserTest::NewConfigF, base::Unretained(this)), 118 base::Bind(&MP4StreamParserTest::NewConfigF, base::Unretained(this)),
107 base::Bind(&MP4StreamParserTest::NewBuffersF, base::Unretained(this)), 119 base::Bind(&MP4StreamParserTest::NewBuffersF, base::Unretained(this)),
108 base::Bind(&MP4StreamParserTest::NewBuffersF, base::Unretained(this)), 120 base::Bind(&MP4StreamParserTest::NewBuffersF, base::Unretained(this)),
121 base::Bind(&MP4StreamParserTest::NewTextBuffersF,
122 base::Unretained(this)),
109 base::Bind(&MP4StreamParserTest::KeyNeededF, base::Unretained(this)), 123 base::Bind(&MP4StreamParserTest::KeyNeededF, base::Unretained(this)),
124 base::Bind(&MP4StreamParserTest::AddTextTrackF, base::Unretained(this)),
110 base::Bind(&MP4StreamParserTest::NewSegmentF, base::Unretained(this)), 125 base::Bind(&MP4StreamParserTest::NewSegmentF, base::Unretained(this)),
111 base::Bind(&MP4StreamParserTest::EndOfSegmentF, 126 base::Bind(&MP4StreamParserTest::EndOfSegmentF,
112 base::Unretained(this)), 127 base::Unretained(this)),
113 LogCB()); 128 LogCB());
114 } 129 }
115 130
116 bool ParseMP4File(const std::string& filename, int append_bytes) { 131 bool ParseMP4File(const std::string& filename, int append_bytes) {
117 InitializeParser(); 132 InitializeParser();
118 133
119 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename); 134 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 audio_object_types.insert(kISO_13818_7_AAC_LC); 187 audio_object_types.insert(kISO_13818_7_AAC_LC);
173 parser_.reset(new MP4StreamParser(audio_object_types, false)); 188 parser_.reset(new MP4StreamParser(audio_object_types, false));
174 ParseMP4File("bear-mpeg2-aac-only_frag.mp4", 512); 189 ParseMP4File("bear-mpeg2-aac-only_frag.mp4", 512);
175 } 190 }
176 191
177 // TODO(strobe): Create and test media which uses CENC auxiliary info stored 192 // TODO(strobe): Create and test media which uses CENC auxiliary info stored
178 // inside a private box 193 // inside a private box
179 194
180 } // namespace mp4 195 } // namespace mp4
181 } // namespace media 196 } // namespace media
OLDNEW
« no previous file with comments | « media/mp4/mp4_stream_parser.cc ('k') | media/webm/webm_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698