| 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" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 280 |
| 281 base::AutoLock auto_lock(thread_lock_); | 281 base::AutoLock auto_lock(thread_lock_); |
| 282 | 282 |
| 283 // Clear up the old data in the FIFO. | 283 // Clear up the old data in the FIFO. |
| 284 loopback_fifo_->Clear(); | 284 loopback_fifo_->Clear(); |
| 285 | 285 |
| 286 if (!sink_params_.IsValid() || !playing_ || !volume_ || sink_started_) | 286 if (!sink_params_.IsValid() || !playing_ || !volume_ || sink_started_) |
| 287 return; | 287 return; |
| 288 | 288 |
| 289 DVLOG(1) << "WebRtcLocalAudioRenderer::MaybeStartSink() -- Starting sink_."; | 289 DVLOG(1) << "WebRtcLocalAudioRenderer::MaybeStartSink() -- Starting sink_."; |
| 290 sink_->InitializeUnifiedStream(sink_params_, this, session_id_); | 290 sink_->InitializeWithSessionId(sink_params_, this, session_id_); |
| 291 sink_->Start(); | 291 sink_->Start(); |
| 292 sink_started_ = true; | 292 sink_started_ = true; |
| 293 UMA_HISTOGRAM_ENUMERATION("Media.LocalRendererSinkStates", | 293 UMA_HISTOGRAM_ENUMERATION("Media.LocalRendererSinkStates", |
| 294 kSinkStarted, kSinkStatesMax); | 294 kSinkStarted, kSinkStatesMax); |
| 295 } | 295 } |
| 296 | 296 |
| 297 void WebRtcLocalAudioRenderer::ReconfigureSink( | 297 void WebRtcLocalAudioRenderer::ReconfigureSink( |
| 298 const media::AudioParameters& params) { | 298 const media::AudioParameters& params) { |
| 299 DCHECK(message_loop_->BelongsToCurrentThread()); | 299 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 300 | 300 |
| 301 DVLOG(1) << "WebRtcLocalAudioRenderer::ReconfigureSink()"; | 301 DVLOG(1) << "WebRtcLocalAudioRenderer::ReconfigureSink()"; |
| 302 | 302 |
| 303 if (!sink_) | 303 if (!sink_) |
| 304 return; // WebRtcLocalAudioRenderer has not yet been started. | 304 return; // WebRtcLocalAudioRenderer has not yet been started. |
| 305 | 305 |
| 306 // Stop |sink_| and re-create a new one to be initialized with different audio | 306 // Stop |sink_| and re-create a new one to be initialized with different audio |
| 307 // parameters. Then, invoke MaybeStartSink() to restart everything again. | 307 // parameters. Then, invoke MaybeStartSink() to restart everything again. |
| 308 if (sink_started_) { | 308 if (sink_started_) { |
| 309 sink_->Stop(); | 309 sink_->Stop(); |
| 310 sink_started_ = false; | 310 sink_started_ = false; |
| 311 } | 311 } |
| 312 sink_ = AudioDeviceFactory::NewOutputDevice(source_render_view_id_, | 312 sink_ = AudioDeviceFactory::NewOutputDevice(source_render_view_id_, |
| 313 source_render_frame_id_); | 313 source_render_frame_id_); |
| 314 MaybeStartSink(); | 314 MaybeStartSink(); |
| 315 } | 315 } |
| 316 | 316 |
| 317 } // namespace content | 317 } // namespace content |
| OLD | NEW |