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