Reland of Verify sender ssrc when receiving rtcp target bitrate (patchset #1 id:1 of https://codereview.webrtc.org/3005633002/ )

Reason for revert:
Landed fix in upstream project.

Original issue's description:
> Revert of Verify sender ssrc when receiving rtcp target bitrate (patchset #3 id:40001 of https://codereview.webrtc.org/3000373002/ )
>
> Reason for revert:
> Might be the root cause of an internal test failure.
>
> Original issue's description:
> > Verify sender ssrc when receiving rtcp target bitrate
> >
> > BUG=webrtc:8137
> >
> > Review-Url: https://codereview.webrtc.org/3000373002
> > Cr-Commit-Position: refs/heads/master@{#19524}
> > Committed: a7a4beb419
>
> TBR=danilchap@webrtc.org,sprang@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:8137
>
> Review-Url: https://codereview.webrtc.org/3005633002
> Cr-Commit-Position: refs/heads/master@{#19529}
> Committed: 95a64ca8aa

TBR=danilchap@webrtc.org,zhihuang@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:8137

Review-Url: https://codereview.webrtc.org/3006683002
Cr-Commit-Position: refs/heads/master@{#19557}
This commit is contained in:
sprang
2017-08-28 05:49:12 -07:00
committed by Commit Bot
parent 34960de3fb
commit b32aaf97bd
3 changed files with 21 additions and 3 deletions

View File

@ -688,8 +688,10 @@ void RTCPReceiver::HandleXr(const CommonHeader& rtcp_block,
for (const rtcp::ReceiveTimeInfo& time_info : xr.dlrr().sub_blocks()) for (const rtcp::ReceiveTimeInfo& time_info : xr.dlrr().sub_blocks())
HandleXrDlrrReportBlock(time_info); HandleXrDlrrReportBlock(time_info);
if (xr.target_bitrate()) if (xr.target_bitrate()) {
HandleXrTargetBitrate(*xr.target_bitrate(), packet_information); HandleXrTargetBitrate(xr.sender_ssrc(), *xr.target_bitrate(),
packet_information);
}
} }
void RTCPReceiver::HandleXrReceiveReferenceTime(uint32_t sender_ssrc, void RTCPReceiver::HandleXrReceiveReferenceTime(uint32_t sender_ssrc,
@ -722,8 +724,13 @@ void RTCPReceiver::HandleXrDlrrReportBlock(const rtcp::ReceiveTimeInfo& rti) {
} }
void RTCPReceiver::HandleXrTargetBitrate( void RTCPReceiver::HandleXrTargetBitrate(
uint32_t ssrc,
const rtcp::TargetBitrate& target_bitrate, const rtcp::TargetBitrate& target_bitrate,
PacketInformation* packet_information) { PacketInformation* packet_information) {
if (ssrc != remote_ssrc_) {
return; // Not for us.
}
BitrateAllocation bitrate_allocation; BitrateAllocation bitrate_allocation;
for (const auto& item : target_bitrate.GetTargetBitrates()) { for (const auto& item : target_bitrate.GetTargetBitrates()) {
if (item.spatial_layer >= kMaxSpatialLayers || if (item.spatial_layer >= kMaxSpatialLayers ||

View File

@ -165,7 +165,8 @@ class RTCPReceiver {
void HandleXrDlrrReportBlock(const rtcp::ReceiveTimeInfo& rti) void HandleXrDlrrReportBlock(const rtcp::ReceiveTimeInfo& rti)
EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);
void HandleXrTargetBitrate(const rtcp::TargetBitrate& target_bitrate, void HandleXrTargetBitrate(uint32_t ssrc,
const rtcp::TargetBitrate& target_bitrate,
PacketInformation* packet_information) PacketInformation* packet_information)
EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_); EXCLUSIVE_LOCKS_REQUIRED(rtcp_receiver_lock_);

View File

@ -1225,6 +1225,15 @@ TEST_F(RtcpReceiverTest, ReceivesTargetBitrate) {
rtcp::ExtendedReports xr; rtcp::ExtendedReports xr;
xr.SetTargetBitrate(bitrate); xr.SetTargetBitrate(bitrate);
// Wrong sender ssrc, target bitrate should be discarded.
xr.SetSenderSsrc(kSenderSsrc + 1);
EXPECT_CALL(bitrate_allocation_observer_,
OnBitrateAllocationUpdated(expected_allocation))
.Times(0);
InjectRtcpPacket(xr);
// Set correct ssrc, callback should be called once.
xr.SetSenderSsrc(kSenderSsrc);
EXPECT_CALL(bitrate_allocation_observer_, EXPECT_CALL(bitrate_allocation_observer_,
OnBitrateAllocationUpdated(expected_allocation)); OnBitrateAllocationUpdated(expected_allocation));
InjectRtcpPacket(xr); InjectRtcpPacket(xr);
@ -1241,6 +1250,7 @@ TEST_F(RtcpReceiverTest, HandlesIncorrectTargetBitrate) {
rtcp::ExtendedReports xr; rtcp::ExtendedReports xr;
xr.SetTargetBitrate(bitrate); xr.SetTargetBitrate(bitrate);
xr.SetSenderSsrc(kSenderSsrc);
EXPECT_CALL(bitrate_allocation_observer_, EXPECT_CALL(bitrate_allocation_observer_,
OnBitrateAllocationUpdated(expected_allocation)); OnBitrateAllocationUpdated(expected_allocation));