| 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 4752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4763 ASSERT_TRUE(AppendInitSegmentWithSourceId(kId1, HAS_AUDIO | HAS_VIDEO)); | 4763 ASSERT_TRUE(AppendInitSegmentWithSourceId(kId1, HAS_AUDIO | HAS_VIDEO)); |
| 4764 EXPECT_NE(nullptr, GetStream(DemuxerStream::AUDIO)); | 4764 EXPECT_NE(nullptr, GetStream(DemuxerStream::AUDIO)); |
| 4765 EXPECT_NE(nullptr, GetStream(DemuxerStream::VIDEO)); | 4765 EXPECT_NE(nullptr, GetStream(DemuxerStream::VIDEO)); |
| 4766 | 4766 |
| 4767 // Removing the id should remove also the DemuxerStreams. | 4767 // Removing the id should remove also the DemuxerStreams. |
| 4768 demuxer_->RemoveId(kId1); | 4768 demuxer_->RemoveId(kId1); |
| 4769 EXPECT_EQ(nullptr, GetStream(DemuxerStream::AUDIO)); | 4769 EXPECT_EQ(nullptr, GetStream(DemuxerStream::AUDIO)); |
| 4770 EXPECT_EQ(nullptr, GetStream(DemuxerStream::VIDEO)); | 4770 EXPECT_EQ(nullptr, GetStream(DemuxerStream::VIDEO)); |
| 4771 } | 4771 } |
| 4772 | 4772 |
| 4773 TEST_F(ChunkDemuxerTest, Mp4Vp9CodecSupport) { |
| 4774 ChunkDemuxer::Status expected = ChunkDemuxer::kNotSupported; |
| 4775 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 4776 expected = ChunkDemuxer::kOk; |
| 4777 #endif |
| 4778 |
| 4779 EXPECT_EQ(demuxer_->AddId("source_id", "video/mp4", "vp09.00.10.08"), |
| 4780 expected); |
| 4781 } |
| 4782 |
| 4773 // TODO(servolk): Add a unit test with multiple audio/video tracks using the | 4783 // TODO(servolk): Add a unit test with multiple audio/video tracks using the |
| 4774 // same codec type in a single SourceBufferState, when WebM parser supports | 4784 // same codec type in a single SourceBufferState, when WebM parser supports |
| 4775 // multiple tracks. crbug.com/646900 | 4785 // multiple tracks. crbug.com/646900 |
| 4776 | 4786 |
| 4777 class ChunkDemuxerMp4Vp9Test : public ChunkDemuxerTest, | |
| 4778 public WithParamInterface<bool> { | |
| 4779 public: | |
| 4780 void SetUp() override { | |
| 4781 ChunkDemuxerTest::SetUp(); | |
| 4782 const bool enable_mp4_vp9_demuxing = GetParam(); | |
| 4783 if (enable_mp4_vp9_demuxing) { | |
| 4784 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 4785 switches::kEnableVp9InMp4); | |
| 4786 } | |
| 4787 } | |
| 4788 }; | |
| 4789 | |
| 4790 TEST_P(ChunkDemuxerMp4Vp9Test, CodecSupport) { | |
| 4791 ChunkDemuxer::Status expected = ChunkDemuxer::kNotSupported; | |
| 4792 | |
| 4793 #if BUILDFLAG(USE_PROPRIETARY_CODECS) | |
| 4794 const bool enable_mp4_vp9_demuxing = GetParam(); | |
| 4795 if (enable_mp4_vp9_demuxing) { | |
| 4796 expected = ChunkDemuxer::kOk; | |
| 4797 } else { | |
| 4798 EXPECT_MEDIA_LOG( | |
| 4799 HasSubstr("Codec 'vp09.00.10.08' is not supported for 'video/mp4'")); | |
| 4800 } | |
| 4801 #endif | |
| 4802 | |
| 4803 EXPECT_EQ(demuxer_->AddId("source_id", "video/mp4", "vp09.00.10.08"), | |
| 4804 expected); | |
| 4805 } | |
| 4806 | |
| 4807 INSTANTIATE_TEST_CASE_P(EnableDisableMp4Vp9Demuxing, | |
| 4808 ChunkDemuxerMp4Vp9Test, | |
| 4809 ::testing::Bool()); | |
| 4810 | |
| 4811 } // namespace media | 4787 } // namespace media |
| OLD | NEW |