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 4af2c5316247cbbd4b58edd970b1c9d010958ea8..92267439008f3ecfc9ad19cb5fe791a99c4097a4 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::EncodedVideoFrame> encoded_frame( |
new transport::EncodedVideoFrame()); |
bool is_consecutively_next_frame = false; |
+ bool have_multiple_complete_frames = false; |
miu
2014/05/16 19:45:25
Please make these changes identically in AudioRece
hubbe
2014/05/16 20:50:58
Done.
|
+ |
if (!framer_.GetEncodedVideoFrame(encoded_frame.get(), |
- &is_consecutively_next_frame)) { |
+ &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 = |