Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / renderer / media / media_stream_audio_sink_owner.cc
blob664988d8213471e775cd09972afeba9aff8ff078
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/media_stream_audio_sink_owner.h"
7 #include "content/public/renderer/media_stream_audio_sink.h"
8 #include "media/audio/audio_parameters.h"
10 namespace content {
12 MediaStreamAudioSinkOwner::MediaStreamAudioSinkOwner(MediaStreamAudioSink* sink)
13 : delegate_(sink) {
16 int MediaStreamAudioSinkOwner::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 // TODO(xians): Investigate on the possibility of not calling out with the
27 // lock.
28 if (delegate_) {
29 delegate_->OnData(audio_data,
30 sample_rate,
31 number_of_channels,
32 number_of_frames);
35 return 0;
38 void MediaStreamAudioSinkOwner::OnSetFormat(
39 const media::AudioParameters& params) {
40 base::AutoLock lock(lock_);
41 if (delegate_)
42 delegate_->OnSetFormat(params);
45 void MediaStreamAudioSinkOwner::OnReadyStateChanged(
46 blink::WebMediaStreamSource::ReadyState state) {
47 base::AutoLock lock(lock_);
48 if (delegate_)
49 delegate_->OnReadyStateChanged(state);
52 void MediaStreamAudioSinkOwner::Reset() {
53 base::AutoLock lock(lock_);
54 delegate_ = NULL;
57 bool MediaStreamAudioSinkOwner::IsEqual(
58 const MediaStreamAudioSink* other) const {
59 DCHECK(other);
60 base::AutoLock lock(lock_);
61 return (other == delegate_);
64 bool MediaStreamAudioSinkOwner::IsEqual(
65 const PeerConnectionAudioSink* other) const {
66 DCHECK(other);
67 return false;
70 } // namespace content