| 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) { |
| 22 base::AutoLock lock(lock_); | 23 base::AutoLock lock(lock_); |
| 23 if (delegate_) { | 24 if (delegate_) { |
| 24 return delegate_->CaptureData(channels, audio_data, sample_rate, | 25 delegate_->CaptureData(channels, |
| 25 number_of_channels, number_of_frames, | 26 audio_data, |
| 26 audio_delay_milliseconds, current_volume, | 27 sample_rate, |
| 27 need_audio_processing); | 28 number_of_channels, |
| 29 number_of_frames, |
| 30 audio_delay_milliseconds, |
| 31 current_volume, |
| 32 need_audio_processing, |
| 33 key_pressed); |
| 28 } | 34 } |
| 29 | 35 |
| 30 return 0; | 36 return 0; |
| 31 } | 37 } |
| 32 | 38 |
| 33 void WebRtcAudioCapturerSinkOwner::SetCaptureFormat( | 39 void WebRtcAudioCapturerSinkOwner::SetCaptureFormat( |
| 34 const media::AudioParameters& params) { | 40 const media::AudioParameters& params) { |
| 35 base::AutoLock lock(lock_); | 41 base::AutoLock lock(lock_); |
| 36 if (delegate_) | 42 if (delegate_) |
| 37 delegate_->SetCaptureFormat(params); | 43 delegate_->SetCaptureFormat(params); |
| 38 } | 44 } |
| 39 | 45 |
| 40 bool WebRtcAudioCapturerSinkOwner::IsEqual( | 46 bool WebRtcAudioCapturerSinkOwner::IsEqual( |
| 41 const WebRtcAudioCapturerSink* other) const { | 47 const WebRtcAudioCapturerSink* other) const { |
| 42 base::AutoLock lock(lock_); | 48 base::AutoLock lock(lock_); |
| 43 return (other == delegate_); | 49 return (other == delegate_); |
| 44 } | 50 } |
| 45 | 51 |
| 46 void WebRtcAudioCapturerSinkOwner::Reset() { | 52 void WebRtcAudioCapturerSinkOwner::Reset() { |
| 47 base::AutoLock lock(lock_); | 53 base::AutoLock lock(lock_); |
| 48 delegate_ = NULL; | 54 delegate_ = NULL; |
| 49 } | 55 } |
| 50 | 56 |
| 51 } // namespace content | 57 } // namespace content |
| OLD | NEW |