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 14 matching lines...) Expand all Loading... |
25 | 25 |
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(media::AudioBus* audio_bus, |
36 media::AudioBus* audio_bus, int audio_delay_milliseconds) { | 36 uint32_t audio_delay_milliseconds, |
| 37 uint32_t frames_skipped) { |
37 TRACE_EVENT0("audio", "WebRtcLocalAudioRenderer::Render"); | 38 TRACE_EVENT0("audio", "WebRtcLocalAudioRenderer::Render"); |
38 base::AutoLock auto_lock(thread_lock_); | 39 base::AutoLock auto_lock(thread_lock_); |
39 | 40 |
40 if (!playing_ || !volume_ || !audio_shifter_) { | 41 if (!playing_ || !volume_ || !audio_shifter_) { |
41 audio_bus->Zero(); | 42 audio_bus->Zero(); |
42 return 0; | 43 return 0; |
43 } | 44 } |
44 | 45 |
45 audio_shifter_->Pull( | 46 audio_shifter_->Pull( |
46 audio_bus, | 47 audio_bus, |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 AudioDeviceFactory::NewOutputDevice(source_render_frame_id_, session_id_, | 345 AudioDeviceFactory::NewOutputDevice(source_render_frame_id_, session_id_, |
345 output_device_id_, security_origin_); | 346 output_device_id_, security_origin_); |
346 int frames_per_buffer = sink_->GetOutputParameters().frames_per_buffer(); | 347 int frames_per_buffer = sink_->GetOutputParameters().frames_per_buffer(); |
347 sink_params_ = source_params_; | 348 sink_params_ = source_params_; |
348 sink_params_.set_frames_per_buffer(WebRtcAudioRenderer::GetOptimalBufferSize( | 349 sink_params_.set_frames_per_buffer(WebRtcAudioRenderer::GetOptimalBufferSize( |
349 source_params_.sample_rate(), frames_per_buffer)); | 350 source_params_.sample_rate(), frames_per_buffer)); |
350 MaybeStartSink(); | 351 MaybeStartSink(); |
351 } | 352 } |
352 | 353 |
353 } // namespace content | 354 } // namespace content |
OLD | NEW |