| 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" |
| 11 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 11 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 static const char kAudioTrackKind[] = "audio"; | 15 static const char kAudioTrackKind[] = "audio"; |
| 16 | 16 |
| 17 scoped_refptr<WebRtcLocalAudioTrackAdapter> | 17 scoped_refptr<WebRtcLocalAudioTrackAdapter> |
| 18 WebRtcLocalAudioTrackAdapter::Create( | 18 WebRtcLocalAudioTrackAdapter::Create( |
| 19 const std::string& label, | 19 const std::string& label, |
| 20 webrtc::AudioSourceInterface* track_source) { | 20 webrtc::AudioSourceInterface* track_source) { |
| 21 rtc::RefCountedObject<WebRtcLocalAudioTrackAdapter>* adapter = | 21 talk_base::RefCountedObject<WebRtcLocalAudioTrackAdapter>* adapter = |
| 22 new rtc::RefCountedObject<WebRtcLocalAudioTrackAdapter>( | 22 new talk_base::RefCountedObject<WebRtcLocalAudioTrackAdapter>( |
| 23 label, track_source); | 23 label, track_source); |
| 24 return adapter; | 24 return adapter; |
| 25 } | 25 } |
| 26 | 26 |
| 27 WebRtcLocalAudioTrackAdapter::WebRtcLocalAudioTrackAdapter( | 27 WebRtcLocalAudioTrackAdapter::WebRtcLocalAudioTrackAdapter( |
| 28 const std::string& label, | 28 const std::string& label, |
| 29 webrtc::AudioSourceInterface* track_source) | 29 webrtc::AudioSourceInterface* track_source) |
| 30 : webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>(label), | 30 : webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>(label), |
| 31 owner_(NULL), | 31 owner_(NULL), |
| 32 track_source_(track_source), | 32 track_source_(track_source), |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. | 92 // TODO(xians): Remove this after we turn on the APM in Chrome by default. |
| 93 // http://crbug/365672 . | 93 // http://crbug/365672 . |
| 94 if (!MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) | 94 if (!MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()) |
| 95 return false; | 95 return false; |
| 96 | 96 |
| 97 *level = signal_level_; | 97 *level = signal_level_; |
| 98 return true; | 98 return true; |
| 99 } | 99 } |
| 100 | 100 |
| 101 rtc::scoped_refptr<webrtc::AudioProcessorInterface> | 101 talk_base::scoped_refptr<webrtc::AudioProcessorInterface> |
| 102 WebRtcLocalAudioTrackAdapter::GetAudioProcessor() { | 102 WebRtcLocalAudioTrackAdapter::GetAudioProcessor() { |
| 103 base::AutoLock auto_lock(lock_); | 103 base::AutoLock auto_lock(lock_); |
| 104 return audio_processor_.get(); | 104 return audio_processor_.get(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 std::vector<int> WebRtcLocalAudioTrackAdapter::VoeChannels() const { | 107 std::vector<int> WebRtcLocalAudioTrackAdapter::VoeChannels() const { |
| 108 base::AutoLock auto_lock(lock_); | 108 base::AutoLock auto_lock(lock_); |
| 109 return voe_channels_; | 109 return voe_channels_; |
| 110 } | 110 } |
| 111 | 111 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // When the audio track processing is disabled, WebRtcLocalAudioTrackAdapter | 149 // When the audio track processing is disabled, WebRtcLocalAudioTrackAdapter |
| 150 // is used to pass the channel ids to WebRtcAudioDeviceImpl, the data flow | 150 // is used to pass the channel ids to WebRtcAudioDeviceImpl, the data flow |
| 151 // becomes WebRtcAudioDeviceImpl ==> WebRTC. | 151 // becomes WebRtcAudioDeviceImpl ==> WebRTC. |
| 152 // TODO(xians): Only return NULL after the APM in WebRTC is deprecated. | 152 // TODO(xians): Only return NULL after the APM in WebRTC is deprecated. |
| 153 // See See http://crbug/365672 for details. | 153 // See See http://crbug/365672 for details. |
| 154 return MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()? | 154 return MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled()? |
| 155 NULL : this; | 155 NULL : this; |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace content | 158 } // namespace content |
| OLD | NEW |