Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: media/renderers/audio_renderer_impl.cc

Issue 1137323005: Don't return wall clock times when time isn't ticking. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Include sink_playing_. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/renderers/audio_renderer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/audio_renderer_impl.h" 5 #include "media/renderers/audio_renderer_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 164
165 DVLOG(2) << __FUNCTION__ << ": " << current_media_time; 165 DVLOG(2) << __FUNCTION__ << ": " << current_media_time;
166 return current_media_time; 166 return current_media_time;
167 } 167 }
168 168
169 bool AudioRendererImpl::GetWallClockTimes( 169 bool AudioRendererImpl::GetWallClockTimes(
170 const std::vector<base::TimeDelta>& media_timestamps, 170 const std::vector<base::TimeDelta>& media_timestamps,
171 std::vector<base::TimeTicks>* wall_clock_times) { 171 std::vector<base::TimeTicks>* wall_clock_times) {
172 base::AutoLock auto_lock(lock_); 172 base::AutoLock auto_lock(lock_);
173 if (last_render_ticks_.is_null() || !playback_rate_) 173 if (last_render_ticks_.is_null() || !playback_rate_ ||
174 buffering_state_ != BUFFERING_HAVE_ENOUGH || !sink_playing_) {
174 return false; 175 return false;
176 }
175 177
176 DCHECK(wall_clock_times->empty()); 178 DCHECK(wall_clock_times->empty());
177 wall_clock_times->reserve(media_timestamps.size()); 179 wall_clock_times->reserve(media_timestamps.size());
178 for (const auto& media_timestamp : media_timestamps) { 180 for (const auto& media_timestamp : media_timestamps) {
179 base::TimeDelta base_time; 181 base::TimeDelta base_time;
180 if (media_timestamp < audio_clock_->front_timestamp()) { 182 if (media_timestamp < audio_clock_->front_timestamp()) {
181 // See notes about |media_time| values less than |base_time| in TimeSource 183 // See notes about |media_time| values less than |base_time| in TimeSource
182 // header. 184 // header.
183 base_time = audio_clock_->front_timestamp(); 185 base_time = audio_clock_->front_timestamp();
184 } else if (media_timestamp > audio_clock_->back_timestamp()) { 186 } else if (media_timestamp > audio_clock_->back_timestamp()) {
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 << buffering_state; 764 << buffering_state;
763 DCHECK_NE(buffering_state_, buffering_state); 765 DCHECK_NE(buffering_state_, buffering_state);
764 lock_.AssertAcquired(); 766 lock_.AssertAcquired();
765 buffering_state_ = buffering_state; 767 buffering_state_ = buffering_state;
766 768
767 task_runner_->PostTask(FROM_HERE, 769 task_runner_->PostTask(FROM_HERE,
768 base::Bind(buffering_state_cb_, buffering_state_)); 770 base::Bind(buffering_state_cb_, buffering_state_));
769 } 771 }
770 772
771 } // namespace media 773 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/renderers/audio_renderer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698