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