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

Side by Side Diff: media/mp2t/mp2t_stream_parser_unittest.cc

Issue 23702007: Render inband text tracks in the media pipeline (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: incorporate aaron's comments (10/16) Created 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 start += append_size; 53 start += append_size;
54 } 54 }
55 return true; 55 return true;
56 } 56 }
57 57
58 void OnInit(bool init_ok, base::TimeDelta duration) { 58 void OnInit(bool init_ok, base::TimeDelta duration) {
59 DVLOG(1) << "OnInit: ok=" << init_ok 59 DVLOG(1) << "OnInit: ok=" << init_ok
60 << ", dur=" << duration.InMilliseconds(); 60 << ", dur=" << duration.InMilliseconds();
61 } 61 }
62 62
63 bool OnNewConfig(const AudioDecoderConfig& ac, const VideoDecoderConfig& vc) { 63 bool OnNewConfig(const AudioDecoderConfig& ac,
64 const VideoDecoderConfig& vc,
65 const TextTrackConfigMap& tc) {
64 DVLOG(1) << "OnNewConfig: audio=" << ac.IsValidConfig() 66 DVLOG(1) << "OnNewConfig: audio=" << ac.IsValidConfig()
65 << ", video=" << vc.IsValidConfig(); 67 << ", video=" << vc.IsValidConfig();
66 return true; 68 return true;
67 } 69 }
68 70
69 71
70 void DumpBuffers(const std::string& label, 72 void DumpBuffers(const std::string& label,
71 const StreamParser::BufferQueue& buffers) { 73 const StreamParser::BufferQueue& buffers) {
72 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size(); 74 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size();
73 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin(); 75 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin();
(...skipping 20 matching lines...) Expand all
94 StreamParser::BufferQueue::const_iterator it2 = ++it1; 96 StreamParser::BufferQueue::const_iterator it2 = ++it1;
95 for ( ; it2 != video_buffers.end(); ++it1, ++it2) { 97 for ( ; it2 != video_buffers.end(); ++it1, ++it2) {
96 if ((*it2)->GetDecodeTimestamp() < (*it1)->GetDecodeTimestamp()) 98 if ((*it2)->GetDecodeTimestamp() < (*it1)->GetDecodeTimestamp())
97 return false; 99 return false;
98 } 100 }
99 } 101 }
100 102
101 return true; 103 return true;
102 } 104 }
103 105
104 bool OnNewTextBuffers(TextTrack* text_track, 106 bool OnNewTextBuffers(int text_track,
105 const StreamParser::BufferQueue& buffers) { 107 const StreamParser::BufferQueue& buffers) {
106 return true; 108 return true;
107 } 109 }
108 110
109 void OnKeyNeeded(const std::string& type, 111 void OnKeyNeeded(const std::string& type,
110 const std::vector<uint8>& init_data) { 112 const std::vector<uint8>& init_data) {
111 DVLOG(1) << "OnKeyNeeded: " << init_data.size(); 113 DVLOG(1) << "OnKeyNeeded: " << init_data.size();
112 } 114 }
113 115
114 scoped_ptr<TextTrack> OnAddTextTrack(
115 TextKind kind,
116 const std::string& label,
117 const std::string& language) {
118 return scoped_ptr<TextTrack>();
119 }
120
121 void OnNewSegment() { 116 void OnNewSegment() {
122 DVLOG(1) << "OnNewSegment"; 117 DVLOG(1) << "OnNewSegment";
123 } 118 }
124 119
125 void OnEndOfSegment() { 120 void OnEndOfSegment() {
126 DVLOG(1) << "OnEndOfSegment()"; 121 DVLOG(1) << "OnEndOfSegment()";
127 } 122 }
128 123
129 void InitializeParser() { 124 void InitializeParser() {
130 parser_->Init( 125 parser_->Init(
131 base::Bind(&Mp2tStreamParserTest::OnInit, 126 base::Bind(&Mp2tStreamParserTest::OnInit,
132 base::Unretained(this)), 127 base::Unretained(this)),
133 base::Bind(&Mp2tStreamParserTest::OnNewConfig, 128 base::Bind(&Mp2tStreamParserTest::OnNewConfig,
134 base::Unretained(this)), 129 base::Unretained(this)),
135 base::Bind(&Mp2tStreamParserTest::OnNewBuffers, 130 base::Bind(&Mp2tStreamParserTest::OnNewBuffers,
136 base::Unretained(this)), 131 base::Unretained(this)),
137 base::Bind(&Mp2tStreamParserTest::OnNewTextBuffers, 132 base::Bind(&Mp2tStreamParserTest::OnNewTextBuffers,
138 base::Unretained(this)), 133 base::Unretained(this)),
139 base::Bind(&Mp2tStreamParserTest::OnKeyNeeded, 134 base::Bind(&Mp2tStreamParserTest::OnKeyNeeded,
140 base::Unretained(this)), 135 base::Unretained(this)),
141 base::Bind(&Mp2tStreamParserTest::OnAddTextTrack, 136 true,
142 base::Unretained(this)),
143 base::Bind(&Mp2tStreamParserTest::OnNewSegment, 137 base::Bind(&Mp2tStreamParserTest::OnNewSegment,
144 base::Unretained(this)), 138 base::Unretained(this)),
145 base::Bind(&Mp2tStreamParserTest::OnEndOfSegment, 139 base::Bind(&Mp2tStreamParserTest::OnEndOfSegment,
146 base::Unretained(this)), 140 base::Unretained(this)),
147 LogCB()); 141 LogCB());
148 } 142 }
149 143
150 bool ParseMpeg2TsFile(const std::string& filename, int append_bytes) { 144 bool ParseMpeg2TsFile(const std::string& filename, int append_bytes) {
151 InitializeParser(); 145 InitializeParser();
152 146
(...skipping 27 matching lines...) Expand all
180 // (close to 2^33 / 90000) which results in timestamps wrap around 174 // (close to 2^33 / 90000) which results in timestamps wrap around
181 // in the Mpeg2 TS stream. 175 // in the Mpeg2 TS stream.
182 ParseMpeg2TsFile("bear-1280x720_ptswraparound.ts", 512); 176 ParseMpeg2TsFile("bear-1280x720_ptswraparound.ts", 512);
183 EXPECT_EQ(video_frame_count_, 81); 177 EXPECT_EQ(video_frame_count_, 81);
184 EXPECT_GE(video_min_dts_, base::TimeDelta::FromSeconds(95443 - 10)); 178 EXPECT_GE(video_min_dts_, base::TimeDelta::FromSeconds(95443 - 10));
185 EXPECT_LE(video_max_dts_, base::TimeDelta::FromSeconds(95443 + 10)); 179 EXPECT_LE(video_max_dts_, base::TimeDelta::FromSeconds(95443 + 10));
186 } 180 }
187 181
188 } // namespace mp2t 182 } // namespace mp2t
189 } // namespace media 183 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698