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 #include <deque> | 6 #include <deque> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 | 666 |
667 // Video read #1. | 667 // Video read #1. |
668 video->Read(NewReadCB(FROM_HERE, 5276, 2402000)); | 668 video->Read(NewReadCB(FROM_HERE, 5276, 2402000)); |
669 message_loop_.Run(); | 669 message_loop_.Run(); |
670 | 670 |
671 // Video read #2. | 671 // Video read #2. |
672 video->Read(NewReadCB(FROM_HERE, 1740, 2436000)); | 672 video->Read(NewReadCB(FROM_HERE, 1740, 2436000)); |
673 message_loop_.Run(); | 673 message_loop_.Run(); |
674 } | 674 } |
675 | 675 |
| 676 #if defined(USE_PROPRIETARY_CODECS) |
676 // Ensure ID3v1 tag reading is disabled. id3_test.mp3 has an ID3v1 tag with the | 677 // Ensure ID3v1 tag reading is disabled. id3_test.mp3 has an ID3v1 tag with the |
677 // field "title" set to "sample for id3 test". | 678 // field "title" set to "sample for id3 test". |
678 TEST_F(FFmpegDemuxerTest, NoID3TagData) { | 679 TEST_F(FFmpegDemuxerTest, NoID3TagData) { |
679 #if !defined(USE_PROPRIETARY_CODECS) | |
680 return; | |
681 #endif | |
682 CreateDemuxer("id3_test.mp3"); | 680 CreateDemuxer("id3_test.mp3"); |
683 InitializeDemuxer(); | 681 InitializeDemuxer(); |
684 EXPECT_FALSE(av_dict_get(format_context()->metadata, "title", NULL, 0)); | 682 EXPECT_FALSE(av_dict_get(format_context()->metadata, "title", NULL, 0)); |
685 } | 683 } |
| 684 #endif |
686 | 685 |
| 686 #if defined(USE_PROPRIETARY_CODECS) |
687 // Ensure MP3 files with large image/video based ID3 tags demux okay. FFmpeg | 687 // Ensure MP3 files with large image/video based ID3 tags demux okay. FFmpeg |
688 // will hand us a video stream to the data which will likely be in a format we | 688 // will hand us a video stream to the data which will likely be in a format we |
689 // don't accept as video; e.g. PNG. | 689 // don't accept as video; e.g. PNG. |
690 TEST_F(FFmpegDemuxerTest, Mp3WithVideoStreamID3TagData) { | 690 TEST_F(FFmpegDemuxerTest, Mp3WithVideoStreamID3TagData) { |
691 #if !defined(USE_PROPRIETARY_CODECS) | |
692 return; | |
693 #endif | |
694 CreateDemuxer("id3_png_test.mp3"); | 691 CreateDemuxer("id3_png_test.mp3"); |
695 InitializeDemuxer(); | 692 InitializeDemuxer(); |
696 | 693 |
697 // Ensure the expected streams are present. | 694 // Ensure the expected streams are present. |
698 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); | 695 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); |
699 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); | 696 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); |
700 } | 697 } |
| 698 #endif |
701 | 699 |
702 // Ensure a video with an unsupported audio track still results in the video | 700 // Ensure a video with an unsupported audio track still results in the video |
703 // stream being demuxed. | 701 // stream being demuxed. |
704 TEST_F(FFmpegDemuxerTest, UnsupportedAudioSupportedVideoDemux) { | 702 TEST_F(FFmpegDemuxerTest, UnsupportedAudioSupportedVideoDemux) { |
705 CreateDemuxer("speex_audio_vorbis_video.ogv"); | 703 CreateDemuxer("speex_audio_vorbis_video.ogv"); |
706 InitializeDemuxer(); | 704 InitializeDemuxer(); |
707 | 705 |
708 // Ensure the expected streams are present. | 706 // Ensure the expected streams are present. |
709 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::VIDEO)); | 707 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::VIDEO)); |
710 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::AUDIO)); | 708 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::AUDIO)); |
711 } | 709 } |
712 | 710 |
713 // Ensure a video with an unsupported video track still results in the audio | 711 // Ensure a video with an unsupported video track still results in the audio |
714 // stream being demuxed. | 712 // stream being demuxed. |
715 TEST_F(FFmpegDemuxerTest, UnsupportedVideoSupportedAudioDemux) { | 713 TEST_F(FFmpegDemuxerTest, UnsupportedVideoSupportedAudioDemux) { |
716 CreateDemuxer("vorbis_audio_wmv_video.mkv"); | 714 CreateDemuxer("vorbis_audio_wmv_video.mkv"); |
717 InitializeDemuxer(); | 715 InitializeDemuxer(); |
718 | 716 |
719 // Ensure the expected streams are present. | 717 // Ensure the expected streams are present. |
720 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); | 718 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); |
721 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); | 719 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); |
722 } | 720 } |
723 | 721 |
| 722 #if defined(USE_PROPRIETARY_CODECS) |
724 // FFmpeg returns null data pointers when samples have zero size, leading to | 723 // FFmpeg returns null data pointers when samples have zero size, leading to |
725 // mistakenly creating end of stream buffers http://crbug.com/169133 | 724 // mistakenly creating end of stream buffers http://crbug.com/169133 |
726 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) { | 725 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) { |
727 #if !defined(USE_PROPRIETARY_CODECS) | |
728 return; | |
729 #endif | |
730 CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4"); | 726 CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4"); |
731 InitializeDemuxer(); | 727 InitializeDemuxer(); |
732 ReadUntilEndOfStream(demuxer_->GetStream(DemuxerStream::AUDIO)); | 728 ReadUntilEndOfStream(demuxer_->GetStream(DemuxerStream::AUDIO)); |
733 } | 729 } |
| 730 #endif |
734 | 731 |
735 } // namespace media | 732 } // namespace media |
OLD | NEW |