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

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

Issue 290003002: Remove OnMoreIOData() (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed the media unittests on mac. Created 6 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 | « 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 289
290 void AudioOutputController::DoReportError() { 290 void AudioOutputController::DoReportError() {
291 DCHECK(message_loop_->BelongsToCurrentThread()); 291 DCHECK(message_loop_->BelongsToCurrentThread());
292 if (state_ != kClosed) 292 if (state_ != kClosed)
293 handler_->OnError(); 293 handler_->OnError();
294 } 294 }
295 295
296 int AudioOutputController::OnMoreData(AudioBus* dest, 296 int AudioOutputController::OnMoreData(AudioBus* dest,
297 AudioBuffersState buffers_state) { 297 AudioBuffersState buffers_state) {
298 return OnMoreIOData(NULL, dest, buffers_state); 298 TRACE_EVENT0("audio", "AudioOutputController::OnMoreData");
299 }
300
301 int AudioOutputController::OnMoreIOData(AudioBus* source,
302 AudioBus* dest,
303 AudioBuffersState buffers_state) {
304 TRACE_EVENT0("audio", "AudioOutputController::OnMoreIOData");
305 299
306 // Indicate that we haven't wedged (at least not indefinitely, WedgeCheck() 300 // Indicate that we haven't wedged (at least not indefinitely, WedgeCheck()
307 // may have already fired if OnMoreIOData() took an abnormal amount of time). 301 // may have already fired if OnMoreIOData() took an abnormal amount of time).
308 // Since this thread is the only writer of |on_more_io_data_called_| once the 302 // Since this thread is the only writer of |on_more_io_data_called_| once the
309 // thread starts, its safe to compare and then increment. 303 // thread starts, its safe to compare and then increment.
310 if (base::AtomicRefCountIsZero(&on_more_io_data_called_)) 304 if (base::AtomicRefCountIsZero(&on_more_io_data_called_))
311 base::AtomicRefCountInc(&on_more_io_data_called_); 305 base::AtomicRefCountInc(&on_more_io_data_called_);
312 306
313 sync_reader_->Read(source, dest); 307 sync_reader_->Read(dest);
314 308
315 const int frames = dest->frames(); 309 const int frames = dest->frames();
316 sync_reader_->UpdatePendingBytes( 310 sync_reader_->UpdatePendingBytes(
317 buffers_state.total_bytes() + frames * params_.GetBytesPerFrame()); 311 buffers_state.total_bytes() + frames * params_.GetBytesPerFrame());
318 312
319 #if defined(AUDIO_POWER_MONITORING) 313 #if defined(AUDIO_POWER_MONITORING)
320 power_monitor_.Scan(*dest, frames); 314 power_monitor_.Scan(*dest, frames);
321 #endif 315 #endif
322 316
323 return frames; 317 return frames;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 DCHECK(message_loop_->BelongsToCurrentThread()); 428 DCHECK(message_loop_->BelongsToCurrentThread());
435 429
436 // If we should be playing and we haven't, that's a wedge. 430 // If we should be playing and we haven't, that's a wedge.
437 if (state_ == kPlaying) { 431 if (state_ == kPlaying) {
438 UMA_HISTOGRAM_BOOLEAN("Media.AudioOutputControllerPlaybackStartupSuccess", 432 UMA_HISTOGRAM_BOOLEAN("Media.AudioOutputControllerPlaybackStartupSuccess",
439 base::AtomicRefCountIsOne(&on_more_io_data_called_)); 433 base::AtomicRefCountIsOne(&on_more_io_data_called_));
440 } 434 }
441 } 435 }
442 436
443 } // namespace media 437 } // 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