| 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_send_stream.h" | 11 #include "webrtc/audio/audio_send_stream.h" |
| 12 | 12 |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "webrtc/audio/audio_state.h" | 15 #include "webrtc/audio/audio_state.h" |
| 16 #include "webrtc/audio/conversion.h" | 16 #include "webrtc/audio/conversion.h" |
| 17 #include "webrtc/audio/scoped_voe_interface.h" | 17 #include "webrtc/audio/scoped_voe_interface.h" |
| 18 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 19 #include "webrtc/base/logging.h" | 19 #include "webrtc/base/logging.h" |
| 20 #include "webrtc/call/congestion_controller.h" |
| 21 #include "webrtc/modules/pacing/paced_sender.h" |
| 22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 20 #include "webrtc/voice_engine/channel_proxy.h" | 23 #include "webrtc/voice_engine/channel_proxy.h" |
| 21 #include "webrtc/voice_engine/include/voe_audio_processing.h" | 24 #include "webrtc/voice_engine/include/voe_audio_processing.h" |
| 22 #include "webrtc/voice_engine/include/voe_codec.h" | 25 #include "webrtc/voice_engine/include/voe_codec.h" |
| 23 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | 26 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" |
| 24 #include "webrtc/voice_engine/include/voe_volume_control.h" | 27 #include "webrtc/voice_engine/include/voe_volume_control.h" |
| 25 #include "webrtc/voice_engine/voice_engine_impl.h" | 28 #include "webrtc/voice_engine/voice_engine_impl.h" |
| 26 | 29 |
| 27 namespace webrtc { | 30 namespace webrtc { |
| 28 std::string AudioSendStream::Config::Rtp::ToString() const { | 31 std::string AudioSendStream::Config::Rtp::ToString() const { |
| 29 std::stringstream ss; | 32 std::stringstream ss; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 48 // TODO(solenberg): Encoder config. | 51 // TODO(solenberg): Encoder config. |
| 49 ss << ", cng_payload_type: " << cng_payload_type; | 52 ss << ", cng_payload_type: " << cng_payload_type; |
| 50 ss << ", red_payload_type: " << red_payload_type; | 53 ss << ", red_payload_type: " << red_payload_type; |
| 51 ss << '}'; | 54 ss << '}'; |
| 52 return ss.str(); | 55 return ss.str(); |
| 53 } | 56 } |
| 54 | 57 |
| 55 namespace internal { | 58 namespace internal { |
| 56 AudioSendStream::AudioSendStream( | 59 AudioSendStream::AudioSendStream( |
| 57 const webrtc::AudioSendStream::Config& config, | 60 const webrtc::AudioSendStream::Config& config, |
| 58 const rtc::scoped_refptr<webrtc::AudioState>& audio_state) | 61 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, |
| 62 CongestionController* congestion_controller) |
| 59 : config_(config), audio_state_(audio_state) { | 63 : config_(config), audio_state_(audio_state) { |
| 60 LOG(LS_INFO) << "AudioSendStream: " << config_.ToString(); | 64 LOG(LS_INFO) << "AudioSendStream: " << config_.ToString(); |
| 61 RTC_DCHECK_NE(config_.voe_channel_id, -1); | 65 RTC_DCHECK_NE(config_.voe_channel_id, -1); |
| 62 RTC_DCHECK(audio_state_.get()); | 66 RTC_DCHECK(audio_state_.get()); |
| 67 RTC_DCHECK(congestion_controller); |
| 63 | 68 |
| 64 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); | 69 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); |
| 65 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); | 70 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); |
| 71 channel_proxy_->SetCongestionControlObjects( |
| 72 congestion_controller->pacer(), |
| 73 congestion_controller->GetTransportFeedbackObserver(), |
| 74 congestion_controller->packet_router()); |
| 66 channel_proxy_->SetRTCPStatus(true); | 75 channel_proxy_->SetRTCPStatus(true); |
| 67 channel_proxy_->SetLocalSSRC(config.rtp.ssrc); | 76 channel_proxy_->SetLocalSSRC(config.rtp.ssrc); |
| 68 channel_proxy_->SetRTCP_CNAME(config.rtp.c_name); | 77 channel_proxy_->SetRTCP_CNAME(config.rtp.c_name); |
| 78 |
| 69 for (const auto& extension : config.rtp.extensions) { | 79 for (const auto& extension : config.rtp.extensions) { |
| 70 if (extension.name == RtpExtension::kAbsSendTime) { | 80 if (extension.name == RtpExtension::kAbsSendTime) { |
| 71 channel_proxy_->SetSendAbsoluteSenderTimeStatus(true, extension.id); | 81 channel_proxy_->SetSendAbsoluteSenderTimeStatus(true, extension.id); |
| 72 } else if (extension.name == RtpExtension::kAudioLevel) { | 82 } else if (extension.name == RtpExtension::kAudioLevel) { |
| 73 channel_proxy_->SetSendAudioLevelIndicationStatus(true, extension.id); | 83 channel_proxy_->SetSendAudioLevelIndicationStatus(true, extension.id); |
| 84 } else if (extension.name == RtpExtension::kTransportSequenceNumber) { |
| 85 channel_proxy_->EnableSendTransportSequenceNumber(extension.id); |
| 74 } else { | 86 } else { |
| 75 RTC_NOTREACHED() << "Registering unsupported RTP extension."; | 87 RTC_NOTREACHED() << "Registering unsupported RTP extension."; |
| 76 } | 88 } |
| 77 } | 89 } |
| 78 } | 90 } |
| 79 | 91 |
| 80 AudioSendStream::~AudioSendStream() { | 92 AudioSendStream::~AudioSendStream() { |
| 81 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 93 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 82 LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString(); | 94 LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString(); |
| 95 channel_proxy_->SetCongestionControlObjects(nullptr, nullptr, nullptr); |
| 83 } | 96 } |
| 84 | 97 |
| 85 void AudioSendStream::Start() { | 98 void AudioSendStream::Start() { |
| 86 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 99 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 87 } | 100 } |
| 88 | 101 |
| 89 void AudioSendStream::Stop() { | 102 void AudioSendStream::Stop() { |
| 90 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 103 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 91 } | 104 } |
| 92 | 105 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 212 |
| 200 VoiceEngine* AudioSendStream::voice_engine() const { | 213 VoiceEngine* AudioSendStream::voice_engine() const { |
| 201 internal::AudioState* audio_state = | 214 internal::AudioState* audio_state = |
| 202 static_cast<internal::AudioState*>(audio_state_.get()); | 215 static_cast<internal::AudioState*>(audio_state_.get()); |
| 203 VoiceEngine* voice_engine = audio_state->voice_engine(); | 216 VoiceEngine* voice_engine = audio_state->voice_engine(); |
| 204 RTC_DCHECK(voice_engine); | 217 RTC_DCHECK(voice_engine); |
| 205 return voice_engine; | 218 return voice_engine; |
| 206 } | 219 } |
| 207 } // namespace internal | 220 } // namespace internal |
| 208 } // namespace webrtc | 221 } // namespace webrtc |
| OLD | NEW |