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 <list> | 5 #include <list> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "chromecast/media/cma/base/balanced_media_task_runner_factory.h" | 15 #include "chromecast/media/cma/base/balanced_media_task_runner_factory.h" |
16 #include "chromecast/media/cma/base/decoder_buffer_base.h" | 16 #include "chromecast/media/cma/base/decoder_buffer_base.h" |
17 #include "chromecast/media/cma/filters/demuxer_stream_adapter.h" | 17 #include "chromecast/media/cma/filters/demuxer_stream_adapter.h" |
18 #include "chromecast/media/cma/test/demuxer_stream_for_test.h" | 18 #include "chromecast/media/cma/test/demuxer_stream_for_test.h" |
| 19 #include "chromecast/public/media/cast_decoder_buffer.h" |
19 #include "media/base/audio_decoder_config.h" | 20 #include "media/base/audio_decoder_config.h" |
20 #include "media/base/decoder_buffer.h" | 21 #include "media/base/decoder_buffer.h" |
21 #include "media/base/demuxer_stream.h" | 22 #include "media/base/demuxer_stream.h" |
22 #include "media/base/video_decoder_config.h" | 23 #include "media/base/video_decoder_config.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
24 | 25 |
25 namespace chromecast { | 26 namespace chromecast { |
26 namespace media { | 27 namespace media { |
27 | 28 |
28 class DemuxerStreamAdapterTest : public testing::Test { | 29 class DemuxerStreamAdapterTest : public testing::Test { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const ::media::AudioDecoderConfig& audio_config, | 106 const ::media::AudioDecoderConfig& audio_config, |
106 const ::media::VideoDecoderConfig& video_config) { | 107 const ::media::VideoDecoderConfig& video_config) { |
107 if (video_config.IsValidConfig()) { | 108 if (video_config.IsValidConfig()) { |
108 ASSERT_GT(config_idx_.size(), 0u); | 109 ASSERT_GT(config_idx_.size(), 0u); |
109 ASSERT_EQ(frame_received_count_, config_idx_.front()); | 110 ASSERT_EQ(frame_received_count_, config_idx_.front()); |
110 config_idx_.pop_front(); | 111 config_idx_.pop_front(); |
111 } | 112 } |
112 | 113 |
113 ASSERT_TRUE(buffer.get() != NULL); | 114 ASSERT_TRUE(buffer.get() != NULL); |
114 ASSERT_EQ(buffer->timestamp(), | 115 ASSERT_EQ(buffer->timestamp(), |
115 frame_received_count_ * base::TimeDelta::FromMilliseconds(40)); | 116 base::TimeDelta::FromMilliseconds(40 * frame_received_count_)); |
116 frame_received_count_++; | 117 frame_received_count_++; |
117 | 118 |
118 if (frame_received_count_ >= total_frames_) { | 119 if (frame_received_count_ >= total_frames_) { |
119 coded_frame_provider_->Flush( | 120 coded_frame_provider_->Flush( |
120 base::Bind(&DemuxerStreamAdapterTest::OnFlushCompleted, | 121 base::Bind(&DemuxerStreamAdapterTest::OnFlushCompleted, |
121 base::Unretained(this))); | 122 base::Unretained(this))); |
122 return; | 123 return; |
123 } | 124 } |
124 | 125 |
125 coded_frame_provider_->Read( | 126 coded_frame_provider_->Read( |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 scoped_ptr<base::MessageLoop> message_loop(new base::MessageLoop()); | 207 scoped_ptr<base::MessageLoop> message_loop(new base::MessageLoop()); |
207 Initialize(demuxer_stream_.get()); | 208 Initialize(demuxer_stream_.get()); |
208 message_loop->PostTask( | 209 message_loop->PostTask( |
209 FROM_HERE, | 210 FROM_HERE, |
210 base::Bind(&DemuxerStreamAdapterTest::Start, base::Unretained(this))); | 211 base::Bind(&DemuxerStreamAdapterTest::Start, base::Unretained(this))); |
211 message_loop->Run(); | 212 message_loop->Run(); |
212 } | 213 } |
213 | 214 |
214 } // namespace media | 215 } // namespace media |
215 } // namespace chromecast | 216 } // namespace chromecast |
OLD | NEW |