Remove the audio/video split for the RTCP report intervals.

This is a follow up of a comment in
https://webrtc-review.googlesource.com/c/src/+/110105

It was not very useful to split the audio and video report interval since the RTCP module can only either be audio or video.

The recent it was written that way in https://webrtc-review.googlesource.com/c/src/+/43201/ was because that was a straightforward transition from two global constants to two variable.

Bug: webrtc:8789
Change-Id: I2293de14ba5f363351f379a02022ed5dc7b8d458
Reviewed-on: https://webrtc-review.googlesource.com/c/110824
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Jiawei Ou <ouj@fb.com>
Cr-Commit-Position: refs/heads/master@{#25741}
This commit is contained in:
Jiawei Ou
2018-11-15 16:44:37 -08:00
committed by Commit Bot
parent 4a2dd7ac7e
commit 8b5d9d8650
15 changed files with 84 additions and 102 deletions

View File

@ -742,8 +742,7 @@ ChannelSend::ChannelSend(rtc::TaskQueue* encoder_queue,
configuration.retransmission_rate_limiter =
retransmission_rate_limiter_.get();
configuration.extmap_allow_mixed = extmap_allow_mixed;
configuration.rtcp_interval_config.audio_interval_ms =
rtcp_report_interval_ms;
configuration.rtcp_report_interval_ms = rtcp_report_interval_ms;
_rtpRtcpModule.reset(RtpRtcp::CreateRtpRtcp(configuration));
_rtpRtcpModule->SetSendingMediaStatus(false);

View File

@ -86,8 +86,7 @@ std::vector<std::unique_ptr<RtpRtcp>> CreateRtpRtcpModules(
configuration.require_frame_encryption =
crypto_options.sframe.require_frame_encryption;
configuration.extmap_allow_mixed = rtp_config.extmap_allow_mixed;
configuration.rtcp_interval_config.video_interval_ms =
rtcp_report_interval_ms;
configuration.rtcp_report_interval_ms = rtcp_report_interval_ms;
std::vector<std::unique_ptr<RtpRtcp>> modules;
const std::vector<uint32_t>& flexfec_protected_ssrcs =

View File

@ -93,7 +93,8 @@ class RtpRtcp : public Module, public RtcpFeedbackSenderInterface {
RateLimiter* retransmission_rate_limiter = nullptr;
OverheadObserver* overhead_observer = nullptr;
RtpKeepAliveConfig keepalive_config;
RtcpIntervalConfig rtcp_interval_config;
int rtcp_report_interval_ms = 0;
// Update network2 instead of pacer_exit field of video timing extension.
bool populate_network2_timestamp = false;

View File

@ -41,15 +41,6 @@ const int kBogusRtpRateForAudioRtcp = 8000;
// Minimum RTP header size in bytes.
const uint8_t kRtpHeaderSize = 12;
struct RtcpIntervalConfig final {
RtcpIntervalConfig() = default;
RtcpIntervalConfig(int64_t video_interval_ms, int64_t audio_interval_ms)
: video_interval_ms(video_interval_ms),
audio_interval_ms(audio_interval_ms) {}
int64_t video_interval_ms = 1000;
int64_t audio_interval_ms = 5000;
};
struct AudioPayload {
SdpAudioFormat format;
uint32_t rate;

View File

@ -131,6 +131,7 @@ RTCPReceiver::RTCPReceiver(
RtcpIntraFrameObserver* rtcp_intra_frame_observer,
TransportFeedbackObserver* transport_feedback_observer,
VideoBitrateAllocationObserver* bitrate_allocation_observer,
int report_interval_ms,
ModuleRtpRtcp* owner)
: clock_(clock),
receiver_only_(receiver_only),
@ -139,6 +140,7 @@ RTCPReceiver::RTCPReceiver(
rtcp_intra_frame_observer_(rtcp_intra_frame_observer),
transport_feedback_observer_(transport_feedback_observer),
bitrate_allocation_observer_(bitrate_allocation_observer),
report_interval_ms_(report_interval_ms),
main_ssrc_(0),
remote_ssrc_(0),
remote_sender_rtp_time_(0),
@ -561,12 +563,12 @@ RTCPReceiver::TmmbrInformation* RTCPReceiver::GetTmmbrInformation(
return &it->second;
}
bool RTCPReceiver::RtcpRrTimeout(int64_t rtcp_interval_ms) {
bool RTCPReceiver::RtcpRrTimeout() {
rtc::CritScope lock(&rtcp_receiver_lock_);
if (last_received_rb_ms_ == 0)
return false;
int64_t time_out_ms = kRrTimeoutIntervals * rtcp_interval_ms;
int64_t time_out_ms = kRrTimeoutIntervals * report_interval_ms_;
if (clock_->TimeInMilliseconds() > last_received_rb_ms_ + time_out_ms) {
// Reset the timer to only trigger one log.
last_received_rb_ms_ = 0;
@ -575,12 +577,12 @@ bool RTCPReceiver::RtcpRrTimeout(int64_t rtcp_interval_ms) {
return false;
}
bool RTCPReceiver::RtcpRrSequenceNumberTimeout(int64_t rtcp_interval_ms) {
bool RTCPReceiver::RtcpRrSequenceNumberTimeout() {
rtc::CritScope lock(&rtcp_receiver_lock_);
if (last_increased_sequence_number_ms_ == 0)
return false;
int64_t time_out_ms = kRrTimeoutIntervals * rtcp_interval_ms;
int64_t time_out_ms = kRrTimeoutIntervals * report_interval_ms_;
if (clock_->TimeInMilliseconds() >
last_increased_sequence_number_ms_ + time_out_ms) {
// Reset the timer to only trigger one log.

View File

@ -56,6 +56,7 @@ class RTCPReceiver {
RtcpIntraFrameObserver* rtcp_intra_frame_observer,
TransportFeedbackObserver* transport_feedback_observer,
VideoBitrateAllocationObserver* bitrate_allocation_observer,
int report_interval_ms,
ModuleRtpRtcp* owner);
virtual ~RTCPReceiver();
@ -94,13 +95,13 @@ class RTCPReceiver {
// Returns true if we haven't received an RTCP RR for several RTCP
// intervals, but only triggers true once.
bool RtcpRrTimeout(int64_t rtcp_interval_ms);
bool RtcpRrTimeout();
// Returns true if we haven't received an RTCP RR telling the receive side
// has not received RTP packets for too long, i.e. extended highest sequence
// number hasn't increased for several RTCP intervals. The function only
// returns true once until a new RR is received.
bool RtcpRrSequenceNumberTimeout(int64_t rtcp_interval_ms);
bool RtcpRrSequenceNumberTimeout();
std::vector<rtcp::TmmbItem> TmmbrReceived();
// Return true if new bandwidth should be set.
@ -215,6 +216,7 @@ class RTCPReceiver {
RtcpIntraFrameObserver* const rtcp_intra_frame_observer_;
TransportFeedbackObserver* const transport_feedback_observer_;
VideoBitrateAllocationObserver* const bitrate_allocation_observer_;
const int report_interval_ms_;
rtc::CriticalSection rtcp_receiver_lock_;
uint32_t main_ssrc_ RTC_GUARDED_BY(rtcp_receiver_lock_);

View File

@ -107,6 +107,8 @@ constexpr uint32_t kReceiverExtraSsrc = 0x1234567;
constexpr uint32_t kNotToUsSsrc = 0x654321;
constexpr uint32_t kUnknownSenderSsrc = 0x54321;
constexpr int64_t kRtcpIntervalMs = 1000;
} // namespace
class RtcpReceiverTest : public ::testing::Test {
@ -120,6 +122,7 @@ class RtcpReceiverTest : public ::testing::Test {
&intra_frame_observer_,
&transport_feedback_observer_,
&bitrate_allocation_observer_,
kRtcpIntervalMs,
&rtp_rtcp_impl_) {}
void SetUp() {
std::set<uint32_t> ssrcs = {kReceiverMainSsrc, kReceiverExtraSsrc};
@ -941,13 +944,12 @@ TEST_F(RtcpReceiverTest, StoresLastReceivedRrtrPerSsrc) {
}
TEST_F(RtcpReceiverTest, ReceiveReportTimeout) {
const int64_t kRtcpIntervalMs = 1000;
const uint16_t kSequenceNumber = 1234;
system_clock_.AdvanceTimeMilliseconds(3 * kRtcpIntervalMs);
// No RR received, shouldn't trigger a timeout.
EXPECT_FALSE(rtcp_receiver_.RtcpRrTimeout(kRtcpIntervalMs));
EXPECT_FALSE(rtcp_receiver_.RtcpRrSequenceNumberTimeout(kRtcpIntervalMs));
EXPECT_FALSE(rtcp_receiver_.RtcpRrTimeout());
EXPECT_FALSE(rtcp_receiver_.RtcpRrSequenceNumberTimeout());
// Add a RR and advance the clock just enough to not trigger a timeout.
rtcp::ReportBlock rb1;
@ -962,8 +964,8 @@ TEST_F(RtcpReceiverTest, ReceiveReportTimeout) {
InjectRtcpPacket(rr1);
system_clock_.AdvanceTimeMilliseconds(3 * kRtcpIntervalMs - 1);
EXPECT_FALSE(rtcp_receiver_.RtcpRrTimeout(kRtcpIntervalMs));
EXPECT_FALSE(rtcp_receiver_.RtcpRrSequenceNumberTimeout(kRtcpIntervalMs));
EXPECT_FALSE(rtcp_receiver_.RtcpRrTimeout());
EXPECT_FALSE(rtcp_receiver_.RtcpRrSequenceNumberTimeout());
// Add a RR with the same extended max as the previous RR to trigger a
// sequence number timeout, but not a RR timeout.
@ -972,17 +974,17 @@ TEST_F(RtcpReceiverTest, ReceiveReportTimeout) {
InjectRtcpPacket(rr1);
system_clock_.AdvanceTimeMilliseconds(2);
EXPECT_FALSE(rtcp_receiver_.RtcpRrTimeout(kRtcpIntervalMs));
EXPECT_TRUE(rtcp_receiver_.RtcpRrSequenceNumberTimeout(kRtcpIntervalMs));
EXPECT_FALSE(rtcp_receiver_.RtcpRrTimeout());
EXPECT_TRUE(rtcp_receiver_.RtcpRrSequenceNumberTimeout());
// Advance clock enough to trigger an RR timeout too.
system_clock_.AdvanceTimeMilliseconds(3 * kRtcpIntervalMs);
EXPECT_TRUE(rtcp_receiver_.RtcpRrTimeout(kRtcpIntervalMs));
EXPECT_TRUE(rtcp_receiver_.RtcpRrTimeout());
// We should only get one timeout even though we still haven't received a new
// RR.
EXPECT_FALSE(rtcp_receiver_.RtcpRrTimeout(kRtcpIntervalMs));
EXPECT_FALSE(rtcp_receiver_.RtcpRrSequenceNumberTimeout(kRtcpIntervalMs));
EXPECT_FALSE(rtcp_receiver_.RtcpRrTimeout());
EXPECT_FALSE(rtcp_receiver_.RtcpRrSequenceNumberTimeout());
// Add a new RR with increase sequence number to reset timers.
rtcp::ReportBlock rb2;
@ -996,8 +998,8 @@ TEST_F(RtcpReceiverTest, ReceiveReportTimeout) {
EXPECT_CALL(bandwidth_observer_, OnReceivedRtcpReceiverReport(_, _, _));
InjectRtcpPacket(rr2);
EXPECT_FALSE(rtcp_receiver_.RtcpRrTimeout(kRtcpIntervalMs));
EXPECT_FALSE(rtcp_receiver_.RtcpRrSequenceNumberTimeout(kRtcpIntervalMs));
EXPECT_FALSE(rtcp_receiver_.RtcpRrTimeout());
EXPECT_FALSE(rtcp_receiver_.RtcpRrSequenceNumberTimeout());
// Verify we can get a timeout again once we've received new RR.
system_clock_.AdvanceTimeMilliseconds(2 * kRtcpIntervalMs);
@ -1006,11 +1008,11 @@ TEST_F(RtcpReceiverTest, ReceiveReportTimeout) {
InjectRtcpPacket(rr2);
system_clock_.AdvanceTimeMilliseconds(kRtcpIntervalMs + 1);
EXPECT_FALSE(rtcp_receiver_.RtcpRrTimeout(kRtcpIntervalMs));
EXPECT_TRUE(rtcp_receiver_.RtcpRrSequenceNumberTimeout(kRtcpIntervalMs));
EXPECT_FALSE(rtcp_receiver_.RtcpRrTimeout());
EXPECT_TRUE(rtcp_receiver_.RtcpRrSequenceNumberTimeout());
system_clock_.AdvanceTimeMilliseconds(2 * kRtcpIntervalMs);
EXPECT_TRUE(rtcp_receiver_.RtcpRrTimeout(kRtcpIntervalMs));
EXPECT_TRUE(rtcp_receiver_.RtcpRrTimeout());
}
TEST_F(RtcpReceiverTest, TmmbrReceivedWithNoIncomingPacket) {

View File

@ -11,6 +11,7 @@
#include "modules/rtp_rtcp/source/rtcp_sender.h"
#include <string.h> // memcpy
#include <algorithm> // std::min
#include <utility>
@ -118,14 +119,14 @@ RTCPSender::RTCPSender(
RtcpPacketTypeCounterObserver* packet_type_counter_observer,
RtcEventLog* event_log,
Transport* outgoing_transport,
RtcpIntervalConfig interval_config)
int report_interval_ms)
: audio_(audio),
clock_(clock),
random_(clock_->TimeInMicroseconds()),
method_(RtcpMode::kOff),
event_log_(event_log),
transport_(outgoing_transport),
interval_config_(interval_config),
report_interval_ms_(report_interval_ms),
sending_(false),
next_time_to_send_rtcp_(0),
timestamp_offset_(0),
@ -180,9 +181,8 @@ void RTCPSender::SetRTCPStatus(RtcpMode new_method) {
if (method_ == RtcpMode::kOff && new_method != RtcpMode::kOff) {
// When switching on, reschedule the next packet
int64_t interval_ms = audio_ ? interval_config_.audio_interval_ms
: interval_config_.video_interval_ms;
next_time_to_send_rtcp_ = clock_->TimeInMilliseconds() + (interval_ms / 2);
next_time_to_send_rtcp_ =
clock_->TimeInMilliseconds() + (report_interval_ms_ / 2);
}
method_ = new_method;
}
@ -765,28 +765,24 @@ void RTCPSender::PrepareReport(const FeedbackState& feedback_state) {
}
// generate next time to send an RTCP report
uint32_t minIntervalMs =
rtc::dchecked_cast<uint32_t>(interval_config_.audio_interval_ms);
int min_interval_ms = report_interval_ms_;
if (!audio_) {
if (sending_) {
if (!audio_ && sending_) {
// Calculate bandwidth for video; 360 / send bandwidth in kbit/s.
uint32_t send_bitrate_kbit = feedback_state.send_bitrate / 1000;
if (send_bitrate_kbit != 0)
minIntervalMs = 360000 / send_bitrate_kbit;
}
if (minIntervalMs >
rtc::dchecked_cast<uint32_t>(interval_config_.video_interval_ms)) {
minIntervalMs =
rtc::dchecked_cast<uint32_t>(interval_config_.video_interval_ms);
int send_bitrate_kbit = feedback_state.send_bitrate / 1000;
if (send_bitrate_kbit != 0) {
min_interval_ms = 360000 / send_bitrate_kbit;
min_interval_ms = std::min(min_interval_ms, report_interval_ms_);
}
}
// The interval between RTCP packets is varied randomly over the
// range [1/2,3/2] times the calculated interval.
uint32_t timeToNext =
random_.Rand(minIntervalMs * 1 / 2, minIntervalMs * 3 / 2);
next_time_to_send_rtcp_ = clock_->TimeInMilliseconds() + timeToNext;
int time_to_next =
random_.Rand(min_interval_ms * 1 / 2, min_interval_ms * 3 / 2);
RTC_DCHECK_GT(time_to_next, 0);
next_time_to_send_rtcp_ = clock_->TimeInMilliseconds() + time_to_next;
// RtcpSender expected to be used for sending either just sender reports
// or just receiver reports.
@ -966,12 +962,4 @@ bool RTCPSender::SendFeedbackPacket(const rtcp::TransportFeedback& packet) {
return packet.Build(max_packet_size, callback) && !send_failure;
}
int64_t RTCPSender::RtcpAudioReportInverval() const {
return interval_config_.audio_interval_ms;
}
int64_t RTCPSender::RtcpVideoReportInverval() const {
return interval_config_.video_interval_ms;
}
} // namespace webrtc

View File

@ -68,7 +68,7 @@ class RTCPSender {
RtcpPacketTypeCounterObserver* packet_type_counter_observer,
RtcEventLog* event_log,
Transport* outgoing_transport,
RtcpIntervalConfig interval_config);
int report_interval_ms);
virtual ~RTCPSender();
RtcpMode Status() const;
@ -141,9 +141,6 @@ class RTCPSender {
void SetVideoBitrateAllocation(const VideoBitrateAllocation& bitrate);
bool SendFeedbackPacket(const rtcp::TransportFeedback& packet);
int64_t RtcpAudioReportInverval() const;
int64_t RtcpVideoReportInverval() const;
private:
class RtcpContext;
@ -190,7 +187,7 @@ class RTCPSender {
RtcEventLog* const event_log_;
Transport* const transport_;
const RtcpIntervalConfig interval_config_;
const int report_interval_ms_;
rtc::CriticalSection critical_section_rtcp_sender_;
bool sending_ RTC_GUARDED_BY(critical_section_rtcp_sender_);

View File

@ -79,11 +79,12 @@ class RtcpSenderTest : public ::testing::Test {
configuration.clock = &clock_;
configuration.outgoing_transport = &test_transport_;
configuration.retransmission_rate_limiter = &retransmission_rate_limiter_;
configuration.rtcp_report_interval_ms = 1000;
rtp_rtcp_impl_.reset(new ModuleRtpRtcpImpl(configuration));
rtcp_sender_.reset(new RTCPSender(false, &clock_, receive_statistics_.get(),
nullptr, nullptr, &test_transport_,
configuration.rtcp_interval_config));
configuration.rtcp_report_interval_ms));
rtcp_sender_->SetSSRC(kSenderSsrc);
rtcp_sender_->SetRemoteSSRC(kRemoteSsrc);
rtcp_sender_->SetTimestampOffset(kStartRtpTimestamp);
@ -186,8 +187,7 @@ TEST_F(RtcpSenderTest, SendConsecutiveSrWithExactSlope) {
TEST_F(RtcpSenderTest, DoNotSendSrBeforeRtp) {
rtcp_sender_.reset(new RTCPSender(false, &clock_, receive_statistics_.get(),
nullptr, nullptr, &test_transport_,
RtcpIntervalConfig{}));
nullptr, nullptr, &test_transport_, 1000));
rtcp_sender_->SetSSRC(kSenderSsrc);
rtcp_sender_->SetRemoteSSRC(kRemoteSsrc);
rtcp_sender_->SetRTCPStatus(RtcpMode::kReducedSize);
@ -205,8 +205,7 @@ TEST_F(RtcpSenderTest, DoNotSendSrBeforeRtp) {
TEST_F(RtcpSenderTest, DoNotSendCompundBeforeRtp) {
rtcp_sender_.reset(new RTCPSender(false, &clock_, receive_statistics_.get(),
nullptr, nullptr, &test_transport_,
RtcpIntervalConfig{}));
nullptr, nullptr, &test_transport_, 1000));
rtcp_sender_->SetSSRC(kSenderSsrc);
rtcp_sender_->SetRemoteSSRC(kRemoteSsrc);
rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound);
@ -507,7 +506,7 @@ TEST_F(RtcpSenderTest, TestRegisterRtcpPacketTypeObserver) {
RtcpPacketTypeCounterObserverImpl observer;
rtcp_sender_.reset(new RTCPSender(false, &clock_, receive_statistics_.get(),
&observer, nullptr, &test_transport_,
RtcpIntervalConfig{}));
1000));
rtcp_sender_->SetRemoteSSRC(kRemoteSsrc);
rtcp_sender_->SetRTCPStatus(RtcpMode::kReducedSize);
EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpPli));
@ -629,8 +628,7 @@ TEST_F(RtcpSenderTest, ByeMustBeLast) {
// Re-configure rtcp_sender_ with mock_transport_
rtcp_sender_.reset(new RTCPSender(false, &clock_, receive_statistics_.get(),
nullptr, nullptr, &mock_transport,
RtcpIntervalConfig{}));
nullptr, nullptr, &mock_transport, 1000));
rtcp_sender_->SetSSRC(kSenderSsrc);
rtcp_sender_->SetRemoteSSRC(kRemoteSsrc);
rtcp_sender_->SetTimestampOffset(kStartRtpTimestamp);

View File

@ -33,6 +33,8 @@ const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5;
const int64_t kRtpRtcpRttProcessTimeMs = 1000;
const int64_t kRtpRtcpBitrateProcessTimeMs = 10;
const int64_t kDefaultExpectedRetransmissionTimeMs = 125;
constexpr int32_t kDefaultVideoReportInterval = 1000;
constexpr int32_t kDefaultAudioReportInterval = 5000;
} // namespace
RtpRtcp::Configuration::Configuration() = default;
@ -64,7 +66,10 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
configuration.rtcp_packet_type_counter_observer,
configuration.event_log,
configuration.outgoing_transport,
configuration.rtcp_interval_config),
configuration.rtcp_report_interval_ms > 0
? configuration.rtcp_report_interval_ms
: (configuration.audio ? kDefaultAudioReportInterval
: kDefaultVideoReportInterval)),
rtcp_receiver_(configuration.clock,
configuration.receiver_only,
configuration.rtcp_packet_type_counter_observer,
@ -72,6 +77,10 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
configuration.intra_frame_callback,
configuration.transport_feedback_callback,
configuration.bitrate_allocation_observer,
configuration.rtcp_report_interval_ms > 0
? configuration.rtcp_report_interval_ms
: (configuration.audio ? kDefaultAudioReportInterval
: kDefaultVideoReportInterval),
this),
clock_(configuration.clock),
audio_(configuration.audio),
@ -179,10 +188,9 @@ void ModuleRtpRtcpImpl::Process() {
// Verify receiver reports are delivered and the reported sequence number
// is increasing.
int64_t rtcp_interval = RtcpReportInterval();
if (rtcp_receiver_.RtcpRrTimeout(rtcp_interval)) {
if (rtcp_receiver_.RtcpRrTimeout()) {
RTC_LOG_F(LS_WARNING) << "Timeout: No RTCP RR received.";
} else if (rtcp_receiver_.RtcpRrSequenceNumberTimeout(rtcp_interval)) {
} else if (rtcp_receiver_.RtcpRrSequenceNumberTimeout()) {
RTC_LOG_F(LS_WARNING) << "Timeout: No increase in RTCP RR extended "
"highest sequence number.";
}
@ -859,13 +867,6 @@ std::vector<rtcp::TmmbItem> ModuleRtpRtcpImpl::BoundingSet(bool* tmmbr_owner) {
return rtcp_receiver_.BoundingSet(tmmbr_owner);
}
int64_t ModuleRtpRtcpImpl::RtcpReportInterval() {
if (audio_)
return rtcp_sender_.RtcpAudioReportInverval();
else
return rtcp_sender_.RtcpVideoReportInverval();
}
void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) {
std::set<uint32_t> ssrcs;
ssrcs.insert(main_ssrc);

View File

@ -326,7 +326,6 @@ class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp {
private:
FRIEND_TEST_ALL_PREFIXES(RtpRtcpImplTest, Rtt);
FRIEND_TEST_ALL_PREFIXES(RtpRtcpImplTest, RttForReceiverOnly);
int64_t RtcpReportInterval();
void SetRtcpReceiverSsrcs(uint32_t main_ssrc);
void set_rtt_ms(int64_t rtt_ms);

View File

@ -124,7 +124,7 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver {
std::unique_ptr<ModuleRtpRtcpImpl> impl_;
uint32_t remote_ssrc_;
RtpKeepAliveConfig keepalive_config_;
RtcpIntervalConfig rtcp_interval_config_;
int rtcp_report_interval_ms_ = 0;
void SetRemoteSsrc(uint32_t ssrc) {
remote_ssrc_ = ssrc;
@ -159,8 +159,8 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver {
CreateModuleImpl();
transport_.SetKeepalivePayloadType(config.payload_type);
}
void SetRtcpIntervalConfigAndReset(const RtcpIntervalConfig& config) {
rtcp_interval_config_ = config;
void SetRtcpReportIntervalAndReset(int rtcp_report_interval_ms) {
rtcp_report_interval_ms_ = rtcp_report_interval_ms;
CreateModuleImpl();
}
@ -174,7 +174,7 @@ class RtpRtcpModule : public RtcpPacketTypeCounterObserver {
config.rtcp_packet_type_counter_observer = this;
config.rtt_stats = &rtt_stats_;
config.keepalive_config = keepalive_config_;
config.rtcp_interval_config = rtcp_interval_config_;
config.rtcp_report_interval_ms = rtcp_report_interval_ms_;
impl_.reset(new ModuleRtpRtcpImpl(config));
impl_->SetRTCPStatus(RtcpMode::kCompound);
@ -643,11 +643,8 @@ TEST_F(RtpRtcpImplTest, SendsKeepaliveAfterTimout) {
TEST_F(RtpRtcpImplTest, ConfigurableRtcpReportInterval) {
const int kVideoReportInterval = 3000;
RtcpIntervalConfig config;
config.video_interval_ms = kVideoReportInterval;
// Recreate sender impl with new configuration, and redo setup.
sender_.SetRtcpIntervalConfigAndReset(config);
sender_.SetRtcpReportIntervalAndReset(kVideoReportInterval);
SetUp();
SendFrame(&sender_, kBaseLayerTid);

View File

@ -15,6 +15,8 @@
namespace webrtc {
namespace {
constexpr int kRtcpIntervalMs = 1000;
class NullModuleRtpRtcp : public RTCPReceiver::ModuleRtpRtcp {
public:
void SetTmmbn(std::vector<rtcp::TmmbItem>) override {}
@ -30,7 +32,7 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
SimulatedClock clock(1234);
RTCPReceiver receiver(&clock, false, nullptr, nullptr, nullptr, nullptr,
nullptr, &rtp_rtcp_module);
nullptr, kRtcpIntervalMs, &rtp_rtcp_module);
receiver.IncomingPacket(data, size);
}

View File

@ -69,10 +69,14 @@ class VideoSendStreamPeer {
};
} // namespace test
namespace {
constexpr int64_t kRtcpIntervalMs = 1000;
enum VideoFormat {
kGeneric,
kVP8,
};
} // namespace
void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1,
const std::vector<VideoFrame>& frames2);
@ -885,7 +889,7 @@ void VideoSendStreamTest::TestNackRetransmission(
RTCPSender rtcp_sender(false, Clock::GetRealTimeClock(), nullptr,
nullptr, nullptr, transport_adapter_.get(),
RtcpIntervalConfig{});
kRtcpIntervalMs);
rtcp_sender.SetRTCPStatus(RtcpMode::kReducedSize);
rtcp_sender.SetRemoteSSRC(kVideoSendSsrcs[0]);
@ -1099,7 +1103,7 @@ void VideoSendStreamTest::TestPacketFragmentationSize(VideoFormat format,
loss_ratio); // Loss percent.
RTCPSender rtcp_sender(false, Clock::GetRealTimeClock(),
&lossy_receive_stats, nullptr, nullptr,
transport_adapter_.get(), RtcpIntervalConfig{});
transport_adapter_.get(), kRtcpIntervalMs);
rtcp_sender.SetRTCPStatus(RtcpMode::kReducedSize);
rtcp_sender.SetRemoteSSRC(kVideoSendSsrcs[0]);
@ -1334,7 +1338,7 @@ TEST_P(VideoSendStreamTest, SuspendBelowMinBitrate) {
FakeReceiveStatistics receive_stats(kVideoSendSsrcs[0],
last_sequence_number_, rtp_count_, 0);
RTCPSender rtcp_sender(false, clock_, &receive_stats, nullptr, nullptr,
transport_adapter_.get(), RtcpIntervalConfig{});
transport_adapter_.get(), kRtcpIntervalMs);
rtcp_sender.SetRTCPStatus(RtcpMode::kReducedSize);
rtcp_sender.SetRemoteSSRC(kVideoSendSsrcs[0]);