OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // TODO(pbos): Support multiple RTX, per video payload. | 145 // TODO(pbos): Support multiple RTX, per video payload. |
146 for (const auto& kv : config_.rtp.rtx) { | 146 for (const auto& kv : config_.rtp.rtx) { |
147 RTC_DCHECK(kv.second.ssrc != 0); | 147 RTC_DCHECK(kv.second.ssrc != 0); |
148 RTC_DCHECK(kv.second.payload_type != 0); | 148 RTC_DCHECK(kv.second.payload_type != 0); |
149 | 149 |
150 rtp_payload_registry_.SetRtxSsrc(kv.second.ssrc); | 150 rtp_payload_registry_.SetRtxSsrc(kv.second.ssrc); |
151 rtp_payload_registry_.SetRtxPayloadType(kv.second.payload_type, | 151 rtp_payload_registry_.SetRtxPayloadType(kv.second.payload_type, |
152 kv.first); | 152 kv.first); |
153 } | 153 } |
154 | 154 |
155 // If set to true, the RTX payload type mapping supplied in | |
156 // |SetRtxPayloadType| will be used when restoring RTX packets. Without it, | |
157 // RTX packets will always be restored to the last non-RTX packet payload type | |
158 // received. | |
159 // TODO(holmer): When Chrome no longer depends on this being false by default, | |
160 // always use the mapping and remove this whole codepath. | |
161 rtp_payload_registry_.set_use_rtx_payload_mapping_on_restore( | |
162 config_.rtp.use_rtx_payload_mapping_on_restore); | |
163 | |
164 if (IsFecEnabled()) { | 155 if (IsFecEnabled()) { |
165 VideoCodec ulpfec_codec = {}; | 156 VideoCodec ulpfec_codec = {}; |
166 ulpfec_codec.codecType = kVideoCodecULPFEC; | 157 ulpfec_codec.codecType = kVideoCodecULPFEC; |
167 strncpy(ulpfec_codec.plName, "ulpfec", sizeof(ulpfec_codec.plName)); | 158 strncpy(ulpfec_codec.plName, "ulpfec", sizeof(ulpfec_codec.plName)); |
168 ulpfec_codec.plType = config_.rtp.ulpfec.ulpfec_payload_type; | 159 ulpfec_codec.plType = config_.rtp.ulpfec.ulpfec_payload_type; |
169 RTC_CHECK(SetReceiveCodec(ulpfec_codec)); | 160 RTC_CHECK(SetReceiveCodec(ulpfec_codec)); |
| 161 } |
170 | 162 |
| 163 if (IsRedEnabled()) { |
171 VideoCodec red_codec = {}; | 164 VideoCodec red_codec = {}; |
172 red_codec.codecType = kVideoCodecRED; | 165 red_codec.codecType = kVideoCodecRED; |
173 strncpy(red_codec.plName, "red", sizeof(red_codec.plName)); | 166 strncpy(red_codec.plName, "red", sizeof(red_codec.plName)); |
174 red_codec.plType = config_.rtp.ulpfec.red_payload_type; | 167 red_codec.plType = config_.rtp.ulpfec.red_payload_type; |
175 RTC_CHECK(SetReceiveCodec(red_codec)); | 168 RTC_CHECK(SetReceiveCodec(red_codec)); |
176 if (config_.rtp.ulpfec.red_rtx_payload_type != -1) { | 169 if (config_.rtp.ulpfec.red_rtx_payload_type != -1) { |
177 rtp_payload_registry_.SetRtxPayloadType( | 170 rtp_payload_registry_.SetRtxPayloadType( |
178 config_.rtp.ulpfec.red_rtx_payload_type, | 171 config_.rtp.ulpfec.red_rtx_payload_type, |
179 config_.rtp.ulpfec.red_payload_type); | 172 config_.rtp.ulpfec.red_payload_type); |
180 } | 173 } |
181 // TODO(brandtr): It doesn't seem that |rtp_rtcp_| is used for sending any | |
182 // RTP packets. Investigate if this is the case, and if so, remove this | |
183 // call, since there are no RTP packets to protect with RED+ULPFEC. | |
184 rtp_rtcp_->SetUlpfecConfig(config_.rtp.ulpfec.red_payload_type, | |
185 config_.rtp.ulpfec.ulpfec_payload_type); | |
186 } | 174 } |
187 | 175 |
188 if (config_.rtp.rtcp_xr.receiver_reference_time_report) | 176 if (config_.rtp.rtcp_xr.receiver_reference_time_report) |
189 rtp_rtcp_->SetRtcpXrRrtrStatus(true); | 177 rtp_rtcp_->SetRtcpXrRrtrStatus(true); |
190 | 178 |
191 // Stats callback for CNAME changes. | 179 // Stats callback for CNAME changes. |
192 rtp_rtcp_->RegisterRtcpStatisticsCallback(receive_stats_proxy); | 180 rtp_rtcp_->RegisterRtcpStatisticsCallback(receive_stats_proxy); |
193 | 181 |
194 process_thread_->RegisterModule(rtp_rtcp_.get()); | 182 process_thread_->RegisterModule(rtp_rtcp_.get()); |
195 } | 183 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 return rtp_rtcp_->RequestKeyFrame(); | 320 return rtp_rtcp_->RequestKeyFrame(); |
333 } | 321 } |
334 | 322 |
335 int32_t RtpStreamReceiver::SliceLossIndicationRequest( | 323 int32_t RtpStreamReceiver::SliceLossIndicationRequest( |
336 const uint64_t picture_id) { | 324 const uint64_t picture_id) { |
337 return rtp_rtcp_->SendRTCPSliceLossIndication( | 325 return rtp_rtcp_->SendRTCPSliceLossIndication( |
338 static_cast<uint8_t>(picture_id)); | 326 static_cast<uint8_t>(picture_id)); |
339 } | 327 } |
340 | 328 |
341 bool RtpStreamReceiver::IsFecEnabled() const { | 329 bool RtpStreamReceiver::IsFecEnabled() const { |
342 return config_.rtp.ulpfec.red_payload_type != -1 && | 330 return config_.rtp.ulpfec.ulpfec_payload_type != -1; |
343 config_.rtp.ulpfec.ulpfec_payload_type != -1; | 331 } |
| 332 |
| 333 bool RtpStreamReceiver::IsRedEnabled() const { |
| 334 return config_.rtp.ulpfec.red_payload_type != -1; |
344 } | 335 } |
345 | 336 |
346 bool RtpStreamReceiver::IsRetransmissionsEnabled() const { | 337 bool RtpStreamReceiver::IsRetransmissionsEnabled() const { |
347 return config_.rtp.nack.rtp_history_ms > 0; | 338 return config_.rtp.nack.rtp_history_ms > 0; |
348 } | 339 } |
349 | 340 |
350 void RtpStreamReceiver::RequestPacketRetransmit( | 341 void RtpStreamReceiver::RequestPacketRetransmit( |
351 const std::vector<uint16_t>& sequence_numbers) { | 342 const std::vector<uint16_t>& sequence_numbers) { |
352 rtp_rtcp_->SendNack(sequence_numbers); | 343 rtp_rtcp_->SendNack(sequence_numbers); |
353 } | 344 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 const std::string& extension, int id) { | 529 const std::string& extension, int id) { |
539 // One-byte-extension local identifiers are in the range 1-14 inclusive. | 530 // One-byte-extension local identifiers are in the range 1-14 inclusive. |
540 RTC_DCHECK_GE(id, 1); | 531 RTC_DCHECK_GE(id, 1); |
541 RTC_DCHECK_LE(id, 14); | 532 RTC_DCHECK_LE(id, 14); |
542 RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension)); | 533 RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension)); |
543 RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension( | 534 RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension( |
544 StringToRtpExtensionType(extension), id)); | 535 StringToRtpExtensionType(extension), id)); |
545 } | 536 } |
546 | 537 |
547 } // namespace webrtc | 538 } // namespace webrtc |
OLD | NEW |