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

Unified Diff: media/cast/sender/frame_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/frame_sender.cc
diff --git a/media/cast/sender/frame_sender.cc b/media/cast/sender/frame_sender.cc
index 8ddfdb7e39c2e898236b91ad3177a4c785edea5a..31eff5a824878a2ff60176d7ce3dc6cd9af0cfee 100644
--- a/media/cast/sender/frame_sender.cc
+++ b/media/cast/sender/frame_sender.cc
@@ -59,6 +59,7 @@ FrameSender::FrameSender(scoped_refptr<CastEnvironment> cast_environment,
latest_acked_frame_id_(0),
duplicate_ack_counter_(0),
congestion_control_(congestion_control),
+ picture_lost_at_receiver_(false),
rtp_timebase_(rtp_timebase),
is_audio_(is_audio),
weak_factory_(this) {
@@ -219,8 +220,20 @@ void FrameSender::SendEncodedFrame(
<< last_sent_frame_id_ << ", latest_acked=" << latest_acked_frame_id_;
const uint32_t frame_id = encoded_frame->frame_id;
-
const bool is_first_frame_to_be_sent = last_send_time_.is_null();
+
+ if (picture_lost_at_receiver_ &&
+ (encoded_frame->dependency == EncodedFrame::KEY)) {
+ picture_lost_at_receiver_ = false;
+ DCHECK(frame_id > latest_acked_frame_id_);
+ // Cancel sending remaining frames.
+ std::vector<uint32_t> cancel_sending_frames;
+ for (uint32_t id = latest_acked_frame_id_ + 1; id < frame_id; ++id) {
+ cancel_sending_frames.push_back(id);
+ }
+ transport_sender_->CancelSendingFrames(ssrc_, cancel_sending_frames);
+ }
+
last_send_time_ = cast_environment_->Clock()->NowTicks();
last_sent_frame_id_ = frame_id;
// If this is the first frame about to be sent, fake the value of
@@ -381,6 +394,10 @@ void FrameSender::OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback) {
}
}
+void FrameSender::OnReceivedPli() {
+ picture_lost_at_receiver_ = true;
+}
+
bool FrameSender::ShouldDropNextFrame(base::TimeDelta frame_duration) const {
// Check that accepting the next frame won't cause more frames to become
// in-flight than the system's design limit.

Powered by Google App Engine
This is Rietveld 408576698