OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_audio_renderer.h" | 5 #include "content/renderer/media/webrtc_audio_renderer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "content/renderer/media/audio_device_factory.h" | 10 #include "content/renderer/media/audio_device_factory.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 DCHECK_EQ(state_, UNINITIALIZED); | 103 DCHECK_EQ(state_, UNINITIALIZED); |
104 buffer_.reset(); | 104 buffer_.reset(); |
105 } | 105 } |
106 | 106 |
107 bool WebRtcAudioRenderer::Initialize(WebRtcAudioRendererSource* source) { | 107 bool WebRtcAudioRenderer::Initialize(WebRtcAudioRendererSource* source) { |
108 DVLOG(1) << "WebRtcAudioRenderer::Initialize()"; | 108 DVLOG(1) << "WebRtcAudioRenderer::Initialize()"; |
109 DCHECK(thread_checker_.CalledOnValidThread()); | 109 DCHECK(thread_checker_.CalledOnValidThread()); |
110 base::AutoLock auto_lock(lock_); | 110 base::AutoLock auto_lock(lock_); |
111 DCHECK_EQ(state_, UNINITIALIZED); | 111 DCHECK_EQ(state_, UNINITIALIZED); |
112 DCHECK(source); | 112 DCHECK(source); |
113 DCHECK(!sink_); | 113 DCHECK(!sink_.get()); |
114 DCHECK(!source_); | 114 DCHECK(!source_); |
115 | 115 |
116 // Use stereo output on all platforms exept Android. | 116 // Use stereo output on all platforms exept Android. |
117 media::ChannelLayout channel_layout = media::CHANNEL_LAYOUT_STEREO; | 117 media::ChannelLayout channel_layout = media::CHANNEL_LAYOUT_STEREO; |
118 #if defined(OS_ANDROID) | 118 #if defined(OS_ANDROID) |
119 DVLOG(1) << "Using mono audio output for Android"; | 119 DVLOG(1) << "Using mono audio output for Android"; |
120 channel_layout = media::CHANNEL_LAYOUT_MONO; | 120 channel_layout = media::CHANNEL_LAYOUT_MONO; |
121 #endif | 121 #endif |
122 // Ask the renderer for the default audio output hardware sample-rate. | 122 // Ask the renderer for the default audio output hardware sample-rate. |
123 media::AudioHardwareConfig* hardware_config = | 123 media::AudioHardwareConfig* hardware_config = |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 339 } |
340 | 340 |
341 // De-interleave each channel and convert to 32-bit floating-point | 341 // De-interleave each channel and convert to 32-bit floating-point |
342 // with nominal range -1.0 -> +1.0 to match the callback format. | 342 // with nominal range -1.0 -> +1.0 to match the callback format. |
343 audio_bus->FromInterleaved(buffer_.get(), | 343 audio_bus->FromInterleaved(buffer_.get(), |
344 audio_bus->frames(), | 344 audio_bus->frames(), |
345 sizeof(buffer_[0])); | 345 sizeof(buffer_[0])); |
346 } | 346 } |
347 | 347 |
348 } // namespace content | 348 } // namespace content |
OLD | NEW |