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

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

Issue 2582703003: Audio output debug recording. (Closed)
Patch Set: Created 4 years 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
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 if (state_ != kClosed) 293 if (state_ != kClosed)
294 handler_->OnControllerError(); 294 handler_->OnControllerError();
295 } 295 }
296 296
297 int AudioOutputController::OnMoreData(base::TimeDelta delay, 297 int AudioOutputController::OnMoreData(base::TimeDelta delay,
298 base::TimeTicks delay_timestamp, 298 base::TimeTicks delay_timestamp,
299 int prior_frames_skipped, 299 int prior_frames_skipped,
300 AudioBus* dest) { 300 AudioBus* dest) {
301 TRACE_EVENT0("audio", "AudioOutputController::OnMoreData"); 301 TRACE_EVENT0("audio", "AudioOutputController::OnMoreData");
302 302
303 // NOTREACHED();
304
303 // Indicate that we haven't wedged (at least not indefinitely, WedgeCheck() 305 // Indicate that we haven't wedged (at least not indefinitely, WedgeCheck()
304 // may have already fired if OnMoreData() took an abnormal amount of time). 306 // may have already fired if OnMoreData() took an abnormal amount of time).
305 // Since this thread is the only writer of |on_more_io_data_called_| once the 307 // Since this thread is the only writer of |on_more_io_data_called_| once the
306 // thread starts, its safe to compare and then increment. 308 // thread starts, its safe to compare and then increment.
307 if (base::AtomicRefCountIsZero(&on_more_io_data_called_)) 309 if (base::AtomicRefCountIsZero(&on_more_io_data_called_))
308 base::AtomicRefCountInc(&on_more_io_data_called_); 310 base::AtomicRefCountInc(&on_more_io_data_called_);
309 311
310 sync_reader_->Read(dest); 312 sync_reader_->Read(dest);
311 313
312 const int frames = dest->frames(); 314 const int frames = dest->frames();
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 496
495 base::AutoLock lock(duplication_targets_lock_); 497 base::AutoLock lock(duplication_targets_lock_);
496 duplication_targets_.erase(to_stream); 498 duplication_targets_.erase(to_stream);
497 } 499 }
498 500
499 std::pair<float, bool> AudioOutputController::ReadCurrentPowerAndClip() { 501 std::pair<float, bool> AudioOutputController::ReadCurrentPowerAndClip() {
500 DCHECK(will_monitor_audio_levels()); 502 DCHECK(will_monitor_audio_levels());
501 return power_monitor_.ReadCurrentPowerAndClip(); 503 return power_monitor_.ReadCurrentPowerAndClip();
502 } 504 }
503 505
506 void AudioOutputController::EnableDebugRecording(
507 const base::FilePath& file_name) {
508 CHECK_EQ(AudioManager::Get(), audio_manager_);
509 message_loop_->PostTask(
510 FROM_HERE, base::Bind(&AudioOutputController::DoEnableDebugRecording,
511 this, file_name));
512 }
513
514 void AudioOutputController::DoEnableDebugRecording(
515 const base::FilePath& file_name) {
516 stream_->EnableDebugRecording(file_name);
517 }
518
519 void AudioOutputController::DisableDebugRecording() {}
520
521 void AudioOutputController::DoDisableDebugRecording() {}
522
504 void AudioOutputController::WedgeCheck() { 523 void AudioOutputController::WedgeCheck() {
505 DCHECK(message_loop_->BelongsToCurrentThread()); 524 DCHECK(message_loop_->BelongsToCurrentThread());
506 525
507 // If we should be playing and we haven't, that's a wedge. 526 // If we should be playing and we haven't, that's a wedge.
508 if (state_ == kPlaying) { 527 if (state_ == kPlaying) {
509 UMA_HISTOGRAM_BOOLEAN("Media.AudioOutputControllerPlaybackStartupSuccess", 528 UMA_HISTOGRAM_BOOLEAN("Media.AudioOutputControllerPlaybackStartupSuccess",
510 base::AtomicRefCountIsOne(&on_more_io_data_called_)); 529 base::AtomicRefCountIsOne(&on_more_io_data_called_));
511 } 530 }
512 } 531 }
513 532
514 } // namespace media 533 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698