| 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 "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> |
| (...skipping 3046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3057 demuxer_->StartWaitingForSeek(seek_time); | 3057 demuxer_->StartWaitingForSeek(seek_time); |
| 3058 demuxer_->Seek(seek_time, | 3058 demuxer_->Seek(seek_time, |
| 3059 NewExpectedStatusCB(PIPELINE_ERROR_ABORT)); | 3059 NewExpectedStatusCB(PIPELINE_ERROR_ABORT)); |
| 3060 ExpectRead(DemuxerStream::AUDIO, 0); | 3060 ExpectRead(DemuxerStream::AUDIO, 0); |
| 3061 ExpectEndOfStream(DemuxerStream::VIDEO); | 3061 ExpectEndOfStream(DemuxerStream::VIDEO); |
| 3062 } | 3062 } |
| 3063 | 3063 |
| 3064 TEST_F(ChunkDemuxerTest, CodecPrefixMatching) { | 3064 TEST_F(ChunkDemuxerTest, CodecPrefixMatching) { |
| 3065 ChunkDemuxer::Status expected = ChunkDemuxer::kNotSupported; | 3065 ChunkDemuxer::Status expected = ChunkDemuxer::kNotSupported; |
| 3066 | 3066 |
| 3067 #if defined(USE_PROPRIETARY_CODECS) | 3067 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 3068 #if defined(OS_ANDROID) | 3068 #if defined(OS_ANDROID) |
| 3069 if (HasPlatformDecoderSupport()) | 3069 if (HasPlatformDecoderSupport()) |
| 3070 expected = ChunkDemuxer::kOk; | 3070 expected = ChunkDemuxer::kOk; |
| 3071 #else | 3071 #else |
| 3072 expected = ChunkDemuxer::kOk; | 3072 expected = ChunkDemuxer::kOk; |
| 3073 #endif | 3073 #endif |
| 3074 #endif | 3074 #endif |
| 3075 | 3075 |
| 3076 EXPECT_EQ(demuxer_->AddId("source_id", "video/mp4", "avc1.4D4041"), expected); | 3076 EXPECT_EQ(demuxer_->AddId("source_id", "video/mp4", "avc1.4D4041"), expected); |
| 3077 } | 3077 } |
| 3078 | 3078 |
| 3079 // Test codec ID's that are not compliant with RFC6381, but have been | 3079 // Test codec ID's that are not compliant with RFC6381, but have been |
| 3080 // seen in the wild. | 3080 // seen in the wild. |
| 3081 TEST_F(ChunkDemuxerTest, CodecIDsThatAreNotRFC6381Compliant) { | 3081 TEST_F(ChunkDemuxerTest, CodecIDsThatAreNotRFC6381Compliant) { |
| 3082 ChunkDemuxer::Status expected = ChunkDemuxer::kNotSupported; | 3082 ChunkDemuxer::Status expected = ChunkDemuxer::kNotSupported; |
| 3083 | 3083 |
| 3084 #if defined(USE_PROPRIETARY_CODECS) | 3084 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 3085 expected = ChunkDemuxer::kOk; | 3085 expected = ChunkDemuxer::kOk; |
| 3086 #endif | 3086 #endif |
| 3087 const char* codec_ids[] = { | 3087 const char* codec_ids[] = { |
| 3088 // GPAC places leading zeros on the audio object type. | 3088 // GPAC places leading zeros on the audio object type. |
| 3089 "mp4a.40.02", | 3089 "mp4a.40.02", |
| 3090 "mp4a.40.05" | 3090 "mp4a.40.05" |
| 3091 }; | 3091 }; |
| 3092 | 3092 |
| 3093 for (size_t i = 0; i < arraysize(codec_ids); ++i) { | 3093 for (size_t i = 0; i < arraysize(codec_ids); ++i) { |
| 3094 ChunkDemuxer::Status result = | 3094 ChunkDemuxer::Status result = |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3385 demuxer_->ResetParserState(kSourceId, | 3385 demuxer_->ResetParserState(kSourceId, |
| 3386 append_window_start_for_next_append_, | 3386 append_window_start_for_next_append_, |
| 3387 append_window_end_for_next_append_, | 3387 append_window_end_for_next_append_, |
| 3388 ×tamp_offset_map_[kSourceId]); | 3388 ×tamp_offset_map_[kSourceId]); |
| 3389 | 3389 |
| 3390 // After ResetParserState(), parsing should no longer be in the middle of a | 3390 // After ResetParserState(), parsing should no longer be in the middle of a |
| 3391 // media segment. | 3391 // media segment. |
| 3392 ASSERT_FALSE(demuxer_->IsParsingMediaSegment(kSourceId)); | 3392 ASSERT_FALSE(demuxer_->IsParsingMediaSegment(kSourceId)); |
| 3393 } | 3393 } |
| 3394 | 3394 |
| 3395 #if defined(USE_PROPRIETARY_CODECS) | 3395 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 3396 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) | 3396 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
| 3397 namespace { | 3397 namespace { |
| 3398 const char* kMp2tMimeType = "video/mp2t"; | 3398 const char* kMp2tMimeType = "video/mp2t"; |
| 3399 const char* kMp2tCodecs = "mp4a.40.2,avc1.640028"; | 3399 const char* kMp2tCodecs = "mp4a.40.2,avc1.640028"; |
| 3400 } | 3400 } |
| 3401 | 3401 |
| 3402 TEST_F(ChunkDemuxerTest, EmitBuffersDuringAbort) { | 3402 TEST_F(ChunkDemuxerTest, EmitBuffersDuringAbort) { |
| 3403 EXPECT_CALL(*this, DemuxerOpened()); | 3403 EXPECT_CALL(*this, DemuxerOpened()); |
| 3404 EXPECT_MEDIA_LOG(FoundStream("audio")); | 3404 EXPECT_MEDIA_LOG(FoundStream("audio")); |
| 3405 EXPECT_MEDIA_LOG(CodecName("audio", "aac")); | 3405 EXPECT_MEDIA_LOG(CodecName("audio", "aac")); |
| (...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4759 if (enable_mp4_vp9_demuxing) { | 4759 if (enable_mp4_vp9_demuxing) { |
| 4760 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 4760 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 4761 switches::kEnableVp9InMp4); | 4761 switches::kEnableVp9InMp4); |
| 4762 } | 4762 } |
| 4763 } | 4763 } |
| 4764 }; | 4764 }; |
| 4765 | 4765 |
| 4766 TEST_P(ChunkDemuxerMp4Vp9Test, CodecSupport) { | 4766 TEST_P(ChunkDemuxerMp4Vp9Test, CodecSupport) { |
| 4767 ChunkDemuxer::Status expected = ChunkDemuxer::kNotSupported; | 4767 ChunkDemuxer::Status expected = ChunkDemuxer::kNotSupported; |
| 4768 | 4768 |
| 4769 #if defined(USE_PROPRIETARY_CODECS) | 4769 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 4770 const bool enable_mp4_vp9_demuxing = GetParam(); | 4770 const bool enable_mp4_vp9_demuxing = GetParam(); |
| 4771 if (enable_mp4_vp9_demuxing) { | 4771 if (enable_mp4_vp9_demuxing) { |
| 4772 expected = ChunkDemuxer::kOk; | 4772 expected = ChunkDemuxer::kOk; |
| 4773 } else { | 4773 } else { |
| 4774 EXPECT_MEDIA_LOG(HasSubstr( | 4774 EXPECT_MEDIA_LOG(HasSubstr( |
| 4775 "Codec 'vp09.00.01.08.02.01.01.00' is not supported for 'video/mp4'")); | 4775 "Codec 'vp09.00.01.08.02.01.01.00' is not supported for 'video/mp4'")); |
| 4776 } | 4776 } |
| 4777 #endif | 4777 #endif |
| 4778 | 4778 |
| 4779 EXPECT_EQ( | 4779 EXPECT_EQ( |
| 4780 demuxer_->AddId("source_id", "video/mp4", "vp09.00.01.08.02.01.01.00"), | 4780 demuxer_->AddId("source_id", "video/mp4", "vp09.00.01.08.02.01.01.00"), |
| 4781 expected); | 4781 expected); |
| 4782 } | 4782 } |
| 4783 | 4783 |
| 4784 INSTANTIATE_TEST_CASE_P(EnableDisableMp4Vp9Demuxing, | 4784 INSTANTIATE_TEST_CASE_P(EnableDisableMp4Vp9Demuxing, |
| 4785 ChunkDemuxerMp4Vp9Test, | 4785 ChunkDemuxerMp4Vp9Test, |
| 4786 ::testing::Bool()); | 4786 ::testing::Bool()); |
| 4787 | 4787 |
| 4788 } // namespace media | 4788 } // namespace media |
| OLD | NEW |