Reland "rtp sender: don't send BYE on deactivating streams"

This is a reland of commit a22c2a0c581cbe3f612f7a7d9fb9840186cc1e06
after systems depending on this have been fixed.

Original change's description:
> rtp sender: don't send BYE on deactivating streams
>
> as this breaks RTCP assumptions about SSRCs being no longer
> active as defined in
>   https://www.rfc-editor.org/rfc/rfc3550#section-6.6
>
> This should not be sent in reaction to temporarily disabling
> a stream via RTCRtpParameters.active as this does not mean that
> the participant is leaving the session as defined in
>   https://www.rfc-editor.org/rfc/rfc3550#section-6.3.7
> and does not indicate end of participation as defined in
>   https://www.rfc-editor.org/rfc/rfc3550#section-6.1
> which stipulates BYE should be the last packet sent from this SSRC.
>
> BUG=webrtc:11082
>
> Change-Id: Ia5144857f85303643146b0759184f0f3f50b66e4
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273348
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Philipp Hancke <phancke@microsoft.com>
> Cr-Commit-Position: refs/heads/main@{#38059}

Bug: webrtc:11082
Change-Id: Iad8b503b3101d1e684a4da2d1547b879e77b85dd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/293861
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#40716}
This commit is contained in:
Philipp Hancke 2022-08-30 19:53:47 +02:00 committed by WebRTC LUCI CQ
parent 6117d78fbe
commit 8602f604e0
5 changed files with 5 additions and 23 deletions

View File

@ -509,7 +509,6 @@ void RtpVideoSender::SetActiveModulesLocked(
const bool was_active = rtp_module.Sending();
const bool should_be_active = active_modules[i];
// Sends a kRtcpByeCode when going from true to false.
rtp_module.SetSendingStatus(active_modules[i]);
if (was_active && !should_be_active) {

View File

@ -212,23 +212,8 @@ bool RTCPSender::Sending() const {
void RTCPSender::SetSendingStatus(const FeedbackState& feedback_state,
bool sending) {
bool sendRTCPBye = false;
{
MutexLock lock(&mutex_rtcp_sender_);
if (method_ != RtcpMode::kOff) {
if (sending == false && sending_ == true) {
// Trigger RTCP bye
sendRTCPBye = true;
}
}
sending_ = sending;
}
if (sendRTCPBye) {
if (SendRTCP(feedback_state, kRtcpBye) != 0) {
RTC_LOG(LS_WARNING) << "Failed to send RTCP BYE";
}
}
MutexLock lock(&mutex_rtcp_sender_);
sending_ = sending;
}
void RTCPSender::SetNonSenderRttMeasurement(bool enabled) {

View File

@ -328,13 +328,12 @@ TEST_F(RtcpSenderTest, SendBye) {
EXPECT_EQ(kSenderSsrc, parser()->bye()->sender_ssrc());
}
TEST_F(RtcpSenderTest, StopSendingTriggersBye) {
TEST_F(RtcpSenderTest, StopSendingDoesNotTriggersBye) {
auto rtcp_sender = CreateRtcpSender(GetDefaultConfig());
rtcp_sender->SetRTCPStatus(RtcpMode::kReducedSize);
rtcp_sender->SetSendingStatus(feedback_state(), true);
rtcp_sender->SetSendingStatus(feedback_state(), false);
EXPECT_EQ(1, parser()->bye()->num_packets());
EXPECT_EQ(kSenderSsrc, parser()->bye()->sender_ssrc());
EXPECT_EQ(0, parser()->bye()->num_packets());
}
TEST_F(RtcpSenderTest, SendFir) {

View File

@ -296,7 +296,6 @@ RTCPSender::FeedbackState ModuleRtpRtcpImpl::GetFeedbackState() {
int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) {
if (rtcp_sender_.Sending() != sending) {
// Sends RTCP BYE when going from true to false
rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending);
}
return 0;

View File

@ -275,7 +275,7 @@ class RtpRtcpInterface : public RtcpFeedbackSenderInterface {
// Returns the FlexFEC SSRC, if there is one.
virtual absl::optional<uint32_t> FlexfecSsrc() const = 0;
// Sets sending status. Sends kRtcpByeCode when going from true to false.
// Sets sending status.
// Returns -1 on failure else 0.
virtual int32_t SetSendingStatus(bool sending) = 0;