| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/audio/audio_receive_stream.h" | 11 #include "webrtc/audio/audio_receive_stream.h" |
| 12 | 12 |
| 13 #include <string> | 13 #include <string> |
| 14 #include <utility> | 14 #include <utility> |
| 15 | 15 |
| 16 #include "webrtc/api/call/audio_sink.h" | 16 #include "webrtc/api/call/audio_sink.h" |
| 17 #include "webrtc/audio/audio_send_stream.h" |
| 17 #include "webrtc/audio/audio_state.h" | 18 #include "webrtc/audio/audio_state.h" |
| 18 #include "webrtc/audio/conversion.h" | 19 #include "webrtc/audio/conversion.h" |
| 19 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
| 20 #include "webrtc/base/logging.h" | 21 #include "webrtc/base/logging.h" |
| 21 #include "webrtc/base/timeutils.h" | 22 #include "webrtc/base/timeutils.h" |
| 22 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 23 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
| 23 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 24 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
| 24 #include "webrtc/voice_engine/channel_proxy.h" | 25 #include "webrtc/voice_engine/channel_proxy.h" |
| 25 #include "webrtc/voice_engine/include/voe_base.h" | 26 #include "webrtc/voice_engine/include/voe_base.h" |
| 26 #include "webrtc/voice_engine/include/voe_codec.h" | 27 #include "webrtc/voice_engine/include/voe_codec.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 if (UseSendSideBwe(config)) { | 137 if (UseSendSideBwe(config)) { |
| 137 remote_bitrate_estimator_ = | 138 remote_bitrate_estimator_ = |
| 138 congestion_controller->GetRemoteBitrateEstimator(true); | 139 congestion_controller->GetRemoteBitrateEstimator(true); |
| 139 } | 140 } |
| 140 } | 141 } |
| 141 | 142 |
| 142 AudioReceiveStream::~AudioReceiveStream() { | 143 AudioReceiveStream::~AudioReceiveStream() { |
| 143 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 144 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 144 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString(); | 145 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString(); |
| 145 Stop(); | 146 Stop(); |
| 147 channel_proxy_->DisassociateSendChannel(); |
| 146 channel_proxy_->DeRegisterExternalTransport(); | 148 channel_proxy_->DeRegisterExternalTransport(); |
| 147 channel_proxy_->ResetCongestionControlObjects(); | 149 channel_proxy_->ResetCongestionControlObjects(); |
| 148 channel_proxy_->SetRtcEventLog(nullptr); | 150 channel_proxy_->SetRtcEventLog(nullptr); |
| 149 if (remote_bitrate_estimator_) { | 151 if (remote_bitrate_estimator_) { |
| 150 remote_bitrate_estimator_->RemoveStream(config_.rtp.remote_ssrc); | 152 remote_bitrate_estimator_->RemoveStream(config_.rtp.remote_ssrc); |
| 151 } | 153 } |
| 152 } | 154 } |
| 153 | 155 |
| 154 void AudioReceiveStream::Start() { | 156 void AudioReceiveStream::Start() { |
| 155 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 157 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 void AudioReceiveStream::SetGain(float gain) { | 225 void AudioReceiveStream::SetGain(float gain) { |
| 224 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 226 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 225 channel_proxy_->SetChannelOutputVolumeScaling(gain); | 227 channel_proxy_->SetChannelOutputVolumeScaling(gain); |
| 226 } | 228 } |
| 227 | 229 |
| 228 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { | 230 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { |
| 229 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 231 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 230 return config_; | 232 return config_; |
| 231 } | 233 } |
| 232 | 234 |
| 235 void AudioReceiveStream::AssociateSendStream(AudioSendStream* send_stream) { |
| 236 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 237 if (send_stream) { |
| 238 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); |
| 239 std::unique_ptr<voe::ChannelProxy> send_channel_proxy = |
| 240 voe_impl->GetChannelProxy(send_stream->config().voe_channel_id); |
| 241 channel_proxy_->AssociateSendChannel(*send_channel_proxy.get()); |
| 242 } else { |
| 243 channel_proxy_->DisassociateSendChannel(); |
| 244 } |
| 245 } |
| 246 |
| 233 void AudioReceiveStream::SignalNetworkState(NetworkState state) { | 247 void AudioReceiveStream::SignalNetworkState(NetworkState state) { |
| 234 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 248 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 235 } | 249 } |
| 236 | 250 |
| 237 bool AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { | 251 bool AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { |
| 238 // TODO(solenberg): Tests call this function on a network thread, libjingle | 252 // TODO(solenberg): Tests call this function on a network thread, libjingle |
| 239 // calls on the worker thread. We should move towards always using a network | 253 // calls on the worker thread. We should move towards always using a network |
| 240 // thread. Then this check can be enabled. | 254 // thread. Then this check can be enabled. |
| 241 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); | 255 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); |
| 242 return channel_proxy_->ReceivedRTCPPacket(packet, length); | 256 return channel_proxy_->ReceivedRTCPPacket(packet, length); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 300 |
| 287 VoiceEngine* AudioReceiveStream::voice_engine() const { | 301 VoiceEngine* AudioReceiveStream::voice_engine() const { |
| 288 internal::AudioState* audio_state = | 302 internal::AudioState* audio_state = |
| 289 static_cast<internal::AudioState*>(audio_state_.get()); | 303 static_cast<internal::AudioState*>(audio_state_.get()); |
| 290 VoiceEngine* voice_engine = audio_state->voice_engine(); | 304 VoiceEngine* voice_engine = audio_state->voice_engine(); |
| 291 RTC_DCHECK(voice_engine); | 305 RTC_DCHECK(voice_engine); |
| 292 return voice_engine; | 306 return voice_engine; |
| 293 } | 307 } |
| 294 } // namespace internal | 308 } // namespace internal |
| 295 } // namespace webrtc | 309 } // namespace webrtc |
| OLD | NEW |