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

Side by Side Diff: chromecast/media/audio/cast_audio_manager.cc

Issue 1806313003: Pass task runners to AudioManager constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments from patch 48 Created 4 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chromecast/media/audio/cast_audio_manager.h" 5 #include "chromecast/media/audio/cast_audio_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "chromecast/media/audio/cast_audio_output_stream.h" 10 #include "chromecast/media/audio/cast_audio_output_stream.h"
11 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" 11 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h"
12 12
13 namespace { 13 namespace {
14 // TODO(alokp): Query the preferred value from media backend. 14 // TODO(alokp): Query the preferred value from media backend.
15 const int kDefaultSampleRate = 48000; 15 const int kDefaultSampleRate = 48000;
16 16
17 // Define bounds for the output buffer size (in frames). 17 // Define bounds for the output buffer size (in frames).
18 // Note: These values are copied from AudioManagerPulse implementation. 18 // Note: These values are copied from AudioManagerPulse implementation.
19 // TODO(alokp): Query the preferred value from media backend. 19 // TODO(alokp): Query the preferred value from media backend.
20 static const int kMinimumOutputBufferSize = 512; 20 static const int kMinimumOutputBufferSize = 512;
21 static const int kMaximumOutputBufferSize = 8192; 21 static const int kMaximumOutputBufferSize = 8192;
22 static const int kDefaultOutputBufferSize = 2048; 22 static const int kDefaultOutputBufferSize = 2048;
23 } // namespace 23 } // namespace
24 24
25 namespace chromecast { 25 namespace chromecast {
26 namespace media { 26 namespace media {
27 27
28 CastAudioManager::CastAudioManager(::media::AudioLogFactory* audio_log_factory, 28 CastAudioManager::CastAudioManager(
29 MediaPipelineBackendManager* backend_manager) 29 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
30 : AudioManagerBase(audio_log_factory), backend_manager_(backend_manager) { 30 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
31 } 31 ::media::AudioLogFactory* audio_log_factory,
32 MediaPipelineBackendManager* backend_manager)
33 : AudioManagerBase(std::move(task_runner),
34 std::move(worker_task_runner),
35 audio_log_factory),
36 backend_manager_(backend_manager) {}
32 37
33 CastAudioManager::~CastAudioManager() { 38 CastAudioManager::~CastAudioManager() {
34 Shutdown(); 39 Shutdown();
35 } 40 }
36 41
37 bool CastAudioManager::HasAudioOutputDevices() { 42 bool CastAudioManager::HasAudioOutputDevices() {
38 return true; 43 return true;
39 } 44 }
40 45
41 bool CastAudioManager::HasAudioInputDevices() { 46 bool CastAudioManager::HasAudioInputDevices() {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 118 }
114 119
115 ::media::AudioParameters output_params( 120 ::media::AudioParameters output_params(
116 ::media::AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, 121 ::media::AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
117 sample_rate, bits_per_sample, buffer_size); 122 sample_rate, bits_per_sample, buffer_size);
118 return output_params; 123 return output_params;
119 } 124 }
120 125
121 } // namespace media 126 } // namespace media
122 } // namespace chromecast 127 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/media/audio/cast_audio_manager.h ('k') | chromecast/media/audio/cast_audio_manager_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698