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

Unified Diff: media/cast/sender/video_sender.cc

Issue 1709863002: Add Cast PLI support on sender side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Separate Pli message from Cast message. Created 4 years, 10 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
Index: media/cast/sender/video_sender.cc
diff --git a/media/cast/sender/video_sender.cc b/media/cast/sender/video_sender.cc
index 1c39ecbc786c8646b1d92a2262857839cf8348bf..b05e8f82049837fd276d8665f8ddf2e9d27d44e4 100644
--- a/media/cast/sender/video_sender.cc
+++ b/media/cast/sender/video_sender.cc
@@ -41,6 +41,10 @@ const int kConstantTimeMs = 75;
// available to handle the occasional more-complex frames).
const int kTargetUtilizationPercentage = 75;
+// This is the minimum duration in milliseconds that the sender will response
Irfan 2016/02/29 16:01:23 will respond
xjz 2016/02/29 19:48:58 Done.
+// to muliple Pli messages.
+const int kMinPliResolveIntervalMs = 500;
Irfan 2016/02/29 16:01:23 may be: kMinPliResponseIntervaleMs
xjz 2016/02/29 19:48:58 Done.
+
// Extract capture begin/end timestamps from |video_frame|'s metadata and log
// it.
void LogVideoCaptureTimestamps(CastEnvironment* cast_environment,
@@ -134,11 +138,11 @@ VideoSender::VideoSender(
transport_config.aes_iv_mask = video_config.aes_iv_mask;
transport_sender->InitializeVideo(
- transport_config,
- base::Bind(&VideoSender::OnReceivedCastFeedback,
- weak_factory_.GetWeakPtr()),
+ transport_config, base::Bind(&VideoSender::OnReceivedCastFeedback,
+ weak_factory_.GetWeakPtr()),
base::Bind(&VideoSender::OnMeasuredRoundTripTime,
- weak_factory_.GetWeakPtr()));
+ weak_factory_.GetWeakPtr()),
+ base::Bind(&VideoSender::OnReceivedPli, weak_factory_.GetWeakPtr()));
}
VideoSender::~VideoSender() {
@@ -192,6 +196,18 @@ void VideoSender::InsertRawVideoFrame(
return;
}
+ // Request a key frame when received a Pli message, and it has been passed
+ // more than |kMinPliResolveIntervalMs| milliseconds from the last key frame
+ // request sent to encoder.
+ if (picture_lost_at_receiver_) {
+ if (last_attempt_to_resolve_picture_loss_.is_null() ||
+ ((reference_time - last_attempt_to_resolve_picture_loss_)
+ .InMilliseconds() > kMinPliResolveIntervalMs)) {
+ video_encoder_->GenerateKeyFrame();
+ last_attempt_to_resolve_picture_loss_ = reference_time;
+ }
+ }
+
// Two video frames are needed to compute the exact media duration added by
// the next frame. If there are no frames in the encoder, compute a guess
// based on the configured |max_frame_rate_|. Any error introduced by this

Powered by Google App Engine
This is Rietveld 408576698