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

Side by Side Diff: media/filters/chunk_demuxer_unittest.cc

Issue 1539983004: Convert enable_mpeg2ts into a new-style buildflag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Buildfix Created 4 years, 11 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 (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 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "media/base/audio_decoder_config.h" 12 #include "media/base/audio_decoder_config.h"
13 #include "media/base/decoder_buffer.h" 13 #include "media/base/decoder_buffer.h"
14 #include "media/base/decrypt_config.h" 14 #include "media/base/decrypt_config.h"
15 #include "media/base/media_log.h" 15 #include "media/base/media_log.h"
16 #include "media/base/mock_demuxer_host.h" 16 #include "media/base/mock_demuxer_host.h"
17 #include "media/base/test_data_util.h" 17 #include "media/base/test_data_util.h"
18 #include "media/base/test_helpers.h" 18 #include "media/base/test_helpers.h"
19 #include "media/base/timestamp_constants.h" 19 #include "media/base/timestamp_constants.h"
20 #include "media/filters/chunk_demuxer.h" 20 #include "media/filters/chunk_demuxer.h"
21 #include "media/formats/webm/cluster_builder.h" 21 #include "media/formats/webm/cluster_builder.h"
22 #include "media/formats/webm/webm_constants.h" 22 #include "media/formats/webm/webm_constants.h"
23 #include "media/media_features.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 25
25 using ::testing::AnyNumber; 26 using ::testing::AnyNumber;
26 using ::testing::Exactly; 27 using ::testing::Exactly;
27 using ::testing::InSequence; 28 using ::testing::InSequence;
28 using ::testing::NotNull; 29 using ::testing::NotNull;
29 using ::testing::Return; 30 using ::testing::Return;
30 using ::testing::SaveArg; 31 using ::testing::SaveArg;
31 using ::testing::SetArgumentPointee; 32 using ::testing::SetArgumentPointee;
32 using ::testing::_; 33 using ::testing::_;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 type = "video/webm"; 351 type = "video/webm";
351 } 352 }
352 353
353 if (!has_audio && !has_video) { 354 if (!has_audio && !has_video) {
354 return AddId(kSourceId, HAS_AUDIO | HAS_VIDEO); 355 return AddId(kSourceId, HAS_AUDIO | HAS_VIDEO);
355 } 356 }
356 357
357 return demuxer_->AddId(source_id, type, codecs); 358 return demuxer_->AddId(source_id, type, codecs);
358 } 359 }
359 360
361 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
360 ChunkDemuxer::Status AddIdForMp2tSource(const std::string& source_id) { 362 ChunkDemuxer::Status AddIdForMp2tSource(const std::string& source_id) {
361 std::vector<std::string> codecs; 363 std::vector<std::string> codecs;
362 std::string type = "video/mp2t"; 364 std::string type = "video/mp2t";
363 codecs.push_back("mp4a.40.2"); 365 codecs.push_back("mp4a.40.2");
364 codecs.push_back("avc1.640028"); 366 codecs.push_back("avc1.640028");
365 return demuxer_->AddId(source_id, type, codecs); 367 return demuxer_->AddId(source_id, type, codecs);
366 } 368 }
369 #endif
367 370
368 void AppendData(const uint8_t* data, size_t length) { 371 void AppendData(const uint8_t* data, size_t length) {
369 AppendData(kSourceId, data, length); 372 AppendData(kSourceId, data, length);
370 } 373 }
371 374
372 void AppendCluster(const std::string& source_id, 375 void AppendCluster(const std::string& source_id,
373 scoped_ptr<Cluster> cluster) { 376 scoped_ptr<Cluster> cluster) {
374 AppendData(source_id, cluster->data(), cluster->size()); 377 AppendData(source_id, cluster->data(), cluster->size());
375 } 378 }
376 379
(...skipping 2658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3035 append_window_start_for_next_append_, 3038 append_window_start_for_next_append_,
3036 append_window_end_for_next_append_, 3039 append_window_end_for_next_append_,
3037 &timestamp_offset_map_[kSourceId]); 3040 &timestamp_offset_map_[kSourceId]);
3038 3041
3039 // After ResetParserState(), parsing should no longer be in the middle of a 3042 // After ResetParserState(), parsing should no longer be in the middle of a
3040 // media segment. 3043 // media segment.
3041 ASSERT_FALSE(demuxer_->IsParsingMediaSegment(kSourceId)); 3044 ASSERT_FALSE(demuxer_->IsParsingMediaSegment(kSourceId));
3042 } 3045 }
3043 3046
3044 #if defined(USE_PROPRIETARY_CODECS) 3047 #if defined(USE_PROPRIETARY_CODECS)
3045 #if defined(ENABLE_MPEG2TS_STREAM_PARSER) 3048 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
3046 TEST_F(ChunkDemuxerTest, EmitBuffersDuringAbort) { 3049 TEST_F(ChunkDemuxerTest, EmitBuffersDuringAbort) {
3047 EXPECT_CALL(*this, DemuxerOpened()); 3050 EXPECT_CALL(*this, DemuxerOpened());
3048 demuxer_->Initialize( 3051 demuxer_->Initialize(
3049 &host_, CreateInitDoneCB(kInfiniteDuration(), PIPELINE_OK), true); 3052 &host_, CreateInitDoneCB(kInfiniteDuration(), PIPELINE_OK), true);
3050 EXPECT_EQ(ChunkDemuxer::kOk, AddIdForMp2tSource(kSourceId)); 3053 EXPECT_EQ(ChunkDemuxer::kOk, AddIdForMp2tSource(kSourceId));
3051 3054
3052 // For info: 3055 // For info:
3053 // DTS/PTS derived using dvbsnoop -s ts -if bear-1280x720.ts -tssubdecode 3056 // DTS/PTS derived using dvbsnoop -s ts -if bear-1280x720.ts -tssubdecode
3054 // Video: first PES: 3057 // Video: first PES:
3055 // PTS: 126912 (0x0001efc0) [= 90 kHz-Timestamp: 0:00:01.4101] 3058 // PTS: 126912 (0x0001efc0) [= 90 kHz-Timestamp: 0:00:01.4101]
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
3971 // audio size is 80 bytes, new data is 28 bytes, we need to remove just one 10 3974 // audio size is 80 bytes, new data is 28 bytes, we need to remove just one 10
3972 // byte block to stay under 100 bytes memory limit after append 3975 // byte block to stay under 100 bytes memory limit after append
3973 // 80 - 10 + 28 = 98). 3976 // 80 - 10 + 28 = 98).
3974 // For video stream 150 + 52 = 202. Video limit is 150 bytes. We need to 3977 // For video stream 150 + 52 = 202. Video limit is 150 bytes. We need to
3975 // remove at least 6 blocks to stay under limit. 3978 // remove at least 6 blocks to stay under limit.
3976 CheckExpectedBuffers(audio_stream, "40K 80K 120K 160K 200K 240K 280K"); 3979 CheckExpectedBuffers(audio_stream, "40K 80K 120K 160K 200K 240K 280K");
3977 CheckExpectedBuffers(video_stream, "60K 70 80K 90 100K 110 120K 130 140K"); 3980 CheckExpectedBuffers(video_stream, "60K 70 80K 90 100K 110 120K 130 140K");
3978 } 3981 }
3979 3982
3980 } // namespace media 3983 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698