| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/webrtc_local_audio_source_provider.h" | 5 #include "content/renderer/media/webrtc_local_audio_source_provider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/renderer/render_thread_impl.h" | 8 #include "content/renderer/render_thread_impl.h" |
| 9 #include "media/audio/audio_parameters.h" | 9 #include "media/audio/audio_parameters.h" |
| 10 #include "media/base/audio_fifo.h" | 10 #include "media/base/audio_fifo.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 track_stopped_(false) { | 29 track_stopped_(false) { |
| 30 // Get the native audio output hardware sample-rate for the sink. | 30 // Get the native audio output hardware sample-rate for the sink. |
| 31 // We need to check if RenderThreadImpl is valid here since the unittests | 31 // We need to check if RenderThreadImpl is valid here since the unittests |
| 32 // do not have one and they will inject their own |sink_params_| for testing. | 32 // do not have one and they will inject their own |sink_params_| for testing. |
| 33 if (RenderThreadImpl::current()) { | 33 if (RenderThreadImpl::current()) { |
| 34 media::AudioHardwareConfig* hardware_config = | 34 media::AudioHardwareConfig* hardware_config = |
| 35 RenderThreadImpl::current()->GetAudioHardwareConfig(); | 35 RenderThreadImpl::current()->GetAudioHardwareConfig(); |
| 36 int sample_rate = hardware_config->GetOutputSampleRate(); | 36 int sample_rate = hardware_config->GetOutputSampleRate(); |
| 37 sink_params_.Reset( | 37 sink_params_.Reset( |
| 38 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 38 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 39 media::CHANNEL_LAYOUT_STEREO, 2, 0, sample_rate, 16, | 39 media::CHANNEL_LAYOUT_STEREO, 2, sample_rate, 16, |
| 40 kWebAudioRenderBufferSize); | 40 kWebAudioRenderBufferSize); |
| 41 } | 41 } |
| 42 | 42 |
| 43 // Connect the source provider to the track as a sink. | 43 // Connect the source provider to the track as a sink. |
| 44 MediaStreamAudioSink::AddToAudioTrack(this, track_); | 44 MediaStreamAudioSink::AddToAudioTrack(this, track_); |
| 45 } | 45 } |
| 46 | 46 |
| 47 WebRtcLocalAudioSourceProvider::~WebRtcLocalAudioSourceProvider() { | 47 WebRtcLocalAudioSourceProvider::~WebRtcLocalAudioSourceProvider() { |
| 48 if (audio_converter_.get()) | 48 if (audio_converter_.get()) |
| 49 audio_converter_->RemoveInput(this); | 49 audio_converter_->RemoveInput(this); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 return 1.0; | 151 return 1.0; |
| 152 } | 152 } |
| 153 | 153 |
| 154 void WebRtcLocalAudioSourceProvider::SetSinkParamsForTesting( | 154 void WebRtcLocalAudioSourceProvider::SetSinkParamsForTesting( |
| 155 const media::AudioParameters& sink_params) { | 155 const media::AudioParameters& sink_params) { |
| 156 sink_params_ = sink_params; | 156 sink_params_ = sink_params; |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace content | 159 } // namespace content |
| OLD | NEW |