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

Side by Side Diff: media/audio/audio_output_controller.cc

Issue 481193003: Remove AudioBuffersState usage in Chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove AudioBufferState since ledger code is no longer built in Chrome. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/audio_output_controller.h ('k') | media/audio/audio_output_controller_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/audio/audio_output_controller.h" 5 #include "media/audio/audio_output_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 OnDeviceChange(); 273 OnDeviceChange();
274 } 274 }
275 275
276 void AudioOutputController::DoReportError() { 276 void AudioOutputController::DoReportError() {
277 DCHECK(message_loop_->BelongsToCurrentThread()); 277 DCHECK(message_loop_->BelongsToCurrentThread());
278 if (state_ != kClosed) 278 if (state_ != kClosed)
279 handler_->OnError(); 279 handler_->OnError();
280 } 280 }
281 281
282 int AudioOutputController::OnMoreData(AudioBus* dest, 282 int AudioOutputController::OnMoreData(AudioBus* dest,
283 AudioBuffersState buffers_state) { 283 int total_bytes_delay) {
palmer 2014/09/18 18:39:40 void AudioSyncReader::UpdatePendingBytes(uint32 by
acolwell GONE FROM CHROMIUM 2014/09/19 17:16:46 Done.
284 TRACE_EVENT0("audio", "AudioOutputController::OnMoreData"); 284 TRACE_EVENT0("audio", "AudioOutputController::OnMoreData");
285 285
286 // Indicate that we haven't wedged (at least not indefinitely, WedgeCheck() 286 // Indicate that we haven't wedged (at least not indefinitely, WedgeCheck()
287 // may have already fired if OnMoreIOData() took an abnormal amount of time). 287 // may have already fired if OnMoreIOData() took an abnormal amount of time).
288 // Since this thread is the only writer of |on_more_io_data_called_| once the 288 // Since this thread is the only writer of |on_more_io_data_called_| once the
289 // thread starts, its safe to compare and then increment. 289 // thread starts, its safe to compare and then increment.
290 if (base::AtomicRefCountIsZero(&on_more_io_data_called_)) 290 if (base::AtomicRefCountIsZero(&on_more_io_data_called_))
291 base::AtomicRefCountInc(&on_more_io_data_called_); 291 base::AtomicRefCountInc(&on_more_io_data_called_);
292 292
293 sync_reader_->Read(dest); 293 sync_reader_->Read(dest);
294 294
295 const int frames = dest->frames(); 295 const int frames = dest->frames();
296 sync_reader_->UpdatePendingBytes( 296 sync_reader_->UpdatePendingBytes(
297 buffers_state.total_bytes() + frames * params_.GetBytesPerFrame()); 297 total_bytes_delay + frames * params_.GetBytesPerFrame());
palmer 2014/09/18 18:39:40 I see this: // media::AudioOutputController::Sync
acolwell GONE FROM CHROMIUM 2014/09/19 17:16:46 The receiver of this value is in AudioDeviceThread
298 298
299 if (will_monitor_audio_levels()) 299 if (will_monitor_audio_levels())
300 power_monitor_.Scan(*dest, frames); 300 power_monitor_.Scan(*dest, frames);
301 301
302 return frames; 302 return frames;
303 } 303 }
304 304
305 void AudioOutputController::OnError(AudioOutputStream* stream) { 305 void AudioOutputController::OnError(AudioOutputStream* stream) {
306 // Handle error on the audio controller thread. 306 // Handle error on the audio controller thread.
307 message_loop_->PostTask(FROM_HERE, base::Bind( 307 message_loop_->PostTask(FROM_HERE, base::Bind(
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 DCHECK(message_loop_->BelongsToCurrentThread()); 409 DCHECK(message_loop_->BelongsToCurrentThread());
410 410
411 // If we should be playing and we haven't, that's a wedge. 411 // If we should be playing and we haven't, that's a wedge.
412 if (state_ == kPlaying) { 412 if (state_ == kPlaying) {
413 UMA_HISTOGRAM_BOOLEAN("Media.AudioOutputControllerPlaybackStartupSuccess", 413 UMA_HISTOGRAM_BOOLEAN("Media.AudioOutputControllerPlaybackStartupSuccess",
414 base::AtomicRefCountIsOne(&on_more_io_data_called_)); 414 base::AtomicRefCountIsOne(&on_more_io_data_called_));
415 } 415 }
416 } 416 }
417 417
418 } // namespace media 418 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_output_controller.h ('k') | media/audio/audio_output_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698