| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 | 1019 |
| 1020 // Video read #1. | 1020 // Video read #1. |
| 1021 video->Read(NewReadCB(FROM_HERE, 5276, 2402000, true)); | 1021 video->Read(NewReadCB(FROM_HERE, 5276, 2402000, true)); |
| 1022 base::RunLoop().Run(); | 1022 base::RunLoop().Run(); |
| 1023 | 1023 |
| 1024 // Video read #2. | 1024 // Video read #2. |
| 1025 video->Read(NewReadCB(FROM_HERE, 1740, 2436000, false)); | 1025 video->Read(NewReadCB(FROM_HERE, 1740, 2436000, false)); |
| 1026 base::RunLoop().Run(); | 1026 base::RunLoop().Run(); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 #if defined(USE_PROPRIETARY_CODECS) | 1029 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 1030 // Ensure ID3v1 tag reading is disabled. id3_test.mp3 has an ID3v1 tag with the | 1030 // Ensure ID3v1 tag reading is disabled. id3_test.mp3 has an ID3v1 tag with the |
| 1031 // field "title" set to "sample for id3 test". | 1031 // field "title" set to "sample for id3 test". |
| 1032 TEST_F(FFmpegDemuxerTest, NoID3TagData) { | 1032 TEST_F(FFmpegDemuxerTest, NoID3TagData) { |
| 1033 CreateDemuxer("id3_test.mp3"); | 1033 CreateDemuxer("id3_test.mp3"); |
| 1034 InitializeDemuxer(); | 1034 InitializeDemuxer(); |
| 1035 EXPECT_FALSE(av_dict_get(format_context()->metadata, "title", NULL, 0)); | 1035 EXPECT_FALSE(av_dict_get(format_context()->metadata, "title", NULL, 0)); |
| 1036 } | 1036 } |
| 1037 #endif | 1037 #endif |
| 1038 | 1038 |
| 1039 #if defined(USE_PROPRIETARY_CODECS) | 1039 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 1040 // Ensure MP3 files with large image/video based ID3 tags demux okay. FFmpeg | 1040 // Ensure MP3 files with large image/video based ID3 tags demux okay. FFmpeg |
| 1041 // will hand us a video stream to the data which will likely be in a format we | 1041 // will hand us a video stream to the data which will likely be in a format we |
| 1042 // don't accept as video; e.g. PNG. | 1042 // don't accept as video; e.g. PNG. |
| 1043 TEST_F(FFmpegDemuxerTest, Mp3WithVideoStreamID3TagData) { | 1043 TEST_F(FFmpegDemuxerTest, Mp3WithVideoStreamID3TagData) { |
| 1044 CreateDemuxer("id3_png_test.mp3"); | 1044 CreateDemuxer("id3_png_test.mp3"); |
| 1045 InitializeDemuxer(); | 1045 InitializeDemuxer(); |
| 1046 | 1046 |
| 1047 // Ensure the expected streams are present. | 1047 // Ensure the expected streams are present. |
| 1048 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); | 1048 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); |
| 1049 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); | 1049 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1065 // stream being demuxed. | 1065 // stream being demuxed. |
| 1066 TEST_F(FFmpegDemuxerTest, UnsupportedVideoSupportedAudioDemux) { | 1066 TEST_F(FFmpegDemuxerTest, UnsupportedVideoSupportedAudioDemux) { |
| 1067 CreateDemuxer("vorbis_audio_wmv_video.mkv"); | 1067 CreateDemuxer("vorbis_audio_wmv_video.mkv"); |
| 1068 InitializeDemuxer(); | 1068 InitializeDemuxer(); |
| 1069 | 1069 |
| 1070 // Ensure the expected streams are present. | 1070 // Ensure the expected streams are present. |
| 1071 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); | 1071 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); |
| 1072 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); | 1072 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); |
| 1073 } | 1073 } |
| 1074 | 1074 |
| 1075 #if defined(USE_PROPRIETARY_CODECS) | 1075 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 1076 // FFmpeg returns null data pointers when samples have zero size, leading to | 1076 // FFmpeg returns null data pointers when samples have zero size, leading to |
| 1077 // mistakenly creating end of stream buffers http://crbug.com/169133 | 1077 // mistakenly creating end of stream buffers http://crbug.com/169133 |
| 1078 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) { | 1078 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) { |
| 1079 CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4"); | 1079 CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4"); |
| 1080 InitializeDemuxer(); | 1080 InitializeDemuxer(); |
| 1081 ReadUntilEndOfStream(demuxer_->GetStream(DemuxerStream::AUDIO)); | 1081 ReadUntilEndOfStream(demuxer_->GetStream(DemuxerStream::AUDIO)); |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 class Mp3SeekFFmpegDemuxerTest | 1084 class Mp3SeekFFmpegDemuxerTest |
| 1085 : public FFmpegDemuxerTest, | 1085 : public FFmpegDemuxerTest, |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 EXPECT_EQ(audio_track2.kind(), "main"); | 1345 EXPECT_EQ(audio_track2.kind(), "main"); |
| 1346 EXPECT_EQ(audio_track2.label(), "SoundHandler"); | 1346 EXPECT_EQ(audio_track2.label(), "SoundHandler"); |
| 1347 EXPECT_EQ(audio_track2.language(), "und"); | 1347 EXPECT_EQ(audio_track2.language(), "und"); |
| 1348 } | 1348 } |
| 1349 | 1349 |
| 1350 TEST_F(FFmpegDemuxerTest, Read_Mp4_Crbug657437) { | 1350 TEST_F(FFmpegDemuxerTest, Read_Mp4_Crbug657437) { |
| 1351 CreateDemuxer("crbug657437.mp4"); | 1351 CreateDemuxer("crbug657437.mp4"); |
| 1352 InitializeDemuxer(); | 1352 InitializeDemuxer(); |
| 1353 } | 1353 } |
| 1354 | 1354 |
| 1355 #endif // defined(USE_PROPRIETARY_CODECS) | 1355 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 1356 | 1356 |
| 1357 TEST_F(FFmpegDemuxerTest, Read_Webm_Multiple_Tracks) { | 1357 TEST_F(FFmpegDemuxerTest, Read_Webm_Multiple_Tracks) { |
| 1358 CreateDemuxer("multitrack-3video-2audio.webm"); | 1358 CreateDemuxer("multitrack-3video-2audio.webm"); |
| 1359 InitializeDemuxer(); | 1359 InitializeDemuxer(); |
| 1360 | 1360 |
| 1361 EXPECT_EQ(media_tracks_->tracks().size(), 5u); | 1361 EXPECT_EQ(media_tracks_->tracks().size(), 5u); |
| 1362 | 1362 |
| 1363 const MediaTrack& video_track1 = *(media_tracks_->tracks()[0]); | 1363 const MediaTrack& video_track1 = *(media_tracks_->tracks()[0]); |
| 1364 EXPECT_EQ(video_track1.type(), MediaTrack::Video); | 1364 EXPECT_EQ(video_track1.type(), MediaTrack::Video); |
| 1365 EXPECT_EQ(video_track1.bytestream_track_id(), 1); | 1365 EXPECT_EQ(video_track1.bytestream_track_id(), 1); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); | 1500 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); |
| 1501 | 1501 |
| 1502 // Now pretend that audio stream got disabled. | 1502 // Now pretend that audio stream got disabled. |
| 1503 astream->set_enabled(false, base::TimeDelta()); | 1503 astream->set_enabled(false, base::TimeDelta()); |
| 1504 // Since there's no other enabled streams, the preferred seeking stream should | 1504 // Since there's no other enabled streams, the preferred seeking stream should |
| 1505 // still be the audio stream. | 1505 // still be the audio stream. |
| 1506 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); | 1506 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); |
| 1507 } | 1507 } |
| 1508 | 1508 |
| 1509 } // namespace media | 1509 } // namespace media |
| OLD | NEW |