| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <map> | 5 #include <map> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 read_callback_called_ = true; | 259 read_callback_called_ = true; |
| 260 last_read_status_ = status; | 260 last_read_status_ = status; |
| 261 last_read_buffer_ = buffer; | 261 last_read_buffer_ = buffer; |
| 262 } | 262 } |
| 263 | 263 |
| 264 void CreateAndConfigureStream(DemuxerStream::Type type) { | 264 void CreateAndConfigureStream(DemuxerStream::Type type) { |
| 265 // TODO(wolenetz/dalecurtis): Also test with splicing disabled? | 265 // TODO(wolenetz/dalecurtis): Also test with splicing disabled? |
| 266 switch (type) { | 266 switch (type) { |
| 267 case DemuxerStream::AUDIO: { | 267 case DemuxerStream::AUDIO: { |
| 268 ASSERT_FALSE(audio_); | 268 ASSERT_FALSE(audio_); |
| 269 audio_.reset(new ChunkDemuxerStream(DemuxerStream::AUDIO, true)); | 269 audio_.reset(new ChunkDemuxerStream( |
| 270 DemuxerStream::AUDIO, DemuxerStream::LIVENESS_UNKNOWN, true)); |
| 270 AudioDecoderConfig decoder_config(kCodecVorbis, | 271 AudioDecoderConfig decoder_config(kCodecVorbis, |
| 271 kSampleFormatPlanarF32, | 272 kSampleFormatPlanarF32, |
| 272 CHANNEL_LAYOUT_STEREO, | 273 CHANNEL_LAYOUT_STEREO, |
| 273 1000, | 274 1000, |
| 274 NULL, | 275 NULL, |
| 275 0, | 276 0, |
| 276 false); | 277 false); |
| 277 frame_processor_->OnPossibleAudioConfigUpdate(decoder_config); | 278 frame_processor_->OnPossibleAudioConfigUpdate(decoder_config); |
| 278 ASSERT_TRUE( | 279 ASSERT_TRUE( |
| 279 audio_->UpdateAudioConfig(decoder_config, base::Bind(&LogFunc))); | 280 audio_->UpdateAudioConfig(decoder_config, base::Bind(&LogFunc))); |
| 280 break; | 281 break; |
| 281 } | 282 } |
| 282 case DemuxerStream::VIDEO: { | 283 case DemuxerStream::VIDEO: { |
| 283 ASSERT_FALSE(video_); | 284 ASSERT_FALSE(video_); |
| 284 video_.reset(new ChunkDemuxerStream(DemuxerStream::VIDEO, true)); | 285 video_.reset(new ChunkDemuxerStream( |
| 286 DemuxerStream::VIDEO, DemuxerStream::LIVENESS_UNKNOWN, true)); |
| 285 ASSERT_TRUE(video_->UpdateVideoConfig(TestVideoConfig::Normal(), | 287 ASSERT_TRUE(video_->UpdateVideoConfig(TestVideoConfig::Normal(), |
| 286 base::Bind(&LogFunc))); | 288 base::Bind(&LogFunc))); |
| 287 break; | 289 break; |
| 288 } | 290 } |
| 289 // TODO(wolenetz): Test text coded frame processing. | 291 // TODO(wolenetz): Test text coded frame processing. |
| 290 case DemuxerStream::TEXT: | 292 case DemuxerStream::TEXT: |
| 291 case DemuxerStream::UNKNOWN: | 293 case DemuxerStream::UNKNOWN: |
| 292 case DemuxerStream::NUM_TYPES: { | 294 case DemuxerStream::NUM_TYPES: { |
| 293 ASSERT_FALSE(true); | 295 ASSERT_FALSE(true); |
| 294 } | 296 } |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,5) }"); | 687 CheckExpectedRangesByTimestamp(audio_.get(), "{ [0,5) }"); |
| 686 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,20) }"); | 688 CheckExpectedRangesByTimestamp(video_.get(), "{ [0,20) }"); |
| 687 CheckReadsThenReadStalls(audio_.get(), "0:-5"); | 689 CheckReadsThenReadStalls(audio_.get(), "0:-5"); |
| 688 CheckReadsThenReadStalls(video_.get(), "0 10"); | 690 CheckReadsThenReadStalls(video_.get(), "0 10"); |
| 689 } | 691 } |
| 690 | 692 |
| 691 INSTANTIATE_TEST_CASE_P(SequenceMode, FrameProcessorTest, Values(true)); | 693 INSTANTIATE_TEST_CASE_P(SequenceMode, FrameProcessorTest, Values(true)); |
| 692 INSTANTIATE_TEST_CASE_P(SegmentsMode, FrameProcessorTest, Values(false)); | 694 INSTANTIATE_TEST_CASE_P(SegmentsMode, FrameProcessorTest, Values(false)); |
| 693 | 695 |
| 694 } // namespace media | 696 } // namespace media |
| OLD | NEW |