Skip to content

Commit

Permalink
Put back audio delay hack and add stats (lynckia#1550)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodoyun authored Mar 6, 2020
1 parent d9f3e42 commit 4acc42d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions erizo/src/erizo/MediaStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ void MediaStream::initializeStats() {
log_stats_->getNode().insertStat("audioMuted", CumulativeStat{0});
log_stats_->getNode().insertStat("audioNack", CumulativeStat{0});
log_stats_->getNode().insertStat("audioRemb", CumulativeStat{0});
log_stats_->getNode().insertStat("audioSrTimestamp", CumulativeStat{0});
log_stats_->getNode().insertStat("audioSrNtp", CumulativeStat{0});

log_stats_->getNode().insertStat("videoBitrate", CumulativeStat{0});
log_stats_->getNode().insertStat("videoFL", CumulativeStat{0});
Expand All @@ -270,6 +272,8 @@ void MediaStream::initializeStats() {
log_stats_->getNode().insertStat("videoRemb", CumulativeStat{0});
log_stats_->getNode().insertStat("videoErizoRemb", CumulativeStat{0});
log_stats_->getNode().insertStat("videoKeyFrames", CumulativeStat{0});
log_stats_->getNode().insertStat("videoSrTimestamp", CumulativeStat{0});
log_stats_->getNode().insertStat("videoSrNtp", CumulativeStat{0});

log_stats_->getNode().insertStat("SL0TL0", CumulativeStat{0});
log_stats_->getNode().insertStat("SL0TL1", CumulativeStat{0});
Expand Down Expand Up @@ -352,6 +356,8 @@ void MediaStream::printStats() {
transferMediaStats("audioMuted", audio_ssrc, "erizoAudioMute");
transferMediaStats("audioNack", audio_ssrc, "NACK");
transferMediaStats("audioRemb", audio_ssrc, "bandwidth");
transferMediaStats("audioSrTimestamp", audio_ssrc, "srTimestamp");
transferMediaStats("audioSrNtp", audio_ssrc, "srNtp");
}
if (video_enabled_) {
video_ssrc = std::to_string(is_publisher_ ? getVideoSourceSSRC() : getVideoSinkSSRC());
Expand All @@ -367,6 +373,8 @@ void MediaStream::printStats() {
transferMediaStats("videoRemb", video_ssrc, "bandwidth");
transferMediaStats("videoErizoRemb", video_ssrc, "erizoBandwidth");
transferMediaStats("videoKeyFrames", video_ssrc, "keyFrames");
transferMediaStats("videoSrTimestamp", video_ssrc, "srTimestamp");
transferMediaStats("videoSrNtp", video_ssrc, "srNtp");
}

for (uint32_t spatial = 0; spatial <= 3; spatial++) {
Expand Down
3 changes: 2 additions & 1 deletion erizo/src/erizo/OneToManyProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ namespace erizo {
RtcpHeader* chead = reinterpret_cast<RtcpHeader*>(audio_packet->data);
for (it = subscribers.begin(); it != subscribers.end(); ++it) {
if ((*it).second != nullptr) {
if (chead->isRtcp()) {
// Hack to avoid audio drift
if (chead->isRtcp() && chead->isSDES()) {
chead->setSSRC((*it).second->getAudioSinkSSRC());
} else {
head->setSSRC((*it).second->getAudioSinkSSRC());
Expand Down
4 changes: 4 additions & 0 deletions erizo/src/erizo/rtp/QualityFilterHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,16 @@ void QualityFilterHandler::write(Context *ctx, std::shared_ptr<DataPacket> 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

/* TODO(pedro): Disabled as part of the hack to reduce audio drift
* We will have to go back here and fix timestamp updates
} 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_);
}
*/
}

ctx->fireWrite(packet);
Expand Down
2 changes: 2 additions & 0 deletions erizo/src/erizo/rtp/StatsHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ void StatsCalculator::processRtcpPacket(std::shared_ptr<DataPacket> packet) {
ELOG_DEBUG("RTP SR: Packets Sent %u, Octets Sent %u", chead->getPacketsSent(), chead->getOctetsSent());
getStatsInfo()[ssrc].insertStat("packetsSent", CumulativeStat{chead->getPacketsSent()});
getStatsInfo()[ssrc].insertStat("bytesSent", CumulativeStat{chead->getOctetsSent()});
getStatsInfo()[ssrc].insertStat("srTimestamp", CumulativeStat{chead->getTimestamp()});
getStatsInfo()[ssrc].insertStat("srNtp", CumulativeStat{chead->getNtpTimestamp()});
break;
case RTCP_RTP_Feedback_PT:
ELOG_DEBUG("RTP FB: Usually NACKs: %u", chead->getBlockCount());
Expand Down

0 comments on commit 4acc42d

Please sign in to comment.