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

Unified 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: Avoid crashes in tests 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/formats/mp2t/mp2t_stream_parser.cc ('k') | media/formats/mp4/mp4_stream_parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp2t/mp2t_stream_parser_unittest.cc
diff --git a/media/formats/mp2t/mp2t_stream_parser_unittest.cc b/media/formats/mp2t/mp2t_stream_parser_unittest.cc
index 9395a241d3c5fd14e7cc0c48cea27e9715141b4e..6c76023cc016ae011c28a1f5d36377fbde52cad1 100644
--- a/media/formats/mp2t/mp2t_stream_parser_unittest.cc
+++ b/media/formats/mp2t/mp2t_stream_parser_unittest.cc
@@ -118,14 +118,26 @@ class Mp2tStreamParserTest : public testing::Test {
bool OnNewConfig(std::unique_ptr<MediaTracks> tracks,
const StreamParser::TextTrackConfigMap& tc) {
- const AudioDecoderConfig& ac = tracks->getFirstAudioConfig();
- const VideoDecoderConfig& vc = tracks->getFirstVideoConfig();
- DVLOG(1) << "OnNewConfig: media tracks count=" << tracks->tracks().size()
- << ", audio=" << ac.IsValidConfig()
- << ", video=" << vc.IsValidConfig();
+ DVLOG(1) << "OnNewConfig: got " << tracks->tracks().size() << " tracks";
+ bool found_audio_track = false;
+ bool found_video_track = false;
+ for (const auto& track : tracks->tracks()) {
+ const auto& track_id = track->bytestream_track_id();
+ if (track->type() == MediaTrack::Audio) {
+ found_audio_track = true;
+ EXPECT_TRUE(tracks->getAudioConfig(track_id).IsValidConfig());
+ } else if (track->type() == MediaTrack::Video) {
+ found_video_track = true;
+ EXPECT_TRUE(tracks->getVideoConfig(track_id).IsValidConfig());
+ } else {
+ // Unexpected track type.
+ LOG(ERROR) << "Unexpected track type " << track->type();
+ EXPECT_TRUE(false);
+ }
+ }
+ EXPECT_TRUE(found_audio_track);
+ EXPECT_EQ(has_video_, found_video_track);
config_count_++;
- EXPECT_TRUE(ac.IsValidConfig());
- EXPECT_EQ(vc.IsValidConfig(), has_video_);
return true;
}
@@ -185,7 +197,8 @@ class Mp2tStreamParserTest : public testing::Test {
void OnKeyNeeded(EmeInitDataType type,
const std::vector<uint8_t>& init_data) {
- NOTREACHED() << "OnKeyNeeded not expected in the Mpeg2 TS parser";
+ LOG(ERROR) << "OnKeyNeeded not expected in the Mpeg2 TS parser";
+ EXPECT_TRUE(false);
}
void OnNewSegment() {
@@ -194,7 +207,8 @@ class Mp2tStreamParserTest : public testing::Test {
}
void OnEndOfSegment() {
- NOTREACHED() << "OnEndOfSegment not expected in the Mpeg2 TS parser";
+ LOG(ERROR) << "OnEndOfSegment not expected in the Mpeg2 TS parser";
+ EXPECT_TRUE(false);
}
void InitializeParser() {
« no previous file with comments | « media/formats/mp2t/mp2t_stream_parser.cc ('k') | media/formats/mp4/mp4_stream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698