From b33b9ccedfdf3a0f1ae58ff3f948c5a4d24b26c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Cervi=C3=B1o?= Date: Wed, 6 Nov 2019 11:01:18 +0100 Subject: [PATCH] Update RTCP SR timestamps in Simulcast (#1489) --- erizo/src/erizo/OneToManyProcessor.cpp | 3 +-- erizo/src/erizo/rtp/QualityFilterHandler.cpp | 8 ++++++-- erizo/src/erizo/rtp/RtpHeaders.h | 6 ++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/erizo/src/erizo/OneToManyProcessor.cpp b/erizo/src/erizo/OneToManyProcessor.cpp index b5c3bd0fc0..4b9d9273ae 100644 --- a/erizo/src/erizo/OneToManyProcessor.cpp +++ b/erizo/src/erizo/OneToManyProcessor.cpp @@ -33,8 +33,7 @@ namespace erizo { RtcpHeader* chead = reinterpret_cast(audio_packet->data); for (it = subscribers.begin(); it != subscribers.end(); ++it) { if ((*it).second != nullptr) { - // Hack to avoid audio drifting in Chrome. - if (chead->isRtcp() && chead->isSDES()) { + if (chead->isRtcp()) { chead->setSSRC((*it).second->getAudioSinkSSRC()); } else { head->setSSRC((*it).second->getAudioSinkSSRC()); diff --git a/erizo/src/erizo/rtp/QualityFilterHandler.cpp b/erizo/src/erizo/rtp/QualityFilterHandler.cpp index 10a0b913ae..edce913496 100644 --- a/erizo/src/erizo/rtp/QualityFilterHandler.cpp +++ b/erizo/src/erizo/rtp/QualityFilterHandler.cpp @@ -220,10 +220,14 @@ void QualityFilterHandler::write(Context *ctx, std::shared_ptr packe tl0_pic_idx_sent : last_tl0_pic_idx_sent_; updateTL0PicIdx(packet, tl0_pic_idx_sent); // removeVP8OptionalPayload(packet); // TODO(javier): uncomment this line in case of issues with pictureId + } else if (is_scalable_ && enabled_ && chead->isRtcp() && chead->isSenderReport()) { + uint32_t ssrc = chead->getSSRC(); + if (video_sink_ssrc_ == ssrc) { + uint32_t sr_timestamp = chead->getTimestamp(); + chead->setTimestamp(sr_timestamp + timestamp_offset_); + } } - // TODO(javier): Handle SRs? - ctx->fireWrite(packet); } diff --git a/erizo/src/erizo/rtp/RtpHeaders.h b/erizo/src/erizo/rtp/RtpHeaders.h index ade26dcc3e..8a88269fa7 100644 --- a/erizo/src/erizo/rtp/RtpHeaders.h +++ b/erizo/src/erizo/rtp/RtpHeaders.h @@ -526,6 +526,12 @@ class RtcpHeader { uint64_t middle = (report.senderReport.ntptimestamp << 16) >> 32; return ntohl(middle); } + inline void setTimestamp(uint32_t timestamp) { + report.senderReport.rtprts = htonl(timestamp); + } + inline uint32_t getTimestamp() { + return ntohl(report.senderReport.rtprts); + } inline uint16_t getNackPid() { return report.nackPacket.nack_block.getNackPid(); }