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_local_audio_renderer.h" | 5 #include "content/renderer/media/webrtc_local_audio_renderer.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "content/renderer/media/audio_device_factory.h" | 12 #include "content/renderer/media/audio_device_factory.h" |
13 #include "content/renderer/media/media_stream_dispatcher.h" | 13 #include "content/renderer/media/media_stream_dispatcher.h" |
14 #include "content/renderer/media/webrtc_audio_capturer.h" | 14 #include "content/renderer/media/webrtc_audio_capturer.h" |
15 #include "content/renderer/render_view_impl.h" | 15 #include "content/renderer/render_frame_impl.h" |
16 #include "media/audio/audio_output_device.h" | 16 #include "media/audio/audio_output_device.h" |
17 #include "media/base/audio_bus.h" | 17 #include "media/base/audio_bus.h" |
18 #include "media/base/audio_fifo.h" | 18 #include "media/base/audio_fifo.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 enum LocalRendererSinkStates { | 24 enum LocalRendererSinkStates { |
25 kSinkStarted = 0, | 25 kSinkStarted = 0, |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 kSinkStarted, kSinkStatesMax); | 259 kSinkStarted, kSinkStatesMax); |
260 } | 260 } |
261 | 261 |
262 void WebRtcLocalAudioRenderer::ReconfigureSink( | 262 void WebRtcLocalAudioRenderer::ReconfigureSink( |
263 const media::AudioParameters& params) { | 263 const media::AudioParameters& params) { |
264 DCHECK(message_loop_->BelongsToCurrentThread()); | 264 DCHECK(message_loop_->BelongsToCurrentThread()); |
265 | 265 |
266 DVLOG(1) << "WebRtcLocalAudioRenderer::ReconfigureSink()"; | 266 DVLOG(1) << "WebRtcLocalAudioRenderer::ReconfigureSink()"; |
267 | 267 |
268 int implicit_ducking_effect = 0; | 268 int implicit_ducking_effect = 0; |
269 RenderViewImpl* render_view = | 269 RenderFrameImpl* const frame = |
270 RenderViewImpl::FromRoutingID(source_render_view_id_); | 270 RenderFrameImpl::FromRoutingID(source_render_frame_id_); |
271 if (render_view && | 271 MediaStreamDispatcher* const dispatcher = frame ? |
272 render_view->media_stream_dispatcher() && | 272 frame->GetMediaStreamDispatcher() : NULL; |
273 render_view->media_stream_dispatcher()->IsAudioDuckingActive()) { | 273 if (dispatcher && dispatcher->IsAudioDuckingActive()) { |
274 DVLOG(1) << "Forcing DUCKING to be ON for output"; | 274 DVLOG(1) << "Forcing DUCKING to be ON for output"; |
275 implicit_ducking_effect = media::AudioParameters::DUCKING; | 275 implicit_ducking_effect = media::AudioParameters::DUCKING; |
276 } else { | 276 } else { |
277 DVLOG(1) << "DUCKING not forced ON for output"; | 277 DVLOG(1) << "DUCKING not forced ON for output"; |
278 } | 278 } |
279 | 279 |
280 if (source_params_ == params) | 280 if (source_params_ == params) |
281 return; | 281 return; |
282 | 282 |
283 // Reset the |source_params_|, |sink_params_| and |loopback_fifo_| to match | 283 // Reset the |source_params_|, |sink_params_| and |loopback_fifo_| to match |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 sink_->Stop(); | 327 sink_->Stop(); |
328 sink_started_ = false; | 328 sink_started_ = false; |
329 } | 329 } |
330 | 330 |
331 sink_ = AudioDeviceFactory::NewOutputDevice(source_render_view_id_, | 331 sink_ = AudioDeviceFactory::NewOutputDevice(source_render_view_id_, |
332 source_render_frame_id_); | 332 source_render_frame_id_); |
333 MaybeStartSink(); | 333 MaybeStartSink(); |
334 } | 334 } |
335 | 335 |
336 } // namespace content | 336 } // namespace content |
OLD | NEW |