| 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/location.h" | 7 #include "base/location.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 enum LocalRendererSinkStates { | 26 enum LocalRendererSinkStates { |
| 27 kSinkStarted = 0, | 27 kSinkStarted = 0, |
| 28 kSinkNeverStarted, | 28 kSinkNeverStarted, |
| 29 kSinkStatesMax // Must always be last! | 29 kSinkStatesMax // Must always be last! |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 // media::AudioRendererSink::RenderCallback implementation | 34 // media::AudioRendererSink::RenderCallback implementation |
| 35 int WebRtcLocalAudioRenderer::Render( | 35 int WebRtcLocalAudioRenderer::Render( |
| 36 media::AudioBus* audio_bus, uint32_t audio_delay_milliseconds, | 36 media::AudioBus* audio_bus, int audio_delay_milliseconds) { |
| 37 uint32_t frames_skipped) { | |
| 38 TRACE_EVENT0("audio", "WebRtcLocalAudioRenderer::Render"); | 37 TRACE_EVENT0("audio", "WebRtcLocalAudioRenderer::Render"); |
| 39 base::AutoLock auto_lock(thread_lock_); | 38 base::AutoLock auto_lock(thread_lock_); |
| 40 | 39 |
| 41 if (!playing_ || !volume_ || !audio_shifter_) { | 40 if (!playing_ || !volume_ || !audio_shifter_) { |
| 42 audio_bus->Zero(); | 41 audio_bus->Zero(); |
| 43 return 0; | 42 return 0; |
| 44 } | 43 } |
| 45 | 44 |
| 46 audio_shifter_->Pull( | 45 audio_shifter_->Pull( |
| 47 audio_bus, | 46 audio_bus, |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 AudioDeviceFactory::NewOutputDevice(source_render_frame_id_, session_id_, | 344 AudioDeviceFactory::NewOutputDevice(source_render_frame_id_, session_id_, |
| 346 output_device_id_, security_origin_); | 345 output_device_id_, security_origin_); |
| 347 int frames_per_buffer = sink_->GetOutputParameters().frames_per_buffer(); | 346 int frames_per_buffer = sink_->GetOutputParameters().frames_per_buffer(); |
| 348 sink_params_ = source_params_; | 347 sink_params_ = source_params_; |
| 349 sink_params_.set_frames_per_buffer(WebRtcAudioRenderer::GetOptimalBufferSize( | 348 sink_params_.set_frames_per_buffer(WebRtcAudioRenderer::GetOptimalBufferSize( |
| 350 source_params_.sample_rate(), frames_per_buffer)); | 349 source_params_.sample_rate(), frames_per_buffer)); |
| 351 MaybeStartSink(); | 350 MaybeStartSink(); |
| 352 } | 351 } |
| 353 | 352 |
| 354 } // namespace content | 353 } // namespace content |
| OLD | NEW |