| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <deque> | 5 #include <deque> |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "media/base/filters.h" | 10 #include "media/base/filters.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 //TEST_F(FFmpegDemuxerTest, Initialize_DataStreamOnly) { | 163 //TEST_F(FFmpegDemuxerTest, Initialize_DataStreamOnly) { |
| 164 // demuxer_->Initialize( | 164 // demuxer_->Initialize( |
| 165 // CreateDataSource("subtitles_only.mp4"),, | 165 // CreateDataSource("subtitles_only.mp4"),, |
| 166 // NewExpectedStatusCB(DEMUXER_ERROR_NO_SUPPORTED_STREAMS)); | 166 // NewExpectedStatusCB(DEMUXER_ERROR_NO_SUPPORTED_STREAMS)); |
| 167 // message_loop_.RunAllPending(); | 167 // message_loop_.RunAllPending(); |
| 168 //} | 168 //} |
| 169 | 169 |
| 170 TEST_F(FFmpegDemuxerTest, Initialize_Successful) { | 170 TEST_F(FFmpegDemuxerTest, Initialize_Successful) { |
| 171 InitializeDemuxer(CreateDataSource("bear-320x240.webm")); | 171 InitializeDemuxer(CreateDataSource("bear-320x240.webm")); |
| 172 | 172 |
| 173 // First stream should be video and support the FFmpegDemuxerStream interface. | 173 // Video stream should be present. |
| 174 scoped_refptr<DemuxerStream> stream = | 174 scoped_refptr<DemuxerStream> stream = |
| 175 demuxer_->GetStream(DemuxerStream::VIDEO); | 175 demuxer_->GetStream(DemuxerStream::VIDEO); |
| 176 ASSERT_TRUE(stream); | 176 ASSERT_TRUE(stream); |
| 177 EXPECT_EQ(DemuxerStream::VIDEO, stream->type()); | 177 EXPECT_EQ(DemuxerStream::VIDEO, stream->type()); |
| 178 ASSERT_TRUE(stream->GetAVStream()); | 178 ASSERT_TRUE(stream->GetAVStream()); |
| 179 | 179 |
| 180 // Other stream should be audio and support the FFmpegDemuxerStream interface. | 180 // Audio stream should be present. |
| 181 stream = demuxer_->GetStream(DemuxerStream::AUDIO); | 181 stream = demuxer_->GetStream(DemuxerStream::AUDIO); |
| 182 ASSERT_TRUE(stream); | 182 ASSERT_TRUE(stream); |
| 183 EXPECT_EQ(DemuxerStream::AUDIO, stream->type()); | 183 EXPECT_EQ(DemuxerStream::AUDIO, stream->type()); |
| 184 ASSERT_TRUE(stream->GetAVStream()); | 184 ASSERT_TRUE(stream->GetAVStream()); |
| 185 |
| 186 // FFmpegDemuxer's audio streams support AudioDecoderConfig structs. |
| 187 const AudioDecoderConfig& config = stream->audio_decoder_config(); |
| 188 EXPECT_EQ(kCodecVorbis, config.codec()); |
| 189 EXPECT_EQ(16, config.bits_per_channel()); |
| 190 EXPECT_EQ(CHANNEL_LAYOUT_STEREO, config.channel_layout()); |
| 191 EXPECT_EQ(44100, config.samples_per_second()); |
| 192 EXPECT_TRUE(config.extra_data()); |
| 193 EXPECT_GT(config.extra_data_size(), 0u); |
| 185 } | 194 } |
| 186 | 195 |
| 187 TEST_F(FFmpegDemuxerTest, Read_Audio) { | 196 TEST_F(FFmpegDemuxerTest, Read_Audio) { |
| 188 // We test that on a successful audio packet read. | 197 // We test that on a successful audio packet read. |
| 189 InitializeDemuxer(CreateDataSource("bear-320x240.webm")); | 198 InitializeDemuxer(CreateDataSource("bear-320x240.webm")); |
| 190 | 199 |
| 191 // Attempt a read from the audio stream and run the message loop until done. | 200 // Attempt a read from the audio stream and run the message loop until done. |
| 192 scoped_refptr<DemuxerStream> audio = | 201 scoped_refptr<DemuxerStream> audio = |
| 193 demuxer_->GetStream(DemuxerStream::AUDIO); | 202 demuxer_->GetStream(DemuxerStream::AUDIO); |
| 194 scoped_refptr<DemuxerStreamReader> reader(new DemuxerStreamReader()); | 203 scoped_refptr<DemuxerStreamReader> reader(new DemuxerStreamReader()); |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 | 575 |
| 567 TEST_F(FFmpegDemuxerTest, ProtocolIsStreaming) { | 576 TEST_F(FFmpegDemuxerTest, ProtocolIsStreaming) { |
| 568 scoped_refptr<DataSource> data_source = CreateDataSource("bear-320x240.webm"); | 577 scoped_refptr<DataSource> data_source = CreateDataSource("bear-320x240.webm"); |
| 569 InitializeDemuxer(data_source); | 578 InitializeDemuxer(data_source); |
| 570 | 579 |
| 571 EXPECT_FALSE(data_source->IsStreaming()); | 580 EXPECT_FALSE(data_source->IsStreaming()); |
| 572 EXPECT_FALSE(demuxer_->IsStreaming()); | 581 EXPECT_FALSE(demuxer_->IsStreaming()); |
| 573 } | 582 } |
| 574 | 583 |
| 575 } // namespace media | 584 } // namespace media |
| OLD | NEW |