Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: content/renderer/media/webrtc/webrtc_local_audio_track_adapter.cc

Issue 671793004: Clean up the media stream audio track code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698