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

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: 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
11 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h" 11 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h"
12 12
13 #include <stdlib.h> 13 #include <stdlib.h>
14 #include <string.h> 14 #include <string.h>
15 15
16 #include <memory> 16 #include <memory>
17 #include <vector> 17 #include <vector>
18 18
19 #include "webrtc/base/checks.h" 19 #include "webrtc/base/checks.h"
20 #include "webrtc/base/logging.h" 20 #include "webrtc/base/logging.h"
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 {
danilchap 2016/08/23 09:16:11 keep unnammed namespace inside webrtc namespace
brandtr 2016/08/23 09:36:36 Done.
30
danilchap 2016/08/23 09:16:11 probably nicer without extra empty lines when ther
brandtr 2016/08/23 09:36:36 Done.
31 constexpr size_t kRedForFecHeaderLength = 1;
32
33 } // namespace
34
29 namespace webrtc { 35 namespace webrtc {
30 36
31 enum { REDForFECHeaderLength = 1 };
32
33 RTPSenderVideo::RTPSenderVideo(Clock* clock, RTPSender* rtp_sender) 37 RTPSenderVideo::RTPSenderVideo(Clock* clock, RTPSender* rtp_sender)
34 : rtp_sender_(rtp_sender), 38 : rtp_sender_(rtp_sender),
35 clock_(clock), 39 clock_(clock),
36 // Generic FEC
37 producer_fec_(&fec_),
38 fec_bitrate_(1000, RateStatistics::kBpsScale), 40 fec_bitrate_(1000, RateStatistics::kBpsScale),
39 video_bitrate_(1000, RateStatistics::kBpsScale) {} 41 video_bitrate_(1000, RateStatistics::kBpsScale) {}
40 42
41 RTPSenderVideo::~RTPSenderVideo() {} 43 RTPSenderVideo::~RTPSenderVideo() {}
42 44
43 void RTPSenderVideo::SetVideoCodecType(RtpVideoCodecTypes video_type) { 45 void RTPSenderVideo::SetVideoCodecType(RtpVideoCodecTypes video_type) {
44 video_type_ = video_type; 46 video_type_ = video_type;
45 } 47 }
46 48
47 RtpVideoCodecTypes RTPSenderVideo::VideoCodecType() const { 49 RtpVideoCodecTypes RTPSenderVideo::VideoCodecType() const {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 172
171 void RTPSenderVideo::GenericFECStatus(bool* enable, 173 void RTPSenderVideo::GenericFECStatus(bool* enable,
172 uint8_t* payload_type_red, 174 uint8_t* payload_type_red,
173 uint8_t* payload_type_fec) const { 175 uint8_t* payload_type_fec) const {
174 rtc::CritScope cs(&crit_); 176 rtc::CritScope cs(&crit_);
175 *enable = fec_enabled_; 177 *enable = fec_enabled_;
176 *payload_type_red = red_payload_type_; 178 *payload_type_red = red_payload_type_;
177 *payload_type_fec = fec_payload_type_; 179 *payload_type_fec = fec_payload_type_;
178 } 180 }
179 181
180 size_t RTPSenderVideo::FECPacketOverhead() const { 182 size_t RTPSenderVideo::FecPacketOverhead() const {
181 rtc::CritScope cs(&crit_); 183 rtc::CritScope cs(&crit_);
182 size_t overhead = 0; 184 size_t overhead = 0;
183 if (red_payload_type_ != 0) { 185 if (red_payload_type_ != 0) {
184 // Overhead is FEC headers plus RED for FEC header plus anything in RTP 186 // Overhead is FEC headers plus RED for FEC header plus anything in RTP
185 // header beyond the 12 bytes base header (CSRC list, extensions...) 187 // header beyond the 12 bytes base header (CSRC list, extensions...)
186 // This reason for the header extensions to be included here is that 188 // 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. 189 // 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.) 190 // (The base RTP header is already protected by the FEC header.)
189 return ForwardErrorCorrection::PacketOverhead() + REDForFECHeaderLength + 191 return producer_fec_.MaxPacketOverhead() + kRedForFecHeaderLength +
190 (rtp_sender_->RtpHeaderLength() - kRtpHeaderSize); 192 (rtp_sender_->RtpHeaderLength() - kRtpHeaderSize);
191 } 193 }
192 if (fec_enabled_) 194 if (fec_enabled_)
193 overhead += ForwardErrorCorrection::PacketOverhead(); 195 overhead += producer_fec_.MaxPacketOverhead();
194 return overhead; 196 return overhead;
195 } 197 }
196 198
197 void RTPSenderVideo::SetFecParameters(const FecProtectionParams* delta_params, 199 void RTPSenderVideo::SetFecParameters(const FecProtectionParams* delta_params,
198 const FecProtectionParams* key_params) { 200 const FecProtectionParams* key_params) {
199 rtc::CritScope cs(&crit_); 201 rtc::CritScope cs(&crit_);
200 RTC_DCHECK(delta_params); 202 RTC_DCHECK(delta_params);
201 RTC_DCHECK(key_params); 203 RTC_DCHECK(key_params);
202 if (fec_enabled_) { 204 if (fec_enabled_) {
203 delta_fec_params_ = *delta_params; 205 delta_fec_params_ = *delta_params;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 rtc::CritScope cs(&crit_); 345 rtc::CritScope cs(&crit_);
344 return retransmission_settings_; 346 return retransmission_settings_;
345 } 347 }
346 348
347 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { 349 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) {
348 rtc::CritScope cs(&crit_); 350 rtc::CritScope cs(&crit_);
349 retransmission_settings_ = settings; 351 retransmission_settings_ = settings;
350 } 352 }
351 353
352 } // namespace webrtc 354 } // 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