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 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 ss << "{remote_ssrc: " << remote_ssrc; | 51 ss << "{remote_ssrc: " << remote_ssrc; |
52 ss << ", local_ssrc: " << local_ssrc; | 52 ss << ", local_ssrc: " << local_ssrc; |
53 ss << ", extensions: ["; | 53 ss << ", extensions: ["; |
54 for (size_t i = 0; i < extensions.size(); ++i) { | 54 for (size_t i = 0; i < extensions.size(); ++i) { |
55 ss << extensions[i].ToString(); | 55 ss << extensions[i].ToString(); |
56 if (i != extensions.size() - 1) { | 56 if (i != extensions.size() - 1) { |
57 ss << ", "; | 57 ss << ", "; |
58 } | 58 } |
59 } | 59 } |
60 ss << ']'; | 60 ss << ']'; |
| 61 ss << ", transport_cc: " << (transport_cc ? "on" : "off"); |
61 ss << '}'; | 62 ss << '}'; |
62 return ss.str(); | 63 return ss.str(); |
63 } | 64 } |
64 | 65 |
65 std::string AudioReceiveStream::Config::ToString() const { | 66 std::string AudioReceiveStream::Config::ToString() const { |
66 std::stringstream ss; | 67 std::stringstream ss; |
67 ss << "{rtp: " << rtp.ToString(); | 68 ss << "{rtp: " << rtp.ToString(); |
68 ss << ", receive_transport: " | 69 ss << ", receive_transport: " |
69 << (receive_transport ? "(Transport)" : "nullptr"); | 70 << (receive_transport ? "(Transport)" : "nullptr"); |
70 ss << ", rtcp_send_transport: " | 71 ss << ", rtcp_send_transport: " |
71 << (rtcp_send_transport ? "(Transport)" : "nullptr"); | 72 << (rtcp_send_transport ? "(Transport)" : "nullptr"); |
72 ss << ", voe_channel_id: " << voe_channel_id; | 73 ss << ", voe_channel_id: " << voe_channel_id; |
73 if (!sync_group.empty()) { | 74 if (!sync_group.empty()) { |
74 ss << ", sync_group: " << sync_group; | 75 ss << ", sync_group: " << sync_group; |
75 } | 76 } |
76 ss << ", combined_audio_video_bwe: " | |
77 << (combined_audio_video_bwe ? "true" : "false"); | |
78 ss << '}'; | 77 ss << '}'; |
79 return ss.str(); | 78 return ss.str(); |
80 } | 79 } |
81 | 80 |
82 namespace internal { | 81 namespace internal { |
83 AudioReceiveStream::AudioReceiveStream( | 82 AudioReceiveStream::AudioReceiveStream( |
84 CongestionController* congestion_controller, | 83 CongestionController* congestion_controller, |
85 const webrtc::AudioReceiveStream::Config& config, | 84 const webrtc::AudioReceiveStream::Config& config, |
86 const rtc::scoped_refptr<webrtc::AudioState>& audio_state) | 85 const rtc::scoped_refptr<webrtc::AudioState>& audio_state) |
87 : config_(config), | 86 : config_(config), |
(...skipping 24 matching lines...) Expand all Loading... |
112 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension( | 111 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension( |
113 kRtpExtensionTransportSequenceNumber, extension.id); | 112 kRtpExtensionTransportSequenceNumber, extension.id); |
114 RTC_DCHECK(registered); | 113 RTC_DCHECK(registered); |
115 } else { | 114 } else { |
116 RTC_NOTREACHED() << "Unsupported RTP extension."; | 115 RTC_NOTREACHED() << "Unsupported RTP extension."; |
117 } | 116 } |
118 } | 117 } |
119 // Configure bandwidth estimation. | 118 // Configure bandwidth estimation. |
120 channel_proxy_->RegisterReceiverCongestionControlObjects( | 119 channel_proxy_->RegisterReceiverCongestionControlObjects( |
121 congestion_controller->packet_router()); | 120 congestion_controller->packet_router()); |
122 if (config.combined_audio_video_bwe) { | 121 if (UseSendSideBwe(config)) { |
123 if (UseSendSideBwe(config)) { | 122 remote_bitrate_estimator_ = |
124 remote_bitrate_estimator_ = | 123 congestion_controller->GetRemoteBitrateEstimator(true); |
125 congestion_controller->GetRemoteBitrateEstimator(true); | |
126 } else { | |
127 remote_bitrate_estimator_ = | |
128 congestion_controller->GetRemoteBitrateEstimator(false); | |
129 } | |
130 RTC_DCHECK(remote_bitrate_estimator_); | |
131 } | 124 } |
132 } | 125 } |
133 | 126 |
134 AudioReceiveStream::~AudioReceiveStream() { | 127 AudioReceiveStream::~AudioReceiveStream() { |
135 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 128 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
136 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString(); | 129 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString(); |
137 channel_proxy_->ResetCongestionControlObjects(); | 130 channel_proxy_->ResetCongestionControlObjects(); |
138 if (remote_bitrate_estimator_) { | 131 if (remote_bitrate_estimator_) { |
139 remote_bitrate_estimator_->RemoveStream(config_.rtp.remote_ssrc); | 132 remote_bitrate_estimator_->RemoveStream(config_.rtp.remote_ssrc); |
140 } | 133 } |
(...skipping 28 matching lines...) Expand all Loading... |
169 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); | 162 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); |
170 RTPHeader header; | 163 RTPHeader header; |
171 if (!rtp_header_parser_->Parse(packet, length, &header)) { | 164 if (!rtp_header_parser_->Parse(packet, length, &header)) { |
172 return false; | 165 return false; |
173 } | 166 } |
174 | 167 |
175 // Only forward if the parsed header has one of the headers necessary for | 168 // Only forward if the parsed header has one of the headers necessary for |
176 // bandwidth estimation. RTP timestamps has different rates for audio and | 169 // bandwidth estimation. RTP timestamps has different rates for audio and |
177 // video and shouldn't be mixed. | 170 // video and shouldn't be mixed. |
178 if (remote_bitrate_estimator_ && | 171 if (remote_bitrate_estimator_ && |
179 (header.extension.hasAbsoluteSendTime || | 172 header.extension.hasTransportSequenceNumber) { |
180 header.extension.hasTransportSequenceNumber)) { | |
181 int64_t arrival_time_ms = TickTime::MillisecondTimestamp(); | 173 int64_t arrival_time_ms = TickTime::MillisecondTimestamp(); |
182 if (packet_time.timestamp >= 0) | 174 if (packet_time.timestamp >= 0) |
183 arrival_time_ms = (packet_time.timestamp + 500) / 1000; | 175 arrival_time_ms = (packet_time.timestamp + 500) / 1000; |
184 size_t payload_size = length - header.headerLength; | 176 size_t payload_size = length - header.headerLength; |
185 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size, | 177 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size, |
186 header, false); | 178 header, false); |
187 } | 179 } |
188 return true; | 180 return true; |
189 } | 181 } |
190 | 182 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 240 |
249 VoiceEngine* AudioReceiveStream::voice_engine() const { | 241 VoiceEngine* AudioReceiveStream::voice_engine() const { |
250 internal::AudioState* audio_state = | 242 internal::AudioState* audio_state = |
251 static_cast<internal::AudioState*>(audio_state_.get()); | 243 static_cast<internal::AudioState*>(audio_state_.get()); |
252 VoiceEngine* voice_engine = audio_state->voice_engine(); | 244 VoiceEngine* voice_engine = audio_state->voice_engine(); |
253 RTC_DCHECK(voice_engine); | 245 RTC_DCHECK(voice_engine); |
254 return voice_engine; | 246 return voice_engine; |
255 } | 247 } |
256 } // namespace internal | 248 } // namespace internal |
257 } // namespace webrtc | 249 } // namespace webrtc |
OLD | NEW |