Prevent sender RTCP signals for receive-only channels.

Since RTCP packets are delivered to both senders and receivers that
correspond the receivers currently log that NACKed packets are missing,
since they have no direct connection to the sending side or the RTP
packet history. Also preventing triggering on SR requests and PLI/FIR.

BUG=
R=asapersson@webrtc.org, stefan@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/45249004

Cr-Commit-Position: refs/heads/master@{#9071}
This commit is contained in:
Peter Boström 2015-04-23 17:53:17 +02:00
parent 7f287cca67
commit fe7a80c38c
8 changed files with 29 additions and 15 deletions

View File

@ -54,6 +54,7 @@ class RtpRtcp : public Module {
*/
int32_t id;
bool audio;
bool receiver_only;
Clock* clock;
ReceiveStatistics* receive_statistics;
Transport* outgoing_transport;

View File

@ -96,7 +96,7 @@ void RtcpFormatRembTest::SetUp() {
dummy_rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration);
rtcp_sender_ = new RTCPSender(0, false, system_clock_,
receive_statistics_.get(), NULL);
rtcp_receiver_ = new RTCPReceiver(0, system_clock_, NULL, NULL, NULL,
rtcp_receiver_ = new RTCPReceiver(0, system_clock_, false, NULL, NULL, NULL,
dummy_rtp_rtcp_impl_);
test_transport_ = new TestTransport(rtcp_receiver_);

View File

@ -10,11 +10,12 @@
#include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h"
#include <assert.h> //assert
#include <string.h> //memset
#include <assert.h>
#include <string.h>
#include <algorithm>
#include "webrtc/base/checks.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
@ -31,12 +32,14 @@ const int kRrTimeoutIntervals = 3;
RTCPReceiver::RTCPReceiver(
int32_t id,
Clock* clock,
bool receiver_only,
RtcpPacketTypeCounterObserver* packet_type_counter_observer,
RtcpBandwidthObserver* rtcp_bandwidth_observer,
RtcpIntraFrameObserver* rtcp_intra_frame_observer,
ModuleRtpRtcpImpl* owner)
: TMMBRHelp(),
_clock(clock),
receiver_only_(receiver_only),
_method(kRtcpOff),
_lastReceived(0),
_rtpRtcp(*owner),
@ -781,7 +784,7 @@ void RTCPReceiver::HandleSDESChunk(RTCPUtility::RTCPParserV2& rtcpParser) {
void RTCPReceiver::HandleNACK(RTCPUtility::RTCPParserV2& rtcpParser,
RTCPPacketInformation& rtcpPacketInformation) {
const RTCPUtility::RTCPPacket& rtcpPacket = rtcpParser.Packet();
if (main_ssrc_ != rtcpPacket.NACK.MediaSSRC) {
if (receiver_only_ || main_ssrc_ != rtcpPacket.NACK.MediaSSRC) {
// Not to us.
rtcpParser.Iterate();
return;
@ -1311,16 +1314,18 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
// Might trigger a OnReceivedBandwidthEstimateUpdate.
UpdateTMMBR();
}
unsigned int local_ssrc = 0;
unsigned int local_ssrc;
{
// We don't want to hold this critsect when triggering the callbacks below.
CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
local_ssrc = main_ssrc_;
}
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpSrReq) {
if (!receiver_only_ &&
rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpSrReq) {
_rtpRtcp.OnRequestSendReport();
}
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpNack) {
if (!receiver_only_ &&
rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpNack) {
if (rtcpPacketInformation.nackSequenceNumbers.size() > 0) {
LOG(LS_VERBOSE) << "Incoming NACK length: "
<< rtcpPacketInformation.nackSequenceNumbers.size();
@ -1333,6 +1338,7 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
// report can generate several RTCP packets, based on number relayed/mixed
// a send report block should go out to all receivers.
if (_cbRtcpIntraFrameObserver) {
DCHECK(!receiver_only_);
if ((rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpPli) ||
(rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpFir)) {
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpPli) {
@ -1354,6 +1360,7 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
}
}
if (_cbRtcpBandwidthObserver) {
DCHECK(!receiver_only_);
if (rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRemb) {
LOG(LS_VERBOSE) << "Incoming REMB: "
<< rtcpPacketInformation.receiverEstimatedMaxBitrate;
@ -1371,7 +1378,7 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket(
}
}
{
if (!receiver_only_) {
CriticalSectionScoped cs(_criticalSectionFeedbacks);
if (stats_callback_) {
for (ReportBlockList::const_iterator it =

View File

@ -31,6 +31,7 @@ class RTCPReceiver : public TMMBRHelp
public:
RTCPReceiver(int32_t id,
Clock* clock,
bool receiver_only,
RtcpPacketTypeCounterObserver* packet_type_counter_observer,
RtcpBandwidthObserver* rtcp_bandwidth_observer,
RtcpIntraFrameObserver* rtcp_intra_frame_observer,
@ -231,7 +232,8 @@ protected:
uint32_t remote_ssrc, uint32_t source_ssrc) const
EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver);
Clock* _clock;
Clock* const _clock;
const bool receiver_only_;
RTCPMethod _method;
int64_t _lastReceived;
ModuleRtpRtcpImpl& _rtpRtcp;

View File

@ -84,8 +84,8 @@ class RtcpReceiverTest : public ::testing::Test {
configuration.outgoing_transport = test_transport_;
configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get();
rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration);
rtcp_receiver_ = new RTCPReceiver(0, &system_clock_, NULL, NULL, NULL,
rtp_rtcp_impl_);
rtcp_receiver_ = new RTCPReceiver(0, &system_clock_, false, NULL, NULL,
NULL, rtp_rtcp_impl_);
test_transport_->SetRTCPReceiver(rtcp_receiver_);
}
~RtcpReceiverTest() {

View File

@ -303,8 +303,8 @@ class RtcpSenderTest : public ::testing::Test {
0, &clock_, test_transport_, NULL, rtp_payload_registry_.get()));
rtcp_sender_ =
new RTCPSender(0, false, &clock_, receive_statistics_.get(), NULL);
rtcp_receiver_ = new RTCPReceiver(0, &clock_, NULL, NULL, NULL,
rtp_rtcp_impl_);
rtcp_receiver_ =
new RTCPReceiver(0, &clock_, false, NULL, NULL, NULL, rtp_rtcp_impl_);
test_transport_->SetRTCPReceiver(rtcp_receiver_);
// Initialize
EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(test_transport_));

View File

@ -29,6 +29,7 @@ namespace webrtc {
RtpRtcp::Configuration::Configuration()
: id(-1),
audio(false),
receiver_only(false),
clock(NULL),
receive_statistics(NullObjectReceiveStatistics()),
outgoing_transport(NULL),
@ -74,6 +75,7 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
configuration.rtcp_packet_type_counter_observer),
rtcp_receiver_(configuration.id,
configuration.clock,
configuration.receiver_only,
configuration.rtcp_packet_type_counter_observer,
configuration.bandwidth_callback,
configuration.intra_frame_callback,
@ -85,7 +87,7 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
last_process_time_(configuration.clock->TimeInMilliseconds()),
last_bitrate_process_time_(configuration.clock->TimeInMilliseconds()),
last_rtt_process_time_(configuration.clock->TimeInMilliseconds()),
packet_overhead_(28), // IPV4 UDP.
packet_overhead_(28), // IPV4 UDP.
padding_index_(static_cast<size_t>(-1)), // Start padding at first child.
nack_method_(kNackOff),
nack_last_time_sent_full_(0),

View File

@ -1851,8 +1851,10 @@ RtpRtcp::Configuration ViEChannel::CreateRtpRtcpConfiguration() {
RtpRtcp::Configuration configuration;
configuration.id = ViEModuleId(engine_id_, channel_id_);
configuration.audio = false;
configuration.receiver_only = !sender_;
configuration.outgoing_transport = &vie_sender_;
configuration.intra_frame_callback = intra_frame_observer_;
if (sender_)
configuration.intra_frame_callback = intra_frame_observer_;
configuration.rtt_stats = rtt_stats_;
configuration.rtcp_packet_type_counter_observer =
&rtcp_packet_type_counter_observer_;