OLD | NEW |
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 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 append_window_start_for_next_append_, | 3036 append_window_start_for_next_append_, |
3036 append_window_end_for_next_append_, | 3037 append_window_end_for_next_append_, |
3037 ×tamp_offset_map_[kSourceId]); | 3038 ×tamp_offset_map_[kSourceId]); |
3038 | 3039 |
3039 // After ResetParserState(), parsing should no longer be in the middle of a | 3040 // After ResetParserState(), parsing should no longer be in the middle of a |
3040 // media segment. | 3041 // media segment. |
3041 ASSERT_FALSE(demuxer_->IsParsingMediaSegment(kSourceId)); | 3042 ASSERT_FALSE(demuxer_->IsParsingMediaSegment(kSourceId)); |
3042 } | 3043 } |
3043 | 3044 |
3044 #if defined(USE_PROPRIETARY_CODECS) | 3045 #if defined(USE_PROPRIETARY_CODECS) |
3045 #if defined(ENABLE_MPEG2TS_STREAM_PARSER) | 3046 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
3046 TEST_F(ChunkDemuxerTest, EmitBuffersDuringAbort) { | 3047 TEST_F(ChunkDemuxerTest, EmitBuffersDuringAbort) { |
3047 EXPECT_CALL(*this, DemuxerOpened()); | 3048 EXPECT_CALL(*this, DemuxerOpened()); |
3048 demuxer_->Initialize( | 3049 demuxer_->Initialize( |
3049 &host_, CreateInitDoneCB(kInfiniteDuration(), PIPELINE_OK), true); | 3050 &host_, CreateInitDoneCB(kInfiniteDuration(), PIPELINE_OK), true); |
3050 EXPECT_EQ(ChunkDemuxer::kOk, AddIdForMp2tSource(kSourceId)); | 3051 EXPECT_EQ(ChunkDemuxer::kOk, AddIdForMp2tSource(kSourceId)); |
3051 | 3052 |
3052 // For info: | 3053 // For info: |
3053 // DTS/PTS derived using dvbsnoop -s ts -if bear-1280x720.ts -tssubdecode | 3054 // DTS/PTS derived using dvbsnoop -s ts -if bear-1280x720.ts -tssubdecode |
3054 // Video: first PES: | 3055 // Video: first PES: |
3055 // PTS: 126912 (0x0001efc0) [= 90 kHz-Timestamp: 0:00:01.4101] | 3056 // PTS: 126912 (0x0001efc0) [= 90 kHz-Timestamp: 0:00:01.4101] |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3971 // audio size is 80 bytes, new data is 28 bytes, we need to remove just one 10 | 3972 // 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 | 3973 // byte block to stay under 100 bytes memory limit after append |
3973 // 80 - 10 + 28 = 98). | 3974 // 80 - 10 + 28 = 98). |
3974 // For video stream 150 + 52 = 202. Video limit is 150 bytes. We need to | 3975 // For video stream 150 + 52 = 202. Video limit is 150 bytes. We need to |
3975 // remove at least 6 blocks to stay under limit. | 3976 // remove at least 6 blocks to stay under limit. |
3976 CheckExpectedBuffers(audio_stream, "40K 80K 120K 160K 200K 240K 280K"); | 3977 CheckExpectedBuffers(audio_stream, "40K 80K 120K 160K 200K 240K 280K"); |
3977 CheckExpectedBuffers(video_stream, "60K 70 80K 90 100K 110 120K 130 140K"); | 3978 CheckExpectedBuffers(video_stream, "60K 70 80K 90 100K 110 120K 130 140K"); |
3978 } | 3979 } |
3979 | 3980 |
3980 } // namespace media | 3981 } // namespace media |
OLD | NEW |