Reland "Add ability to set RTCP sender ssrc at construction time"

This reverts commit 8b3e4e2d1166464f6b309f4fc533a29607d2771f.

Reason for revert: The culprit was https://webrtc-review.googlesource.com/c/src/+/133169.

Original change's description:
> Revert "Reland "Add ability to set RTCP sender ssrc at construction time""
> 
> This reverts commit 6f420e424885dab1d9f885365ea9abea5cc4a901.
> 
> Reason for revert: Speculative revert (some perf test are failing)
> 
> Original change's description:
> > Reland "Add ability to set RTCP sender ssrc at construction time"
> >
> > This is a reland of 94c58fd815f0c7c6429aa53a79621ea9ef39c770
> >
> > Patch set 1 is the original CL.
> > Patch set 2 introduced a trivial fix. In RtcpSender::SetSSRC(), check
> > if either current SSRC is 0 or if the SSRC is identical to the current
> > one. If so, don't schedule an early report.
> > This prevents a regression in which audio jitter became too low(?)
> >
> > Original change's description:
> > > Add ability to set RTCP sender ssrc at construction time
> > >
> > > Bug: webrtc:10774
> > > Change-Id: Iaf5857e24359e9795434bcd0cdbe1658a2f9f5d3
> > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144632
> > > Reviewed-by: Åsa Persson <asapersson@webrtc.org>
> > > Commit-Queue: Erik Språng <sprang@webrtc.org>
> > > Cr-Commit-Position: refs/heads/master@{#28506}
> >
> > Bug: webrtc:10774
> > Change-Id: I103dfa48719aa41d6ab633cdac8b3a5c46b54843
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144565
> > Commit-Queue: Erik Språng <sprang@webrtc.org>
> > Reviewed-by: Åsa Persson <asapersson@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#28520}
> 
> TBR=asapersson@webrtc.org,sprang@webrtc.org,ilnik@webrtc.org
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Bug: webrtc:10774
> Change-Id: I39238d942b2bbe0a9c8ca752387a35ed9dd70650
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/145327
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#28555}

TBR=mbonadei@webrtc.org,ilnik@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org

Change-Id: I2e5c17e8edfd938424f901222158643baa04866e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10774
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/145400
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28562}
This commit is contained in:
Mirko Bonadei
2019-07-12 17:32:28 +00:00
committed by Commit Bot
parent 24192c267a
commit 9b1f24d552
6 changed files with 112 additions and 64 deletions

View File

@ -48,6 +48,8 @@ namespace {
const uint32_t kRtcpAnyExtendedReports = kRtcpXrReceiverReferenceTime |
kRtcpXrDlrrReportBlock |
kRtcpXrTargetBitrate;
constexpr int32_t kDefaultVideoReportInterval = 1000;
constexpr int32_t kDefaultAudioReportInterval = 5000;
} // namespace
RTCPSender::FeedbackState::FeedbackState()
@ -112,29 +114,25 @@ class RTCPSender::RtcpContext {
const int64_t now_us_;
};
RTCPSender::RTCPSender(
bool audio,
Clock* clock,
ReceiveStatisticsProvider* receive_statistics,
RtcpPacketTypeCounterObserver* packet_type_counter_observer,
RtcEventLog* event_log,
Transport* outgoing_transport,
int report_interval_ms)
: audio_(audio),
clock_(clock),
RTCPSender::RTCPSender(const RtpRtcp::Configuration& config)
: audio_(config.audio),
clock_(config.clock),
random_(clock_->TimeInMicroseconds()),
method_(RtcpMode::kOff),
event_log_(event_log),
transport_(outgoing_transport),
report_interval_ms_(report_interval_ms),
event_log_(config.event_log),
transport_(config.outgoing_transport),
report_interval_ms_(config.rtcp_report_interval_ms > 0
? config.rtcp_report_interval_ms
: (config.audio ? kDefaultAudioReportInterval
: kDefaultVideoReportInterval)),
sending_(false),
next_time_to_send_rtcp_(0),
timestamp_offset_(0),
last_rtp_timestamp_(0),
last_frame_capture_time_ms_(-1),
ssrc_(0),
ssrc_(config.media_send_ssrc.value_or(0)),
remote_ssrc_(0),
receive_statistics_(receive_statistics),
receive_statistics_(config.receive_statistics),
sequence_number_fir_(0),
@ -150,7 +148,7 @@ RTCPSender::RTCPSender(
app_length_(0),
xr_send_receiver_reference_time_enabled_(false),
packet_type_counter_observer_(packet_type_counter_observer),
packet_type_counter_observer_(config.rtcp_packet_type_counter_observer),
send_video_bitrate_allocation_(false),
last_payload_type_(-1) {
RTC_DCHECK(transport_ != nullptr);
@ -307,7 +305,7 @@ uint32_t RTCPSender::SSRC() const {
void RTCPSender::SetSSRC(uint32_t ssrc) {
rtc::CritScope lock(&critical_section_rtcp_sender_);
if (ssrc_ != 0) {
if (ssrc_ != 0 && ssrc != ssrc_) {
// not first SetSSRC, probably due to a collision
// schedule a new RTCP report
// make sure that we send a RTP packet