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 "media/renderers/renderer_impl.h" | 5 #include "media/renderers/renderer_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 | 231 |
232 bool RendererImpl::GetWallClockTimes( | 232 bool RendererImpl::GetWallClockTimes( |
233 const std::vector<base::TimeDelta>& media_timestamps, | 233 const std::vector<base::TimeDelta>& media_timestamps, |
234 std::vector<base::TimeTicks>* wall_clock_times) { | 234 std::vector<base::TimeTicks>* wall_clock_times) { |
235 // No BelongsToCurrentThread() checking because this can be called from other | 235 // No BelongsToCurrentThread() checking because this can be called from other |
236 // threads. | 236 // threads. |
237 // | 237 // |
238 // TODO(scherkus): Currently called from VideoRendererImpl's internal thread, | 238 // TODO(scherkus): Currently called from VideoRendererImpl's internal thread, |
239 // which should go away at some point http://crbug.com/110814 | 239 // which should go away at some point http://crbug.com/110814 |
240 if (clockless_video_playback_enabled_for_testing_) { | 240 if (clockless_video_playback_enabled_for_testing_) { |
241 *wall_clock_times = std::vector<base::TimeTicks>(media_timestamps.size(), | 241 if (media_timestamps.empty()) { |
242 base::TimeTicks::Now()); | 242 *wall_clock_times = std::vector<base::TimeTicks>(1, |
243 base::TimeTicks::Now()); | |
244 } else { | |
245 *wall_clock_times = std::vector<base::TimeTicks>(); | |
246 for (auto const &media_time : media_timestamps) { | |
DaleCurtis
2015/07/13 02:00:26
Style is wrong, should be const auto&. No need for
| |
247 wall_clock_times->push_back(base::TimeTicks() + media_time); | |
248 } | |
249 } | |
243 return true; | 250 return true; |
244 } | 251 } |
245 | 252 |
246 return time_source_->GetWallClockTimes(media_timestamps, wall_clock_times); | 253 return time_source_->GetWallClockTimes(media_timestamps, wall_clock_times); |
247 } | 254 } |
248 | 255 |
249 void RendererImpl::SetDecryptorReadyCallback( | 256 void RendererImpl::SetDecryptorReadyCallback( |
250 const DecryptorReadyCB& decryptor_ready_cb) { | 257 const DecryptorReadyCB& decryptor_ready_cb) { |
251 // Cancels the previous decryptor request. | 258 // Cancels the previous decryptor request. |
252 if (decryptor_ready_cb.is_null()) { | 259 if (decryptor_ready_cb.is_null()) { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
637 } | 644 } |
638 | 645 |
639 // After OnError() returns, the pipeline may destroy |this|. | 646 // After OnError() returns, the pipeline may destroy |this|. |
640 base::ResetAndReturn(&error_cb_).Run(error); | 647 base::ResetAndReturn(&error_cb_).Run(error); |
641 | 648 |
642 if (!flush_cb_.is_null()) | 649 if (!flush_cb_.is_null()) |
643 base::ResetAndReturn(&flush_cb_).Run(); | 650 base::ResetAndReturn(&flush_cb_).Run(); |
644 } | 651 } |
645 | 652 |
646 } // namespace media | 653 } // namespace media |
OLD | NEW |