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

Side by Side Diff: content/renderer/media/webrtc_local_audio_source_provider.cc

Issue 1304973005: Refactor AudioParameters member setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cross-platform fixes. Created 5 years, 3 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 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 16 matching lines...) Expand all
27 : is_enabled_(false), 27 : is_enabled_(false),
28 track_(track), 28 track_(track),
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(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
38 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, 38 media::CHANNEL_LAYOUT_STEREO, sample_rate, 16,
39 media::CHANNEL_LAYOUT_STEREO, 2, sample_rate, 16, 39 kWebAudioRenderBufferSize);
40 kWebAudioRenderBufferSize);
41 } 40 }
42 41
43 // Connect the source provider to the track as a sink. 42 // Connect the source provider to the track as a sink.
44 MediaStreamAudioSink::AddToAudioTrack(this, track_); 43 MediaStreamAudioSink::AddToAudioTrack(this, track_);
45 } 44 }
46 45
47 WebRtcLocalAudioSourceProvider::~WebRtcLocalAudioSourceProvider() { 46 WebRtcLocalAudioSourceProvider::~WebRtcLocalAudioSourceProvider() {
48 if (audio_converter_.get()) 47 if (audio_converter_.get())
49 audio_converter_->RemoveInput(this); 48 audio_converter_->RemoveInput(this);
50 49
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 143
145 return 1.0; 144 return 1.0;
146 } 145 }
147 146
148 void WebRtcLocalAudioSourceProvider::SetSinkParamsForTesting( 147 void WebRtcLocalAudioSourceProvider::SetSinkParamsForTesting(
149 const media::AudioParameters& sink_params) { 148 const media::AudioParameters& sink_params) {
150 sink_params_ = sink_params; 149 sink_params_ = sink_params;
151 } 150 }
152 151
153 } // namespace content 152 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698