| 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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 | 1029 |
| 1030 // Video read #1. | 1030 // Video read #1. |
| 1031 video->Read(NewReadCB(FROM_HERE, 5276, 2402000, true)); | 1031 video->Read(NewReadCB(FROM_HERE, 5276, 2402000, true)); |
| 1032 base::RunLoop().Run(); | 1032 base::RunLoop().Run(); |
| 1033 | 1033 |
| 1034 // Video read #2. | 1034 // Video read #2. |
| 1035 video->Read(NewReadCB(FROM_HERE, 1740, 2436000, false)); | 1035 video->Read(NewReadCB(FROM_HERE, 1740, 2436000, false)); |
| 1036 base::RunLoop().Run(); | 1036 base::RunLoop().Run(); |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 #if BUILDFLAG(USE_PROPRIETARY_CODECS) | 1039 #if defined(USE_PROPRIETARY_CODECS) |
| 1040 // Ensure ID3v1 tag reading is disabled. id3_test.mp3 has an ID3v1 tag with the | 1040 // Ensure ID3v1 tag reading is disabled. id3_test.mp3 has an ID3v1 tag with the |
| 1041 // field "title" set to "sample for id3 test". | 1041 // field "title" set to "sample for id3 test". |
| 1042 TEST_F(FFmpegDemuxerTest, NoID3TagData) { | 1042 TEST_F(FFmpegDemuxerTest, NoID3TagData) { |
| 1043 CreateDemuxer("id3_test.mp3"); | 1043 CreateDemuxer("id3_test.mp3"); |
| 1044 InitializeDemuxer(); | 1044 InitializeDemuxer(); |
| 1045 EXPECT_FALSE(av_dict_get(format_context()->metadata, "title", NULL, 0)); | 1045 EXPECT_FALSE(av_dict_get(format_context()->metadata, "title", NULL, 0)); |
| 1046 } | 1046 } |
| 1047 #endif | 1047 #endif |
| 1048 | 1048 |
| 1049 #if BUILDFLAG(USE_PROPRIETARY_CODECS) | 1049 #if defined(USE_PROPRIETARY_CODECS) |
| 1050 // Ensure MP3 files with large image/video based ID3 tags demux okay. FFmpeg | 1050 // Ensure MP3 files with large image/video based ID3 tags demux okay. FFmpeg |
| 1051 // will hand us a video stream to the data which will likely be in a format we | 1051 // will hand us a video stream to the data which will likely be in a format we |
| 1052 // don't accept as video; e.g. PNG. | 1052 // don't accept as video; e.g. PNG. |
| 1053 TEST_F(FFmpegDemuxerTest, Mp3WithVideoStreamID3TagData) { | 1053 TEST_F(FFmpegDemuxerTest, Mp3WithVideoStreamID3TagData) { |
| 1054 CreateDemuxer("id3_png_test.mp3"); | 1054 CreateDemuxer("id3_png_test.mp3"); |
| 1055 InitializeDemuxer(); | 1055 InitializeDemuxer(); |
| 1056 | 1056 |
| 1057 // Ensure the expected streams are present. | 1057 // Ensure the expected streams are present. |
| 1058 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); | 1058 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); |
| 1059 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); | 1059 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1075 // stream being demuxed. | 1075 // stream being demuxed. |
| 1076 TEST_F(FFmpegDemuxerTest, UnsupportedVideoSupportedAudioDemux) { | 1076 TEST_F(FFmpegDemuxerTest, UnsupportedVideoSupportedAudioDemux) { |
| 1077 CreateDemuxer("vorbis_audio_wmv_video.mkv"); | 1077 CreateDemuxer("vorbis_audio_wmv_video.mkv"); |
| 1078 InitializeDemuxer(); | 1078 InitializeDemuxer(); |
| 1079 | 1079 |
| 1080 // Ensure the expected streams are present. | 1080 // Ensure the expected streams are present. |
| 1081 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); | 1081 EXPECT_FALSE(demuxer_->GetStream(DemuxerStream::VIDEO)); |
| 1082 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); | 1082 EXPECT_TRUE(demuxer_->GetStream(DemuxerStream::AUDIO)); |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 #if BUILDFLAG(USE_PROPRIETARY_CODECS) | 1085 #if defined(USE_PROPRIETARY_CODECS) |
| 1086 // FFmpeg returns null data pointers when samples have zero size, leading to | 1086 // FFmpeg returns null data pointers when samples have zero size, leading to |
| 1087 // mistakenly creating end of stream buffers http://crbug.com/169133 | 1087 // mistakenly creating end of stream buffers http://crbug.com/169133 |
| 1088 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) { | 1088 TEST_F(FFmpegDemuxerTest, MP4_ZeroStszEntry) { |
| 1089 CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4"); | 1089 CreateDemuxer("bear-1280x720-zero-stsz-entry.mp4"); |
| 1090 InitializeDemuxer(); | 1090 InitializeDemuxer(); |
| 1091 ReadUntilEndOfStream(demuxer_->GetStream(DemuxerStream::AUDIO)); | 1091 ReadUntilEndOfStream(demuxer_->GetStream(DemuxerStream::AUDIO)); |
| 1092 } | 1092 } |
| 1093 | 1093 |
| 1094 class Mp3SeekFFmpegDemuxerTest | 1094 class Mp3SeekFFmpegDemuxerTest |
| 1095 : public FFmpegDemuxerTest, | 1095 : public FFmpegDemuxerTest, |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 EXPECT_EQ(audio_track2.kind(), "main"); | 1355 EXPECT_EQ(audio_track2.kind(), "main"); |
| 1356 EXPECT_EQ(audio_track2.label(), "SoundHandler"); | 1356 EXPECT_EQ(audio_track2.label(), "SoundHandler"); |
| 1357 EXPECT_EQ(audio_track2.language(), "und"); | 1357 EXPECT_EQ(audio_track2.language(), "und"); |
| 1358 } | 1358 } |
| 1359 | 1359 |
| 1360 TEST_F(FFmpegDemuxerTest, Read_Mp4_Crbug657437) { | 1360 TEST_F(FFmpegDemuxerTest, Read_Mp4_Crbug657437) { |
| 1361 CreateDemuxer("crbug657437.mp4"); | 1361 CreateDemuxer("crbug657437.mp4"); |
| 1362 InitializeDemuxer(); | 1362 InitializeDemuxer(); |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) | 1365 #endif // defined(USE_PROPRIETARY_CODECS) |
| 1366 | 1366 |
| 1367 TEST_F(FFmpegDemuxerTest, Read_Webm_Multiple_Tracks) { | 1367 TEST_F(FFmpegDemuxerTest, Read_Webm_Multiple_Tracks) { |
| 1368 CreateDemuxer("multitrack-3video-2audio.webm"); | 1368 CreateDemuxer("multitrack-3video-2audio.webm"); |
| 1369 InitializeDemuxer(); | 1369 InitializeDemuxer(); |
| 1370 | 1370 |
| 1371 EXPECT_EQ(media_tracks_->tracks().size(), 5u); | 1371 EXPECT_EQ(media_tracks_->tracks().size(), 5u); |
| 1372 | 1372 |
| 1373 const MediaTrack& video_track1 = *(media_tracks_->tracks()[0]); | 1373 const MediaTrack& video_track1 = *(media_tracks_->tracks()[0]); |
| 1374 EXPECT_EQ(video_track1.type(), MediaTrack::Video); | 1374 EXPECT_EQ(video_track1.type(), MediaTrack::Video); |
| 1375 EXPECT_EQ(video_track1.bytestream_track_id(), 1); | 1375 EXPECT_EQ(video_track1.bytestream_track_id(), 1); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); | 1510 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); |
| 1511 | 1511 |
| 1512 // Now pretend that audio stream got disabled. | 1512 // Now pretend that audio stream got disabled. |
| 1513 astream->set_enabled(false, base::TimeDelta()); | 1513 astream->set_enabled(false, base::TimeDelta()); |
| 1514 // Since there's no other enabled streams, the preferred seeking stream should | 1514 // Since there's no other enabled streams, the preferred seeking stream should |
| 1515 // still be the audio stream. | 1515 // still be the audio stream. |
| 1516 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); | 1516 EXPECT_EQ(astream, preferred_seeking_stream(base::TimeDelta())); |
| 1517 } | 1517 } |
| 1518 | 1518 |
| 1519 } // namespace media | 1519 } // namespace media |
| OLD | NEW |