OLD | NEW |
(Empty) | |
| 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/peer_connection_audio_sink_owner.h" |
| 6 |
| 7 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 8 |
| 9 namespace content { |
| 10 |
| 11 PeerConnectionAudioSinkOwner::PeerConnectionAudioSinkOwner( |
| 12 PeerConnectionAudioSink* sink) |
| 13 : delegate_(sink) { |
| 14 } |
| 15 |
| 16 int PeerConnectionAudioSinkOwner::OnData(const int16* audio_data, |
| 17 int sample_rate, |
| 18 int number_of_channels, |
| 19 int number_of_frames, |
| 20 const std::vector<int>& channels, |
| 21 int audio_delay_milliseconds, |
| 22 int current_volume, |
| 23 bool need_audio_processing, |
| 24 bool key_pressed) { |
| 25 base::AutoLock lock(lock_); |
| 26 if (delegate_) { |
| 27 return delegate_->OnData(audio_data, |
| 28 sample_rate, |
| 29 number_of_channels, |
| 30 number_of_frames, |
| 31 channels, |
| 32 audio_delay_milliseconds, |
| 33 current_volume, |
| 34 need_audio_processing, |
| 35 key_pressed); |
| 36 } |
| 37 |
| 38 return 0; |
| 39 } |
| 40 |
| 41 void PeerConnectionAudioSinkOwner::OnSetFormat( |
| 42 const media::AudioParameters& params) { |
| 43 base::AutoLock lock(lock_); |
| 44 if (delegate_) |
| 45 delegate_->OnSetFormat(params); |
| 46 } |
| 47 |
| 48 void PeerConnectionAudioSinkOwner::Reset() { |
| 49 base::AutoLock lock(lock_); |
| 50 delegate_ = NULL; |
| 51 } |
| 52 |
| 53 bool PeerConnectionAudioSinkOwner::IsEqual( |
| 54 const MediaStreamAudioSink* other) const { |
| 55 DCHECK(other); |
| 56 return false; |
| 57 } |
| 58 |
| 59 bool PeerConnectionAudioSinkOwner::IsEqual( |
| 60 const PeerConnectionAudioSink* other) const { |
| 61 DCHECK(other); |
| 62 base::AutoLock lock(lock_); |
| 63 return (other == delegate_); |
| 64 } |
| 65 |
| 66 } // namespace content |
OLD | NEW |