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

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

Issue 2275443002: Minor fixes in FEC and RtpSender{,Video}. (pt. 2) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@header_reader_writer-pt1-move_copy_column
Patch Set: Rebase. Created 4 years, 3 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 10 matching lines...) Expand all
21 #include "webrtc/base/trace_event.h" 21 #include "webrtc/base/trace_event.h"
22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
23 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 23 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
24 #include "webrtc/modules/rtp_rtcp/source/producer_fec.h" 24 #include "webrtc/modules/rtp_rtcp/source/producer_fec.h"
25 #include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h" 25 #include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h"
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 28
29 namespace webrtc { 29 namespace webrtc {
30 30
31 enum { REDForFECHeaderLength = 1 }; 31 namespace {
32 constexpr size_t kRedForFecHeaderLength = 1;
33 } // namespace
32 34
33 RTPSenderVideo::RTPSenderVideo(Clock* clock, RTPSender* rtp_sender) 35 RTPSenderVideo::RTPSenderVideo(Clock* clock, RTPSender* rtp_sender)
34 : rtp_sender_(rtp_sender), 36 : rtp_sender_(rtp_sender),
35 clock_(clock), 37 clock_(clock),
36 // Generic FEC
37 producer_fec_(&fec_),
38 fec_bitrate_(1000, RateStatistics::kBpsScale), 38 fec_bitrate_(1000, RateStatistics::kBpsScale),
39 video_bitrate_(1000, RateStatistics::kBpsScale) {} 39 video_bitrate_(1000, RateStatistics::kBpsScale) {}
40 40
41 RTPSenderVideo::~RTPSenderVideo() {} 41 RTPSenderVideo::~RTPSenderVideo() {}
42 42
43 void RTPSenderVideo::SetVideoCodecType(RtpVideoCodecTypes video_type) { 43 void RTPSenderVideo::SetVideoCodecType(RtpVideoCodecTypes video_type) {
44 video_type_ = video_type; 44 video_type_ = video_type;
45 } 45 }
46 46
47 RtpVideoCodecTypes RTPSenderVideo::VideoCodecType() const { 47 RtpVideoCodecTypes RTPSenderVideo::VideoCodecType() const {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 void RTPSenderVideo::GenericFECStatus(bool* enable, 171 void RTPSenderVideo::GenericFECStatus(bool* enable,
172 uint8_t* payload_type_red, 172 uint8_t* payload_type_red,
173 uint8_t* payload_type_fec) const { 173 uint8_t* payload_type_fec) const {
174 rtc::CritScope cs(&crit_); 174 rtc::CritScope cs(&crit_);
175 *enable = fec_enabled_; 175 *enable = fec_enabled_;
176 *payload_type_red = red_payload_type_; 176 *payload_type_red = red_payload_type_;
177 *payload_type_fec = fec_payload_type_; 177 *payload_type_fec = fec_payload_type_;
178 } 178 }
179 179
180 size_t RTPSenderVideo::FECPacketOverhead() const { 180 size_t RTPSenderVideo::FecPacketOverhead() const {
181 rtc::CritScope cs(&crit_); 181 rtc::CritScope cs(&crit_);
182 size_t overhead = 0; 182 size_t overhead = 0;
183 if (red_payload_type_ != 0) { 183 if (red_payload_type_ != 0) {
184 // Overhead is FEC headers plus RED for FEC header plus anything in RTP 184 // Overhead is FEC headers plus RED for FEC header plus anything in RTP
185 // header beyond the 12 bytes base header (CSRC list, extensions...) 185 // header beyond the 12 bytes base header (CSRC list, extensions...)
186 // This reason for the header extensions to be included here is that 186 // This reason for the header extensions to be included here is that
187 // from an FEC viewpoint, they are part of the payload to be protected. 187 // from an FEC viewpoint, they are part of the payload to be protected.
188 // (The base RTP header is already protected by the FEC header.) 188 // (The base RTP header is already protected by the FEC header.)
189 return ForwardErrorCorrection::PacketOverhead() + REDForFECHeaderLength + 189 return producer_fec_.MaxPacketOverhead() + kRedForFecHeaderLength +
190 (rtp_sender_->RtpHeaderLength() - kRtpHeaderSize); 190 (rtp_sender_->RtpHeaderLength() - kRtpHeaderSize);
191 } 191 }
192 if (fec_enabled_) 192 if (fec_enabled_)
193 overhead += ForwardErrorCorrection::PacketOverhead(); 193 overhead += producer_fec_.MaxPacketOverhead();
194 return overhead; 194 return overhead;
195 } 195 }
196 196
197 void RTPSenderVideo::SetFecParameters(const FecProtectionParams* delta_params, 197 void RTPSenderVideo::SetFecParameters(const FecProtectionParams* delta_params,
198 const FecProtectionParams* key_params) { 198 const FecProtectionParams* key_params) {
199 rtc::CritScope cs(&crit_); 199 rtc::CritScope cs(&crit_);
200 RTC_DCHECK(delta_params); 200 RTC_DCHECK(delta_params);
201 RTC_DCHECK(key_params); 201 RTC_DCHECK(key_params);
202 if (fec_enabled_) { 202 if (fec_enabled_) {
203 delta_fec_params_ = *delta_params; 203 delta_fec_params_ = *delta_params;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 rtc::CritScope cs(&crit_); 343 rtc::CritScope cs(&crit_);
344 return retransmission_settings_; 344 return retransmission_settings_;
345 } 345 }
346 346
347 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { 347 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) {
348 rtc::CritScope cs(&crit_); 348 rtc::CritScope cs(&crit_);
349 retransmission_settings_ = settings; 349 retransmission_settings_ = settings;
350 } 350 }
351 351
352 } // namespace webrtc 352 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender_video.h ('k') | webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698