| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_capturer_sink_owner.h" | 5 #include "content/renderer/media/webrtc_audio_capturer_sink_owner.h" |
| 6 | 6 |
| 7 namespace content { | 7 namespace content { |
| 8 | 8 |
| 9 WebRtcAudioCapturerSinkOwner::WebRtcAudioCapturerSinkOwner( | 9 WebRtcAudioCapturerSinkOwner::WebRtcAudioCapturerSinkOwner( |
| 10 WebRtcAudioCapturerSink* sink) | 10 WebRtcAudioCapturerSink* sink) |
| 11 : delegate_(sink) { | 11 : delegate_(sink) { |
| 12 } | 12 } |
| 13 | 13 |
| 14 int WebRtcAudioCapturerSinkOwner::CaptureData(const std::vector<int>& channels, | 14 int WebRtcAudioCapturerSinkOwner::CaptureData(const std::vector<int>& channels, |
| 15 const int16* audio_data, | 15 const int16* audio_data, |
| 16 int sample_rate, | 16 int sample_rate, |
| 17 int number_of_channels, | 17 int number_of_channels, |
| 18 int number_of_frames, | 18 int number_of_frames, |
| 19 int audio_delay_milliseconds, | 19 int audio_delay_milliseconds, |
| 20 int current_volume, | 20 int current_volume, |
| 21 bool need_audio_processing, | 21 bool need_audio_processing) { |
| 22 bool key_pressed) { | |
| 23 base::AutoLock lock(lock_); | 22 base::AutoLock lock(lock_); |
| 24 if (delegate_) { | 23 if (delegate_) { |
| 25 delegate_->CaptureData(channels, | 24 return delegate_->CaptureData(channels, audio_data, sample_rate, |
| 26 audio_data, | 25 number_of_channels, number_of_frames, |
| 27 sample_rate, | 26 audio_delay_milliseconds, current_volume, |
| 28 number_of_channels, | 27 need_audio_processing); |
| 29 number_of_frames, | |
| 30 audio_delay_milliseconds, | |
| 31 current_volume, | |
| 32 need_audio_processing, | |
| 33 key_pressed); | |
| 34 } | 28 } |
| 35 | 29 |
| 36 return 0; | 30 return 0; |
| 37 } | 31 } |
| 38 | 32 |
| 39 void WebRtcAudioCapturerSinkOwner::SetCaptureFormat( | 33 void WebRtcAudioCapturerSinkOwner::SetCaptureFormat( |
| 40 const media::AudioParameters& params) { | 34 const media::AudioParameters& params) { |
| 41 base::AutoLock lock(lock_); | 35 base::AutoLock lock(lock_); |
| 42 if (delegate_) | 36 if (delegate_) |
| 43 delegate_->SetCaptureFormat(params); | 37 delegate_->SetCaptureFormat(params); |
| 44 } | 38 } |
| 45 | 39 |
| 46 bool WebRtcAudioCapturerSinkOwner::IsEqual( | 40 bool WebRtcAudioCapturerSinkOwner::IsEqual( |
| 47 const WebRtcAudioCapturerSink* other) const { | 41 const WebRtcAudioCapturerSink* other) const { |
| 48 base::AutoLock lock(lock_); | 42 base::AutoLock lock(lock_); |
| 49 return (other == delegate_); | 43 return (other == delegate_); |
| 50 } | 44 } |
| 51 | 45 |
| 52 void WebRtcAudioCapturerSinkOwner::Reset() { | 46 void WebRtcAudioCapturerSinkOwner::Reset() { |
| 53 base::AutoLock lock(lock_); | 47 base::AutoLock lock(lock_); |
| 54 delegate_ = NULL; | 48 delegate_ = NULL; |
| 55 } | 49 } |
| 56 | 50 |
| 57 } // namespace content | 51 } // namespace content |
| OLD | NEW |