OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/media/media_stream_audio_sink_owner.h" | 5 #include "content/renderer/media/media_stream_audio_sink_owner.h" |
6 | 6 |
7 #include "content/public/renderer/media_stream_audio_sink.h" | 7 #include "content/public/renderer/media_stream_audio_sink.h" |
8 #include "media/audio/audio_parameters.h" | 8 #include "media/audio/audio_parameters.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 MediaStreamAudioSinkOwner::MediaStreamAudioSinkOwner(MediaStreamAudioSink* sink) | 12 MediaStreamAudioSinkOwner::MediaStreamAudioSinkOwner(MediaStreamAudioSink* sink) |
13 : delegate_(sink) { | 13 : delegate_(sink) { |
14 } | 14 } |
15 | 15 |
16 int MediaStreamAudioSinkOwner::OnData(const int16* audio_data, | 16 void MediaStreamAudioSinkOwner::OnData(const int16* audio_data, |
17 int sample_rate, | 17 int sample_rate, |
18 int number_of_channels, | 18 int number_of_channels, |
19 int number_of_frames, | 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_); | 20 base::AutoLock lock(lock_); |
26 // TODO(xians): Investigate on the possibility of not calling out with the | |
27 // lock. | |
28 if (delegate_) { | 21 if (delegate_) { |
29 delegate_->OnData(audio_data, | 22 delegate_->OnData(audio_data, |
30 sample_rate, | 23 sample_rate, |
31 number_of_channels, | 24 number_of_channels, |
32 number_of_frames); | 25 number_of_frames); |
33 } | 26 } |
34 | |
35 return 0; | |
36 } | 27 } |
37 | 28 |
38 void MediaStreamAudioSinkOwner::OnSetFormat( | 29 void MediaStreamAudioSinkOwner::OnSetFormat( |
39 const media::AudioParameters& params) { | 30 const media::AudioParameters& params) { |
40 base::AutoLock lock(lock_); | 31 base::AutoLock lock(lock_); |
41 if (delegate_) | 32 if (delegate_) |
42 delegate_->OnSetFormat(params); | 33 delegate_->OnSetFormat(params); |
43 } | 34 } |
44 | 35 |
45 void MediaStreamAudioSinkOwner::OnReadyStateChanged( | 36 void MediaStreamAudioSinkOwner::OnReadyStateChanged( |
46 blink::WebMediaStreamSource::ReadyState state) { | 37 blink::WebMediaStreamSource::ReadyState state) { |
47 base::AutoLock lock(lock_); | 38 base::AutoLock lock(lock_); |
48 if (delegate_) | 39 if (delegate_) |
49 delegate_->OnReadyStateChanged(state); | 40 delegate_->OnReadyStateChanged(state); |
50 } | 41 } |
51 | 42 |
52 void MediaStreamAudioSinkOwner::Reset() { | 43 void MediaStreamAudioSinkOwner::Reset() { |
53 base::AutoLock lock(lock_); | 44 base::AutoLock lock(lock_); |
54 delegate_ = NULL; | 45 delegate_ = NULL; |
55 } | 46 } |
56 | 47 |
57 bool MediaStreamAudioSinkOwner::IsEqual( | 48 bool MediaStreamAudioSinkOwner::IsEqual( |
58 const MediaStreamAudioSink* other) const { | 49 const MediaStreamAudioSink* other) const { |
59 DCHECK(other); | 50 DCHECK(other); |
60 base::AutoLock lock(lock_); | 51 base::AutoLock lock(lock_); |
61 return (other == delegate_); | 52 return (other == delegate_); |
62 } | 53 } |
63 | 54 |
64 bool MediaStreamAudioSinkOwner::IsEqual( | |
65 const PeerConnectionAudioSink* other) const { | |
66 DCHECK(other); | |
67 return false; | |
68 } | |
69 | |
70 } // namespace content | 55 } // namespace content |
OLD | NEW |