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

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

Issue 2885173002: Make AudioDebugFileWriter create its own file worker thread. (Closed)
Patch Set: Remove useless include Created 3 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_manager_base.h ('k') | media/audio/audio_manager_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_manager_base.h" 5 #include "media/audio/audio_manager_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 return buffer_size; 436 return buffer_size;
437 437
438 return 0; 438 return 0;
439 } 439 }
440 440
441 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( 441 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog(
442 AudioLogFactory::AudioComponent component) { 442 AudioLogFactory::AudioComponent component) {
443 return audio_log_factory_->CreateAudioLog(component); 443 return audio_log_factory_->CreateAudioLog(component);
444 } 444 }
445 445
446 void AudioManagerBase::InitializeOutputDebugRecording( 446 void AudioManagerBase::InitializeOutputDebugRecording() {
447 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) {
448 if (!GetTaskRunner()->BelongsToCurrentThread()) { 447 if (!GetTaskRunner()->BelongsToCurrentThread()) {
449 // AudioManager is deleted on the audio thread, so it's safe to post 448 // AudioManager is deleted on the audio thread, so it's safe to post
450 // unretained. 449 // unretained.
451 GetTaskRunner()->PostTask( 450 GetTaskRunner()->PostTask(
452 FROM_HERE, 451 FROM_HERE, base::Bind(&AudioManagerBase::InitializeOutputDebugRecording,
453 base::Bind(&AudioManagerBase::InitializeOutputDebugRecording, 452 base::Unretained(this)));
454 base::Unretained(this), std::move(file_task_runner)));
455 return; 453 return;
456 } 454 }
457 455
458 DCHECK(!debug_recording_manager_); 456 DCHECK(!debug_recording_manager_);
459 debug_recording_manager_ = CreateAudioDebugRecordingManager( 457 debug_recording_manager_ = CreateAudioDebugRecordingManager(GetTaskRunner());
460 GetTaskRunner(), std::move(file_task_runner));
461 } 458 }
462 459
463 void AudioManagerBase::EnableOutputDebugRecording( 460 void AudioManagerBase::EnableOutputDebugRecording(
464 const base::FilePath& base_file_name) { 461 const base::FilePath& base_file_name) {
465 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); 462 DCHECK(GetTaskRunner()->BelongsToCurrentThread());
466 DCHECK(debug_recording_manager_) 463 DCHECK(debug_recording_manager_)
467 << "InitializeOutputDebugRecording() must be called before enabling"; 464 << "InitializeOutputDebugRecording() must be called before enabling";
468 debug_recording_manager_->EnableDebugRecording(base_file_name); 465 debug_recording_manager_->EnableDebugRecording(base_file_name);
469 } 466 }
470 467
471 void AudioManagerBase::DisableOutputDebugRecording() { 468 void AudioManagerBase::DisableOutputDebugRecording() {
472 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); 469 DCHECK(GetTaskRunner()->BelongsToCurrentThread());
473 if (debug_recording_manager_) 470 if (debug_recording_manager_)
474 debug_recording_manager_->DisableDebugRecording(); 471 debug_recording_manager_->DisableDebugRecording();
475 } 472 }
476 473
477 std::unique_ptr<AudioDebugRecordingManager> 474 std::unique_ptr<AudioDebugRecordingManager>
478 AudioManagerBase::CreateAudioDebugRecordingManager( 475 AudioManagerBase::CreateAudioDebugRecordingManager(
479 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 476 scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
480 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) { 477 return base::MakeUnique<AudioDebugRecordingManager>(std::move(task_runner));
481 return base::MakeUnique<AudioDebugRecordingManager>(
482 std::move(task_runner), std::move(file_task_runner));
483 } 478 }
484 479
485 void AudioManagerBase::SetMaxStreamCountForTesting(int max_input, 480 void AudioManagerBase::SetMaxStreamCountForTesting(int max_input,
486 int max_output) { 481 int max_output) {
487 max_num_output_streams_ = max_output; 482 max_num_output_streams_ = max_output;
488 max_num_input_streams_ = max_input; 483 max_num_input_streams_ = max_input;
489 } 484 }
490 485
491 } // namespace media 486 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_manager_base.h ('k') | media/audio/audio_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698