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

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: rebase 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
« no previous file with comments | « media/base/mime_util_unittest.cc ('k') | media/filters/stream_parser_factory.cc » ('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 "media/filters/chunk_demuxer.h" 5 #include "media/filters/chunk_demuxer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "media/base/audio_decoder_config.h" 18 #include "media/base/audio_decoder_config.h"
19 #include "media/base/decoder_buffer.h" 19 #include "media/base/decoder_buffer.h"
20 #include "media/base/decrypt_config.h" 20 #include "media/base/decrypt_config.h"
21 #include "media/base/media_log.h" 21 #include "media/base/media_log.h"
22 #include "media/base/mock_demuxer_host.h" 22 #include "media/base/mock_demuxer_host.h"
23 #include "media/base/test_data_util.h" 23 #include "media/base/test_data_util.h"
24 #include "media/base/test_helpers.h" 24 #include "media/base/test_helpers.h"
25 #include "media/base/timestamp_constants.h" 25 #include "media/base/timestamp_constants.h"
26 #include "media/formats/webm/cluster_builder.h" 26 #include "media/formats/webm/cluster_builder.h"
27 #include "media/formats/webm/webm_constants.h" 27 #include "media/formats/webm/webm_constants.h"
28 #include "media/media_features.h"
28 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
29 30
30 using ::testing::AnyNumber; 31 using ::testing::AnyNumber;
31 using ::testing::Exactly; 32 using ::testing::Exactly;
32 using ::testing::InSequence; 33 using ::testing::InSequence;
33 using ::testing::NotNull; 34 using ::testing::NotNull;
34 using ::testing::Return; 35 using ::testing::Return;
35 using ::testing::SaveArg; 36 using ::testing::SaveArg;
36 using ::testing::SetArgumentPointee; 37 using ::testing::SetArgumentPointee;
37 using ::testing::_; 38 using ::testing::_;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 type = "video/webm"; 356 type = "video/webm";
356 } 357 }
357 358
358 if (!has_audio && !has_video) { 359 if (!has_audio && !has_video) {
359 return AddId(kSourceId, HAS_AUDIO | HAS_VIDEO); 360 return AddId(kSourceId, HAS_AUDIO | HAS_VIDEO);
360 } 361 }
361 362
362 return demuxer_->AddId(source_id, type, codecs); 363 return demuxer_->AddId(source_id, type, codecs);
363 } 364 }
364 365
366 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
365 ChunkDemuxer::Status AddIdForMp2tSource(const std::string& source_id) { 367 ChunkDemuxer::Status AddIdForMp2tSource(const std::string& source_id) {
366 std::vector<std::string> codecs; 368 std::vector<std::string> codecs;
367 std::string type = "video/mp2t"; 369 std::string type = "video/mp2t";
368 codecs.push_back("mp4a.40.2"); 370 codecs.push_back("mp4a.40.2");
369 codecs.push_back("avc1.640028"); 371 codecs.push_back("avc1.640028");
370 return demuxer_->AddId(source_id, type, codecs); 372 return demuxer_->AddId(source_id, type, codecs);
371 } 373 }
374 #endif
372 375
373 void AppendData(const uint8_t* data, size_t length) { 376 void AppendData(const uint8_t* data, size_t length) {
374 AppendData(kSourceId, data, length); 377 AppendData(kSourceId, data, length);
375 } 378 }
376 379
377 void AppendCluster(const std::string& source_id, 380 void AppendCluster(const std::string& source_id,
378 scoped_ptr<Cluster> cluster) { 381 scoped_ptr<Cluster> cluster) {
379 AppendData(source_id, cluster->data(), cluster->size()); 382 AppendData(source_id, cluster->data(), cluster->size());
380 } 383 }
381 384
(...skipping 2658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3040 append_window_start_for_next_append_, 3043 append_window_start_for_next_append_,
3041 append_window_end_for_next_append_, 3044 append_window_end_for_next_append_,
3042 &timestamp_offset_map_[kSourceId]); 3045 &timestamp_offset_map_[kSourceId]);
3043 3046
3044 // After ResetParserState(), parsing should no longer be in the middle of a 3047 // After ResetParserState(), parsing should no longer be in the middle of a
3045 // media segment. 3048 // media segment.
3046 ASSERT_FALSE(demuxer_->IsParsingMediaSegment(kSourceId)); 3049 ASSERT_FALSE(demuxer_->IsParsingMediaSegment(kSourceId));
3047 } 3050 }
3048 3051
3049 #if defined(USE_PROPRIETARY_CODECS) 3052 #if defined(USE_PROPRIETARY_CODECS)
3050 #if defined(ENABLE_MPEG2TS_STREAM_PARSER) 3053 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
3051 TEST_F(ChunkDemuxerTest, EmitBuffersDuringAbort) { 3054 TEST_F(ChunkDemuxerTest, EmitBuffersDuringAbort) {
3052 EXPECT_CALL(*this, DemuxerOpened()); 3055 EXPECT_CALL(*this, DemuxerOpened());
3053 demuxer_->Initialize( 3056 demuxer_->Initialize(
3054 &host_, CreateInitDoneCB(kInfiniteDuration(), PIPELINE_OK), true); 3057 &host_, CreateInitDoneCB(kInfiniteDuration(), PIPELINE_OK), true);
3055 EXPECT_EQ(ChunkDemuxer::kOk, AddIdForMp2tSource(kSourceId)); 3058 EXPECT_EQ(ChunkDemuxer::kOk, AddIdForMp2tSource(kSourceId));
3056 3059
3057 // For info: 3060 // For info:
3058 // DTS/PTS derived using dvbsnoop -s ts -if bear-1280x720.ts -tssubdecode 3061 // DTS/PTS derived using dvbsnoop -s ts -if bear-1280x720.ts -tssubdecode
3059 // Video: first PES: 3062 // Video: first PES:
3060 // PTS: 126912 (0x0001efc0) [= 90 kHz-Timestamp: 0:00:01.4101] 3063 // PTS: 126912 (0x0001efc0) [= 90 kHz-Timestamp: 0:00:01.4101]
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
3976 // audio size is 80 bytes, new data is 28 bytes, we need to remove just one 10 3979 // audio size is 80 bytes, new data is 28 bytes, we need to remove just one 10
3977 // byte block to stay under 100 bytes memory limit after append 3980 // byte block to stay under 100 bytes memory limit after append
3978 // 80 - 10 + 28 = 98). 3981 // 80 - 10 + 28 = 98).
3979 // For video stream 150 + 52 = 202. Video limit is 150 bytes. We need to 3982 // For video stream 150 + 52 = 202. Video limit is 150 bytes. We need to
3980 // remove at least 6 blocks to stay under limit. 3983 // remove at least 6 blocks to stay under limit.
3981 CheckExpectedBuffers(audio_stream, "40K 80K 120K 160K 200K 240K 280K"); 3984 CheckExpectedBuffers(audio_stream, "40K 80K 120K 160K 200K 240K 280K");
3982 CheckExpectedBuffers(video_stream, "60K 70 80K 90 100K 110 120K 130 140K"); 3985 CheckExpectedBuffers(video_stream, "60K 70 80K 90 100K 110 120K 130 140K");
3983 } 3986 }
3984 3987
3985 } // namespace media 3988 } // namespace media
OLDNEW
« no previous file with comments | « media/base/mime_util_unittest.cc ('k') | media/filters/stream_parser_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698