Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2058)

Unified Diff: chrome/browser/media/cast_remoting_sender.cc

Issue 2861053002: Periodically send RTCP report during Media Remoting. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/media/cast_remoting_sender.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/cast_remoting_sender.cc
diff --git a/chrome/browser/media/cast_remoting_sender.cc b/chrome/browser/media/cast_remoting_sender.cc
index 5f99c7a43d8352fd61b90f95ba1a44491e8931c4..55cb20345d96c671277c9602a1e166caedbaf0a3 100644
--- a/chrome/browser/media/cast_remoting_sender.cc
+++ b/chrome/browser/media/cast_remoting_sender.cc
@@ -501,6 +501,11 @@ bool CastRemotingSender::TrySendFrame(bool discard_data) {
transport_->InsertFrame(ssrc_, remoting_frame);
+ // Start periodically sending RTCP report to receiver to prevent keepalive
+ // timeouts on receiver side during media pause.
+ if (is_first_frame_to_be_sent)
+ ScheduleNextRtcpReport();
+
return true;
}
@@ -550,4 +555,30 @@ void CastRemotingSender::SendFrameEvents() {
logging_flush_interval_);
}
+void CastRemotingSender::ScheduleNextRtcpReport() {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE,
+ base::BindOnce(&CastRemotingSender::SendRtcpReport,
+ weak_factory_.GetWeakPtr()),
+ base::TimeDelta::FromMilliseconds(media::cast::kRtcpReportIntervalMs));
+}
+
+void CastRemotingSender::SendRtcpReport() {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ DCHECK(!last_send_time_.is_null());
+
+ const base::TimeTicks now = clock_->NowTicks();
+ const base::TimeDelta time_delta = now - last_send_time_;
+ const media::cast::RtpTimeDelta rtp_delta =
+ media::cast::RtpTimeDelta::FromTimeDelta(
+ time_delta, media::cast::kRemotingRtpTimebase);
+ const media::cast::RtpTimeTicks now_as_rtp_timestamp =
+ GetRecordedRtpTimestamp(last_sent_frame_id_) + rtp_delta;
+ transport_->SendSenderReport(ssrc_, now, now_as_rtp_timestamp);
+
+ ScheduleNextRtcpReport();
+}
+
} // namespace cast
« no previous file with comments | « chrome/browser/media/cast_remoting_sender.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698