| 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/mock_frame_provider.h" | 5 #include "chromecast/media/cma/test/mock_frame_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 MockFrameProvider::~MockFrameProvider() { | 28 MockFrameProvider::~MockFrameProvider() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 void MockFrameProvider::Configure( | 31 void MockFrameProvider::Configure( |
| 32 const std::vector<bool>& delayed_task_pattern, | 32 const std::vector<bool>& delayed_task_pattern, |
| 33 std::unique_ptr<FrameGeneratorForTest> frame_generator) { | 33 std::unique_ptr<FrameGeneratorForTest> frame_generator) { |
| 34 delayed_task_pattern_ = delayed_task_pattern; | 34 delayed_task_pattern_ = delayed_task_pattern; |
| 35 pattern_idx_ = 0; | 35 pattern_idx_ = 0; |
| 36 | 36 |
| 37 frame_generator_.reset(frame_generator.release()); | 37 frame_generator_ = std::move(frame_generator); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void MockFrameProvider::SetDelayFlush(bool delay_flush) { | 40 void MockFrameProvider::SetDelayFlush(bool delay_flush) { |
| 41 delay_flush_ = delay_flush; | 41 delay_flush_ = delay_flush; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void MockFrameProvider::Read(const ReadCB& read_cb) { | 44 void MockFrameProvider::Read(const ReadCB& read_cb) { |
| 45 bool delayed = delayed_task_pattern_[pattern_idx_]; | 45 bool delayed = delayed_task_pattern_[pattern_idx_]; |
| 46 pattern_idx_ = (pattern_idx_ + 1) % delayed_task_pattern_.size(); | 46 pattern_idx_ = (pattern_idx_ + 1) % delayed_task_pattern_.size(); |
| 47 | 47 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 44100, | 91 44100, |
| 92 ::media::EmptyExtraData(), | 92 ::media::EmptyExtraData(), |
| 93 ::media::Unencrypted()); | 93 ::media::Unencrypted()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 read_cb.Run(buffer, audio_config, video_config); | 96 read_cb.Run(buffer, audio_config, video_config); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace media | 99 } // namespace media |
| 100 } // namespace chromecast | 100 } // namespace chromecast |
| OLD | NEW |