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