Chromium Code Reviews| 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/media_stream_audio_sink_owner.h" | |
| 6 | |
| 7 #include "content/public/renderer/media_stream_audio_sink.h" | |
| 8 #include "media/audio/audio_parameters.h" | |
| 9 | |
| 10 namespace content { | |
| 11 | |
| 12 MediaStreamAudioSinkOwner::MediaStreamAudioSinkOwner( | |
| 13 MediaStreamAudioSink* sink) | |
|
perkj_chrome
2013/12/03 13:38:53
nit: argument fits on line above.
no longer working on chromium
2013/12/03 13:50:29
Done.
| |
| 14 : delegate_(sink) { | |
| 15 } | |
| 16 | |
| 17 int MediaStreamAudioSinkOwner::OnData(const int16* audio_data, | |
| 18 int sample_rate, | |
| 19 int number_of_channels, | |
| 20 int number_of_frames, | |
| 21 const std::vector<int>& channels, | |
| 22 int audio_delay_milliseconds, | |
| 23 int current_volume, | |
| 24 bool need_audio_processing, | |
| 25 bool key_pressed) { | |
| 26 base::AutoLock lock(lock_); | |
| 27 // TODO(xians): Investigate on the possibility of not calling out with the | |
|
perkj_chrome
2013/12/03 13:38:53
nit: Investigate the possibility to not grab the l
no longer working on chromium
2013/12/03 13:50:29
I think it is different meaning, we need the lock
| |
| 28 // lock. | |
| 29 if (delegate_) { | |
| 30 delegate_->OnData(audio_data, | |
| 31 sample_rate, | |
| 32 number_of_channels, | |
| 33 number_of_frames); | |
| 34 } | |
| 35 | |
| 36 return 0; | |
| 37 } | |
| 38 | |
| 39 void MediaStreamAudioSinkOwner::OnSetFormat( | |
| 40 const media::AudioParameters& params) { | |
| 41 base::AutoLock lock(lock_); | |
| 42 if (delegate_) | |
| 43 delegate_->OnSetFormat(params); | |
| 44 } | |
| 45 | |
| 46 void MediaStreamAudioSinkOwner::Reset() { | |
| 47 base::AutoLock lock(lock_); | |
| 48 delegate_ = NULL; | |
| 49 } | |
| 50 | |
| 51 bool MediaStreamAudioSinkOwner::IsEqual( | |
| 52 const MediaStreamAudioSink* other) const { | |
| 53 DCHECK(other); | |
| 54 base::AutoLock lock(lock_); | |
| 55 return (other == delegate_); | |
| 56 } | |
| 57 | |
| 58 bool MediaStreamAudioSinkOwner::IsEqual( | |
| 59 const PeerConnectionAudioSink* other) const { | |
| 60 DCHECK(other); | |
| 61 return false; | |
| 62 } | |
| 63 | |
| 64 } // namespace content | |
| OLD | NEW |