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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // First stream should be video and support the FFmpegDemuxerStream interface. |
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 ASSERT_FALSE(stream->audio_decoder_config()); |
179 | 180 |
180 // Other stream should be audio and support the FFmpegDemuxerStream interface. | 181 // Other stream should be audio and support the FFmpegDemuxerStream interface. |
181 stream = demuxer_->GetStream(DemuxerStream::AUDIO); | 182 stream = demuxer_->GetStream(DemuxerStream::AUDIO); |
182 ASSERT_TRUE(stream); | 183 ASSERT_TRUE(stream); |
183 EXPECT_EQ(DemuxerStream::AUDIO, stream->type()); | 184 EXPECT_EQ(DemuxerStream::AUDIO, stream->type()); |
184 ASSERT_TRUE(stream->GetAVStream()); | 185 ASSERT_TRUE(stream->GetAVStream()); |
| 186 ASSERT_TRUE(stream->audio_decoder_config()); |
| 187 |
| 188 // FFmpegDemuxer's audio streams support AudioDecoderConfig structs. |
| 189 AudioDecoderConfig* config = stream->audio_decoder_config(); |
| 190 EXPECT_EQ(kCodecVorbis, config->codec()); |
| 191 EXPECT_EQ(16, config->bits_per_channel()); |
| 192 EXPECT_EQ(CHANNEL_LAYOUT_STEREO, config->channel_layout()); |
| 193 EXPECT_EQ(44100, config->sample_rate()); |
| 194 EXPECT_TRUE(config->extra_data()); |
| 195 EXPECT_GT(config->extra_data_size(), 0u); |
185 } | 196 } |
186 | 197 |
187 TEST_F(FFmpegDemuxerTest, Read_Audio) { | 198 TEST_F(FFmpegDemuxerTest, Read_Audio) { |
188 // We test that on a successful audio packet read. | 199 // We test that on a successful audio packet read. |
189 InitializeDemuxer(CreateDataSource("bear-320x240.webm")); | 200 InitializeDemuxer(CreateDataSource("bear-320x240.webm")); |
190 | 201 |
191 // Attempt a read from the audio stream and run the message loop until done. | 202 // Attempt a read from the audio stream and run the message loop until done. |
192 scoped_refptr<DemuxerStream> audio = | 203 scoped_refptr<DemuxerStream> audio = |
193 demuxer_->GetStream(DemuxerStream::AUDIO); | 204 demuxer_->GetStream(DemuxerStream::AUDIO); |
194 scoped_refptr<DemuxerStreamReader> reader(new DemuxerStreamReader()); | 205 scoped_refptr<DemuxerStreamReader> reader(new DemuxerStreamReader()); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 | 577 |
567 TEST_F(FFmpegDemuxerTest, ProtocolIsStreaming) { | 578 TEST_F(FFmpegDemuxerTest, ProtocolIsStreaming) { |
568 scoped_refptr<DataSource> data_source = CreateDataSource("bear-320x240.webm"); | 579 scoped_refptr<DataSource> data_source = CreateDataSource("bear-320x240.webm"); |
569 InitializeDemuxer(data_source); | 580 InitializeDemuxer(data_source); |
570 | 581 |
571 EXPECT_FALSE(data_source->IsStreaming()); | 582 EXPECT_FALSE(data_source->IsStreaming()); |
572 EXPECT_FALSE(demuxer_->IsStreaming()); | 583 EXPECT_FALSE(demuxer_->IsStreaming()); |
573 } | 584 } |
574 | 585 |
575 } // namespace media | 586 } // namespace media |
OLD | NEW |