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 namespace content { | |
| 8 | |
| 9 MediaStreamAudioSinkOwner::MediaStreamAudioSinkOwner( | |
| 10 MediaStreamAudioSink* sink) | |
| 11 : media_stream_delegate_(sink), | |
| 12 peer_connection_delegate_(NULL) { | |
| 13 } | |
| 14 | |
| 15 MediaStreamAudioSinkOwner::MediaStreamAudioSinkOwner( | |
| 16 PeerConnectionAudioSink* sink) | |
| 17 : media_stream_delegate_(NULL), | |
| 18 peer_connection_delegate_(sink) { | |
| 19 } | |
| 20 | |
| 21 int MediaStreamAudioSinkOwner::OnData(const int16* audio_data, | |
| 22 int sample_rate, | |
| 23 int number_of_channels, | |
| 24 int number_of_frames, | |
| 25 const std::vector<int>& channels, | |
| 26 int audio_delay_milliseconds, | |
| 27 int current_volume, | |
| 28 bool need_audio_processing, | |
| 29 bool key_pressed) { | |
| 30 base::AutoLock lock(lock_); | |
| 31 if (media_stream_delegate_) { | |
| 32 DCHECK(!peer_connection_delegate_); | |
| 33 media_stream_delegate_->OnData(audio_data, | |
| 34 sample_rate, | |
| 35 number_of_channels, | |
| 36 number_of_frames); | |
| 37 return 0; | |
| 38 } | |
| 39 | |
| 40 if (peer_connection_delegate_) { | |
| 41 return peer_connection_delegate_->OnData(audio_data, | |
| 42 sample_rate, | |
| 43 number_of_channels, | |
| 44 number_of_frames, | |
| 45 channels, | |
| 46 audio_delay_milliseconds, | |
| 47 current_volume, | |
| 48 need_audio_processing, | |
| 49 key_pressed); | |
| 50 } | |
| 51 | |
| 52 return 0; | |
| 53 } | |
| 54 | |
| 55 void MediaStreamAudioSinkOwner::OnSetFormat( | |
| 56 const media::AudioParameters& params) { | |
| 57 base::AutoLock lock(lock_); | |
| 58 if (media_stream_delegate_) { | |
| 59 DCHECK(!peer_connection_delegate_); | |
| 60 media_stream_delegate_->OnSetFormat(params); | |
| 61 return; | |
| 62 } | |
| 63 | |
| 64 if (peer_connection_delegate_) | |
| 65 peer_connection_delegate_->OnSetFormat(params); | |
| 66 } | |
| 67 | |
| 68 bool MediaStreamAudioSinkOwner::IsEqual( | |
|
Jói
2013/11/27 17:35:02
This will return true if |other| is NULL and media
no longer working on chromium
2013/11/28 17:27:18
Added a DCHECK(other);
no longer working on chromium
2013/11/28 19:22:22
I just realized that I forgot to commit the local
| |
| 69 const MediaStreamAudioSink* other) const { | |
| 70 base::AutoLock lock(lock_); | |
| 71 return (other == media_stream_delegate_); | |
| 72 } | |
| 73 | |
| 74 bool MediaStreamAudioSinkOwner::IsEqual( | |
| 75 const PeerConnectionAudioSink* other) const { | |
| 76 base::AutoLock lock(lock_); | |
| 77 return (other == peer_connection_delegate_); | |
| 78 } | |
| 79 | |
| 80 void MediaStreamAudioSinkOwner::Reset() { | |
| 81 base::AutoLock lock(lock_); | |
| 82 media_stream_delegate_ = NULL; | |
| 83 peer_connection_delegate_ = NULL; | |
| 84 } | |
| 85 | |
| 86 } // namespace content | |
| OLD | NEW |