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

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

Issue 1858803002: [chromecast] Pass media task runner to MediaPipelineBackendManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Minor changes according to comments. 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/base/media_message_loop.h"
12 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h" 11 #include "chromecast/media/cma/backend/media_pipeline_backend_manager.h"
13 #include "chromecast/public/cast_media_shlib.h"
14 #include "chromecast/public/media/media_pipeline_backend.h"
15 12
16 namespace { 13 namespace {
17 // TODO(alokp): Query the preferred value from media backend. 14 // TODO(alokp): Query the preferred value from media backend.
18 const int kDefaultSampleRate = 48000; 15 const int kDefaultSampleRate = 48000;
19 16
20 // Define bounds for the output buffer size (in frames). 17 // Define bounds for the output buffer size (in frames).
21 // Note: These values are copied from AudioManagerPulse implementation. 18 // Note: These values are copied from AudioManagerPulse implementation.
22 // TODO(alokp): Query the preferred value from media backend. 19 // TODO(alokp): Query the preferred value from media backend.
23 static const int kMinimumOutputBufferSize = 512; 20 static const int kMinimumOutputBufferSize = 512;
24 static const int kMaximumOutputBufferSize = 8192; 21 static const int kMaximumOutputBufferSize = 8192;
25 static const int kDefaultOutputBufferSize = 2048; 22 static const int kDefaultOutputBufferSize = 2048;
26 } // namespace 23 } // namespace
27 24
28 namespace chromecast { 25 namespace chromecast {
29 namespace media { 26 namespace media {
30 27
31 CastAudioManager::CastAudioManager(::media::AudioLogFactory* audio_log_factory) 28 CastAudioManager::CastAudioManager(::media::AudioLogFactory* audio_log_factory,
32 : AudioManagerBase(audio_log_factory) {} 29 MediaPipelineBackendManager* backend_manager)
30 : AudioManagerBase(audio_log_factory), backend_manager_(backend_manager) {
31 }
33 32
34 CastAudioManager::~CastAudioManager() { 33 CastAudioManager::~CastAudioManager() {
35 Shutdown(); 34 Shutdown();
36 } 35 }
37 36
38 bool CastAudioManager::HasAudioOutputDevices() { 37 bool CastAudioManager::HasAudioOutputDevices() {
39 return true; 38 return true;
40 } 39 }
41 40
42 bool CastAudioManager::HasAudioInputDevices() { 41 bool CastAudioManager::HasAudioInputDevices() {
(...skipping 14 matching lines...) Expand all
57 const std::string& device_id) { 56 const std::string& device_id) {
58 LOG(WARNING) << "No support for input audio devices"; 57 LOG(WARNING) << "No support for input audio devices";
59 // Need to send a valid AudioParameters object even when it will unused. 58 // Need to send a valid AudioParameters object even when it will unused.
60 return ::media::AudioParameters( 59 return ::media::AudioParameters(
61 ::media::AudioParameters::AUDIO_PCM_LOW_LATENCY, 60 ::media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
62 ::media::CHANNEL_LAYOUT_STEREO, 48000, 16, 1024); 61 ::media::CHANNEL_LAYOUT_STEREO, 48000, 16, 1024);
63 } 62 }
64 63
65 scoped_ptr<MediaPipelineBackend> CastAudioManager::CreateMediaPipelineBackend( 64 scoped_ptr<MediaPipelineBackend> CastAudioManager::CreateMediaPipelineBackend(
66 const MediaPipelineDeviceParams& params) { 65 const MediaPipelineDeviceParams& params) {
67 DCHECK(media::MediaMessageLoop::GetTaskRunner()->BelongsToCurrentThread()); 66 return backend_manager_->CreateMediaPipelineBackend(params);
68
69 return scoped_ptr<MediaPipelineBackend>(
70 MediaPipelineBackendManager::CreateMediaPipelineBackend(params));
71 } 67 }
72 68
73 ::media::AudioOutputStream* CastAudioManager::MakeLinearOutputStream( 69 ::media::AudioOutputStream* CastAudioManager::MakeLinearOutputStream(
74 const ::media::AudioParameters& params) { 70 const ::media::AudioParameters& params) {
75 DCHECK_EQ(::media::AudioParameters::AUDIO_PCM_LINEAR, params.format()); 71 DCHECK_EQ(::media::AudioParameters::AUDIO_PCM_LINEAR, params.format());
76 return new CastAudioOutputStream(params, this); 72 return new CastAudioOutputStream(params, this);
77 } 73 }
78 74
79 ::media::AudioOutputStream* CastAudioManager::MakeLowLatencyOutputStream( 75 ::media::AudioOutputStream* CastAudioManager::MakeLowLatencyOutputStream(
80 const ::media::AudioParameters& params, 76 const ::media::AudioParameters& params,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 112 }
117 113
118 ::media::AudioParameters output_params( 114 ::media::AudioParameters output_params(
119 ::media::AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, 115 ::media::AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
120 sample_rate, bits_per_sample, buffer_size); 116 sample_rate, bits_per_sample, buffer_size);
121 return output_params; 117 return output_params;
122 } 118 }
123 119
124 } // namespace media 120 } // namespace media
125 } // namespace chromecast 121 } // 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