Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc

Issue 2867713003: Remove hardcoded kValueSizeBytes values from variable-length header extensions. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
26 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h" 26 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
29 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h" 29 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
30 30
31 namespace webrtc { 31 namespace webrtc {
32 32
33 namespace { 33 namespace {
34 constexpr size_t kRedForFecHeaderLength = 1; 34 constexpr size_t kRedForFecHeaderLength = 1;
35 35
36 constexpr RTPExtensionSizeInfo kFecExtensionSizes[] = {
danilchap 2017/05/08 16:25:06 how this list is different from kExtensionSizes in
erikvarga1 2017/05/09 11:40:03 Done, I've added a getter for the FEC packets. Al
danilchap 2017/05/09 12:33:49 Do you know such packets? It is generally better t
erikvarga1 2017/05/09 13:30:30 Alright, since it's not used elsewhere, I guess it
37 CreateExtensionSizeInfo<AbsoluteSendTime>(),
38 CreateExtensionSizeInfo<TransmissionOffset>(),
39 CreateExtensionSizeInfo<TransportSequenceNumber>(),
40 CreateExtensionSizeInfo<PlayoutDelayLimits>(),
41 };
42
36 void BuildRedPayload(const RtpPacketToSend& media_packet, 43 void BuildRedPayload(const RtpPacketToSend& media_packet,
37 RtpPacketToSend* red_packet) { 44 RtpPacketToSend* red_packet) {
38 uint8_t* red_payload = red_packet->AllocatePayload( 45 uint8_t* red_payload = red_packet->AllocatePayload(
39 kRedForFecHeaderLength + media_packet.payload_size()); 46 kRedForFecHeaderLength + media_packet.payload_size());
40 RTC_DCHECK(red_payload); 47 RTC_DCHECK(red_payload);
41 red_payload[0] = media_packet.PayloadType(); 48 red_payload[0] = media_packet.PayloadType();
42 49
43 auto media_payload = media_packet.payload(); 50 auto media_payload = media_packet.payload();
44 memcpy(&red_payload[kRedForFecHeaderLength], media_payload.data(), 51 memcpy(&red_payload[kRedForFecHeaderLength], media_payload.data(),
45 media_payload.size()); 52 media_payload.size());
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 249
243 void RTPSenderVideo::GetUlpfecConfig(int* red_payload_type, 250 void RTPSenderVideo::GetUlpfecConfig(int* red_payload_type,
244 int* ulpfec_payload_type) const { 251 int* ulpfec_payload_type) const {
245 rtc::CritScope cs(&crit_); 252 rtc::CritScope cs(&crit_);
246 *red_payload_type = red_payload_type_; 253 *red_payload_type = red_payload_type_;
247 *ulpfec_payload_type = ulpfec_payload_type_; 254 *ulpfec_payload_type = ulpfec_payload_type_;
248 } 255 }
249 256
250 size_t RTPSenderVideo::CalculateFecPacketOverhead() const { 257 size_t RTPSenderVideo::CalculateFecPacketOverhead() const {
251 if (flexfec_enabled()) 258 if (flexfec_enabled())
252 return flexfec_sender_->MaxPacketOverhead(); 259 return flexfec_sender_->MaxPacketOverhead(kFecExtensionSizes);
253 260
254 size_t overhead = 0; 261 size_t overhead = 0;
255 if (red_enabled()) { 262 if (red_enabled()) {
256 // The RED overhead is due to a small header. 263 // The RED overhead is due to a small header.
257 overhead += kRedForFecHeaderLength; 264 overhead += kRedForFecHeaderLength;
258 } 265 }
259 if (ulpfec_enabled()) { 266 if (ulpfec_enabled()) {
260 // For ULPFEC, the overhead is the FEC headers plus RED for FEC header 267 // For ULPFEC, the overhead is the FEC headers plus RED for FEC header
261 // (see above) plus anything in RTP header beyond the 12 bytes base header 268 // (see above) plus anything in RTP header beyond the 12 bytes base header
262 // (CSRC list, extensions...) 269 // (CSRC list, extensions...)
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 rtc::CritScope cs(&crit_); 430 rtc::CritScope cs(&crit_);
424 return retransmission_settings_; 431 return retransmission_settings_;
425 } 432 }
426 433
427 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { 434 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) {
428 rtc::CritScope cs(&crit_); 435 rtc::CritScope cs(&crit_);
429 retransmission_settings_ = settings; 436 retransmission_settings_ = settings;
430 } 437 }
431 438
432 } // namespace webrtc 439 } // namespace webrtc
OLDNEW
« webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('K') | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698