Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webrtc/webrtc_local_audio_track_adapter.h" | 5 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/renderer/media/media_stream_audio_processor.h" | 8 #include "content/renderer/media/media_stream_audio_processor.h" |
| 9 #include "content/renderer/media/webrtc/webrtc_audio_sink_adapter.h" | 9 #include "content/renderer/media/webrtc/webrtc_audio_sink_adapter.h" |
| 10 #include "content/renderer/media/webrtc_local_audio_track.h" | 10 #include "content/renderer/media/webrtc_local_audio_track.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool WebRtcLocalAudioTrackAdapter::GetSignalLevel(int* level) { | 87 bool WebRtcLocalAudioTrackAdapter::GetSignalLevel(int* level) { |
| 88 base::AutoLock auto_lock(lock_); | 88 base::AutoLock auto_lock(lock_); |
| 89 // It is required to provide the signal level after audio processing. In | 89 // It is required to provide the signal level after audio processing. In |
| 90 // case the audio processing is not enabled for the track, we return | 90 // case the audio processing is not enabled for the track, we return |
| 91 // false here in order not to overwrite the value from WebRTC. | 91 // false here in order not to overwrite the value from WebRTC. |
| 92 // TODO(xians): Remove this after we turn on the APM in Chrome by default. | |
| 93 // http://crbug/365672 . | |
| 94 if (!MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) | |
| 95 return false; | |
| 96 | |
| 97 *level = signal_level_; | 92 *level = signal_level_; |
| 98 return true; | 93 return true; |
| 99 } | 94 } |
| 100 | 95 |
| 101 rtc::scoped_refptr<webrtc::AudioProcessorInterface> | 96 rtc::scoped_refptr<webrtc::AudioProcessorInterface> |
| 102 WebRtcLocalAudioTrackAdapter::GetAudioProcessor() { | 97 WebRtcLocalAudioTrackAdapter::GetAudioProcessor() { |
| 103 base::AutoLock auto_lock(lock_); | 98 base::AutoLock auto_lock(lock_); |
| 104 return audio_processor_.get(); | 99 return audio_processor_.get(); |
| 105 } | 100 } |
| 106 | 101 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 136 std::find(voe_channels_.begin(), voe_channels_.end(), channel_id); | 131 std::find(voe_channels_.begin(), voe_channels_.end(), channel_id); |
| 137 DCHECK(iter != voe_channels_.end()); | 132 DCHECK(iter != voe_channels_.end()); |
| 138 voe_channels_.erase(iter); | 133 voe_channels_.erase(iter); |
| 139 } | 134 } |
| 140 | 135 |
| 141 webrtc::AudioSourceInterface* WebRtcLocalAudioTrackAdapter::GetSource() const { | 136 webrtc::AudioSourceInterface* WebRtcLocalAudioTrackAdapter::GetSource() const { |
| 142 return track_source_; | 137 return track_source_; |
| 143 } | 138 } |
| 144 | 139 |
| 145 cricket::AudioRenderer* WebRtcLocalAudioTrackAdapter::GetRenderer() { | 140 cricket::AudioRenderer* WebRtcLocalAudioTrackAdapter::GetRenderer() { |
| 146 // When the audio track processing is enabled, return a NULL so that capture | 141 return NULL; |
|
tommi (sloooow) - chröme
2014/10/30 14:10:06
NOTREACHED()?
no longer working on chromium
2014/10/30 14:13:31
We can't. mediastreamhandler.cc still calls it tod
| |
| 147 // data goes through Libjingle LocalAudioTrackHandler::LocalAudioSinkAdapter | |
| 148 // ==> WebRtcVoiceMediaChannel::WebRtcVoiceChannelRenderer ==> WebRTC. | |
| 149 // When the audio track processing is disabled, WebRtcLocalAudioTrackAdapter | |
| 150 // is used to pass the channel ids to WebRtcAudioDeviceImpl, the data flow | |
| 151 // becomes WebRtcAudioDeviceImpl ==> WebRTC. | |
| 152 // TODO(xians): Only return NULL after the APM in WebRTC is deprecated. | |
| 153 // See See http://crbug/365672 for details. | |
| 154 return MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()? | |
| 155 NULL : this; | |
| 156 } | 142 } |
| 157 | 143 |
| 158 } // namespace content | 144 } // namespace content |
| OLD | NEW |