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

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

Issue 1833053005: Remove MediaTracks::getFirstAudio/VideoConfig (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-control
Patch Set: rebase Created 4 years, 6 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 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 "media/formats/mp2t/mp2t_stream_parser.h" 5 #include "media/formats/mp2t/mp2t_stream_parser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return true; 111 return true;
112 } 112 }
113 113
114 void OnInit(const StreamParser::InitParameters& params) { 114 void OnInit(const StreamParser::InitParameters& params) {
115 DVLOG(1) << "OnInit: dur=" << params.duration.InMilliseconds() 115 DVLOG(1) << "OnInit: dur=" << params.duration.InMilliseconds()
116 << ", autoTimestampOffset=" << params.auto_update_timestamp_offset; 116 << ", autoTimestampOffset=" << params.auto_update_timestamp_offset;
117 } 117 }
118 118
119 bool OnNewConfig(std::unique_ptr<MediaTracks> tracks, 119 bool OnNewConfig(std::unique_ptr<MediaTracks> tracks,
120 const StreamParser::TextTrackConfigMap& tc) { 120 const StreamParser::TextTrackConfigMap& tc) {
121 const AudioDecoderConfig& ac = tracks->getFirstAudioConfig(); 121 DVLOG(1) << "OnNewConfig: got " << tracks->tracks().size() << " tracks";
122 const VideoDecoderConfig& vc = tracks->getFirstVideoConfig(); 122 for (const auto& track : tracks->tracks()) {
123 DVLOG(1) << "OnNewConfig: media tracks count=" << tracks->tracks().size() 123 const auto& track_id = track->bytestream_track_id();
124 << ", audio=" << ac.IsValidConfig() 124 if (track->type() == MediaTrack::Audio) {
125 << ", video=" << vc.IsValidConfig(); 125 EXPECT_TRUE(tracks->getAudioConfig(track_id).IsValidConfig());
126 } else if (track->type() == MediaTrack::Video) {
127 EXPECT_TRUE(has_video_);
wolenetz 2016/06/16 20:20:36 Versus previous code, this misses catching a poten
servolk 2016/06/16 21:14:07 Yep, good catch, thanks! We should also check that
128 EXPECT_TRUE(tracks->getVideoConfig(track_id).IsValidConfig());
129 }
130 }
126 config_count_++; 131 config_count_++;
127 EXPECT_TRUE(ac.IsValidConfig());
128 EXPECT_EQ(vc.IsValidConfig(), has_video_);
129 return true; 132 return true;
130 } 133 }
131 134
132 135
133 void DumpBuffers(const std::string& label, 136 void DumpBuffers(const std::string& label,
134 const StreamParser::BufferQueue& buffers) { 137 const StreamParser::BufferQueue& buffers) {
135 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size(); 138 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size();
136 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin(); 139 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin();
137 buf != buffers.end(); buf++) { 140 buf != buffers.end(); buf++) {
138 DVLOG(3) << " n=" << buf - buffers.begin() 141 DVLOG(3) << " n=" << buf - buffers.begin()
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 parser_->Flush(); 300 parser_->Flush();
298 EXPECT_EQ(audio_frame_count_, 40); 301 EXPECT_EQ(audio_frame_count_, 40);
299 EXPECT_EQ(video_frame_count_, 0); 302 EXPECT_EQ(video_frame_count_, 0);
300 // This stream has no mid-stream configuration change. 303 // This stream has no mid-stream configuration change.
301 EXPECT_EQ(config_count_, 1); 304 EXPECT_EQ(config_count_, 1);
302 EXPECT_EQ(segment_count_, 1); 305 EXPECT_EQ(segment_count_, 1);
303 } 306 }
304 307
305 } // namespace mp2t 308 } // namespace mp2t
306 } // namespace media 309 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698