Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / renderer / media / peer_connection_audio_sink_owner.cc
blob4073ac614258baf3afb0b509b7ddd4e1855b6a37
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.
5 #include "content/renderer/media/peer_connection_audio_sink_owner.h"
7 #include "content/renderer/media/webrtc_audio_device_impl.h"
9 namespace content {
11 PeerConnectionAudioSinkOwner::PeerConnectionAudioSinkOwner(
12 PeerConnectionAudioSink* sink)
13 : delegate_(sink) {
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);
38 return 0;
41 void PeerConnectionAudioSinkOwner::OnSetFormat(
42 const media::AudioParameters& params) {
43 base::AutoLock lock(lock_);
44 if (delegate_)
45 delegate_->OnSetFormat(params);
48 void PeerConnectionAudioSinkOwner::OnReadyStateChanged(
49 blink::WebMediaStreamSource::ReadyState state) {
50 // Not forwarded at the moment.
53 void PeerConnectionAudioSinkOwner::Reset() {
54 base::AutoLock lock(lock_);
55 delegate_ = NULL;
58 bool PeerConnectionAudioSinkOwner::IsEqual(
59 const MediaStreamAudioSink* other) const {
60 DCHECK(other);
61 return false;
64 bool PeerConnectionAudioSinkOwner::IsEqual(
65 const PeerConnectionAudioSink* other) const {
66 DCHECK(other);
67 base::AutoLock lock(lock_);
68 return (other == delegate_);
71 } // namespace content