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 "chromecast/media/cma/test/media_component_device_feeder_for_test.h" | 5 #include "chromecast/media/cma/test/media_component_device_feeder_for_test.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/message_loop/message_loop_proxy.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/thread_task_runner_handle.h" |
17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
18 #include "chromecast/media/base/decrypt_context.h" | 19 #include "chromecast/media/base/decrypt_context.h" |
19 #include "chromecast/media/cma/backend/audio_pipeline_device.h" | 20 #include "chromecast/media/cma/backend/audio_pipeline_device.h" |
20 #include "chromecast/media/cma/backend/media_clock_device.h" | 21 #include "chromecast/media/cma/backend/media_clock_device.h" |
21 #include "chromecast/media/cma/backend/media_pipeline_device.h" | 22 #include "chromecast/media/cma/backend/media_pipeline_device.h" |
22 #include "chromecast/media/cma/backend/video_pipeline_device.h" | 23 #include "chromecast/media/cma/backend/video_pipeline_device.h" |
23 #include "chromecast/media/cma/base/decoder_buffer_adapter.h" | 24 #include "chromecast/media/cma/base/decoder_buffer_adapter.h" |
24 #include "chromecast/media/cma/base/decoder_buffer_base.h" | 25 #include "chromecast/media/cma/base/decoder_buffer_base.h" |
25 #include "chromecast/media/cma/test/frame_segmenter_for_test.h" | 26 #include "chromecast/media/cma/test/frame_segmenter_for_test.h" |
26 #include "media/base/audio_decoder_config.h" | 27 #include "media/base/audio_decoder_config.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 102 |
102 OnFramePushed(MediaComponentDevice::kFrameSuccess); | 103 OnFramePushed(MediaComponentDevice::kFrameSuccess); |
103 } | 104 } |
104 | 105 |
105 void MediaComponentDeviceFeederForTest::OnFramePushed( | 106 void MediaComponentDeviceFeederForTest::OnFramePushed( |
106 MediaComponentDevice::FrameStatus status) { | 107 MediaComponentDevice::FrameStatus status) { |
107 EXPECT_NE(status, MediaComponentDevice::kFrameFailed); | 108 EXPECT_NE(status, MediaComponentDevice::kFrameFailed); |
108 if (feeding_completed_) | 109 if (feeding_completed_) |
109 return; | 110 return; |
110 | 111 |
111 base::MessageLoopProxy::current()->PostTask( | 112 base::ThreadTaskRunnerHandle::Get()->PostTask( |
112 FROM_HERE, | 113 FROM_HERE, base::Bind(&MediaComponentDeviceFeederForTest::Feed, |
113 base::Bind(&MediaComponentDeviceFeederForTest::Feed, | 114 base::Unretained(this))); |
114 base::Unretained(this))); | |
115 } | 115 } |
116 | 116 |
117 void MediaComponentDeviceFeederForTest::OnEos() { | 117 void MediaComponentDeviceFeederForTest::OnEos() { |
118 bool success = media_component_device_->SetState( | 118 bool success = media_component_device_->SetState( |
119 MediaComponentDevice::kStateIdle); | 119 MediaComponentDevice::kStateIdle); |
120 ASSERT_TRUE(success); | 120 ASSERT_TRUE(success); |
121 success = media_component_device_->SetState( | 121 success = media_component_device_->SetState( |
122 MediaComponentDevice::kStateUninitialized); | 122 MediaComponentDevice::kStateUninitialized); |
123 ASSERT_TRUE(success); | 123 ASSERT_TRUE(success); |
124 | 124 |
125 if (!eos_cb_.is_null()) { | 125 if (!eos_cb_.is_null()) { |
126 eos_cb_.Run(); | 126 eos_cb_.Run(); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 } // namespace media | 130 } // namespace media |
131 } // namespace chromecast | 131 } // namespace chromecast |
OLD | NEW |