Chromium Code Reviews| Index: content/renderer/media/peer_connection_audio_sink_owner.cc |
| diff --git a/content/renderer/media/peer_connection_audio_sink_owner.cc b/content/renderer/media/peer_connection_audio_sink_owner.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..90deee3302108e648bab11e58d45884ac5cd8ba3 |
| --- /dev/null |
| +++ b/content/renderer/media/peer_connection_audio_sink_owner.cc |
| @@ -0,0 +1,60 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/renderer/media/peer_connection_audio_sink_owner.h" |
| + |
| +#include "content/renderer/media/webrtc_audio_device_impl.h" |
| + |
| +namespace content { |
| + |
| +PeerConnectionAudioSinkOwner::PeerConnectionAudioSinkOwner( |
| + PeerConnectionAudioSink* sink) |
| + : delegate_(sink) { |
| +} |
| + |
| +int PeerConnectionAudioSinkOwner::OnData(const int16* audio_data, |
| + int sample_rate, |
| + int number_of_channels, |
| + int number_of_frames, |
| + const std::vector<int>& channels, |
| + int audio_delay_milliseconds, |
| + int current_volume, |
| + bool need_audio_processing, |
| + bool key_pressed) { |
| + base::AutoLock lock(lock_); |
| + if (delegate_) { |
| + return delegate_->OnData(audio_data, |
| + sample_rate, |
| + number_of_channels, |
| + number_of_frames, |
| + channels, |
| + audio_delay_milliseconds, |
| + current_volume, |
| + need_audio_processing, |
| + key_pressed); |
| + } |
| + |
| + return 0; |
| +} |
| + |
| +void PeerConnectionAudioSinkOwner::OnSetFormat( |
|
tommi (sloooow) - chröme
2013/11/29 13:00:20
can we add thread checks for functions that are ex
no longer working on chromium
2013/11/29 15:02:04
as discussed offline, we can skip this for now sin
|
| + const media::AudioParameters& params) { |
| + base::AutoLock lock(lock_); |
| + if (delegate_) |
| + delegate_->OnSetFormat(params); |
| +} |
| + |
| +void PeerConnectionAudioSinkOwner::Reset() { |
| + base::AutoLock lock(lock_); |
| + delegate_ = NULL; |
| +} |
| + |
| +bool PeerConnectionAudioSinkOwner::IsEqual( |
| + const PeerConnectionAudioSink* other) const { |
| + DCHECK(other); |
|
tommi (sloooow) - chröme
2013/11/29 13:00:20
nit: No need for this dcheck now.
no longer working on chromium
2013/11/29 15:02:04
It is unclear to me, shouldn't the client take car
|
| + base::AutoLock lock(lock_); |
| + return (other == delegate_); |
| +} |
| + |
| +} // namespace content |