Add hack to RtcpTransceiver to mitigate bug in RtcpReceiver of remote endpoint.

Bug: webrtc:8805
Change-Id: I540ff1d2503ba43723e82800b0bebd322f1af351
Reviewed-on: https://webrtc-review.googlesource.com/44481
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21802}
This commit is contained in:
Danil Chapovalov
2018-01-30 09:56:23 +01:00
committed by Commit Bot
parent f120cba82d
commit 49456a5b33
3 changed files with 73 additions and 9 deletions

View File

@ -402,15 +402,27 @@ std::vector<rtcp::ReportBlock> RtcpTransceiverImpl::CreateReportBlocks(
std::vector<rtcp::ReportBlock> report_blocks =
config_.receive_statistics->RtcpReportBlocks(
rtcp::ReceiverReport::kMaxNumberOfReportBlocks);
uint32_t last_sr = 0;
uint32_t last_delay = 0;
for (rtcp::ReportBlock& report_block : report_blocks) {
auto it = remote_senders_.find(report_block.source_ssrc());
if (it == remote_senders_.end() || !it->second.last_received_sender_report)
if (it == remote_senders_.end() ||
!it->second.last_received_sender_report) {
if (config_.avoid_zero_last_sr_in_last_report_block && last_sr != 0) {
// Simulate behaviour of the RtcpSender to avoid hitting bug in
// RtcpReceiver.
report_block.SetLastSr(last_sr);
report_block.SetDelayLastSr(last_delay);
}
continue;
}
const SenderReportTimes& last_sender_report =
*it->second.last_received_sender_report;
report_block.SetLastSr(CompactNtp(last_sender_report.remote_sent_time));
report_block.SetDelayLastSr(SaturatedUsToCompactNtp(
now_us - last_sender_report.local_received_time_us));
last_sr = CompactNtp(last_sender_report.remote_sent_time);
last_delay = SaturatedUsToCompactNtp(
now_us - last_sender_report.local_received_time_us);
report_block.SetLastSr(last_sr);
report_block.SetDelayLastSr(last_delay);
}
return report_blocks;
}