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

Unified Diff: media/cast/video_receiver/video_receiver.cc

Issue 289483003: Cast: Only ACK decodable frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor formatting change Created 6 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 | « media/cast/framer/framer_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/video_receiver/video_receiver.cc
diff --git a/media/cast/video_receiver/video_receiver.cc b/media/cast/video_receiver/video_receiver.cc
index df17a537dc2fc1e7a22946264463adb03e340afc..cbd62ae038915332d2f505106fc65d553e8d7e82 100644
--- a/media/cast/video_receiver/video_receiver.cc
+++ b/media/cast/video_receiver/video_receiver.cc
@@ -155,19 +155,30 @@ void VideoReceiver::EmitAvailableEncodedFrames() {
scoped_ptr<transport::EncodedFrame> encoded_frame(
new transport::EncodedFrame());
bool is_consecutively_next_frame = false;
- if (!framer_.GetEncodedVideoFrame(encoded_frame.get(),
- &is_consecutively_next_frame)) {
+ bool have_multiple_complete_frames = false;
+
+ if (!framer_.GetEncodedFrame(encoded_frame.get(),
+ &is_consecutively_next_frame,
+ &have_multiple_complete_frames)) {
VLOG(1) << "Wait for more video packets to produce a completed frame.";
return; // OnReceivedPayloadData() will invoke this method in the future.
}
+ const base::TimeTicks now = cast_environment_->Clock()->NowTicks();
+ const base::TimeTicks playout_time =
+ GetPlayoutTime(now, encoded_frame->rtp_timestamp);
+
+ // If we have multiple decodable frames, and the current frame is
+ // too old, then skip it and decode the next frame instead.
+ if (have_multiple_complete_frames && now > playout_time) {
+ framer_.ReleaseFrame(encoded_frame->frame_id);
+ continue;
+ }
+
// If |framer_| has a frame ready that is out of sequence, examine the
// playout time to determine whether it's acceptable to continue, thereby
// skipping one or more frames. Skip if the missing frame wouldn't complete
// playing before the start of playback of the available frame.
- const base::TimeTicks now = cast_environment_->Clock()->NowTicks();
- const base::TimeTicks playout_time =
- GetPlayoutTime(now, encoded_frame->rtp_timestamp);
if (!is_consecutively_next_frame) {
// TODO(miu): Also account for expected decode time here?
const base::TimeTicks earliest_possible_end_time_of_missing_frame =
« no previous file with comments | « media/cast/framer/framer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698