Index: media/cast/receiver/frame_receiver.cc |
diff --git a/media/cast/receiver/frame_receiver.cc b/media/cast/receiver/frame_receiver.cc |
index 1f6d75ed9b697b86ca5cc485c5afec5f58c5d4b6..0e794cdb27562096834a3f728f55ed6851c4ffa6 100644 |
--- a/media/cast/receiver/frame_receiver.cc |
+++ b/media/cast/receiver/frame_receiver.cc |
@@ -202,8 +202,7 @@ void FrameReceiver::EmitAvailableEncodedFrames() { |
} |
const base::TimeTicks now = cast_environment_->Clock()->NowTicks(); |
- const base::TimeTicks playout_time = |
- GetPlayoutTime(encoded_frame->rtp_timestamp); |
+ const base::TimeTicks playout_time = GetPlayoutTime(*encoded_frame); |
// If we have multiple decodable frames, and the current frame is |
// too old, then skip it and decode the next frame instead. |
@@ -251,6 +250,10 @@ void FrameReceiver::EmitAvailableEncodedFrames() { |
// At this point, we have a decrypted EncodedFrame ready to be emitted. |
encoded_frame->reference_time = playout_time; |
framer_.ReleaseFrame(encoded_frame->frame_id); |
+ if (encoded_frame->new_playout_delay_ms) { |
+ target_playout_delay_ = base::TimeDelta::FromMilliseconds( |
+ encoded_frame->new_playout_delay_ms); |
+ } |
cast_environment_->PostTask(CastEnvironment::MAIN, |
FROM_HERE, |
base::Bind(frame_request_queue_.front(), |
@@ -266,13 +269,18 @@ void FrameReceiver::EmitAvailableEncodedFramesAfterWaiting() { |
EmitAvailableEncodedFrames(); |
} |
-base::TimeTicks FrameReceiver::GetPlayoutTime(uint32 rtp_timestamp) const { |
+base::TimeTicks FrameReceiver::GetPlayoutTime(const EncodedFrame& frame) const { |
+ base::TimeDelta target_playout_delay = target_playout_delay_; |
+ if (frame.new_playout_delay_ms) { |
+ target_playout_delay = base::TimeDelta::FromMilliseconds( |
+ frame.new_playout_delay_ms); |
+ } |
return lip_sync_reference_time_ + |
lip_sync_drift_.Current() + |
RtpDeltaToTimeDelta( |
- static_cast<int32>(rtp_timestamp - lip_sync_rtp_timestamp_), |
+ static_cast<int32>(frame.rtp_timestamp - lip_sync_rtp_timestamp_), |
rtp_timebase_) + |
- target_playout_delay_; |
+ target_playout_delay; |
} |
void FrameReceiver::ScheduleNextCastMessage() { |