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

Unified Diff: remoting/protocol/video_frame_pump.cc

Issue 2413553003: Add InputEventTimestampSource interface. (Closed)
Patch Set: msvc compilation Created 4 years, 2 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 | « remoting/protocol/video_frame_pump.h ('k') | remoting/protocol/video_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/video_frame_pump.cc
diff --git a/remoting/protocol/video_frame_pump.cc b/remoting/protocol/video_frame_pump.cc
index c7c2c11b145e70e480359c2e6ccb6205949b0295..b9a94baf22f23d6bab7c9e3b90da453d4aed7c53 100644
--- a/remoting/protocol/video_frame_pump.cc
+++ b/remoting/protocol/video_frame_pump.cc
@@ -69,19 +69,17 @@ VideoFramePump::~VideoFramePump() {
encode_task_runner_->DeleteSoon(FROM_HERE, encoder_.release());
}
-void VideoFramePump::Pause(bool pause) {
+void VideoFramePump::SetEventTimestampsSource(
+ scoped_refptr<InputEventTimestampsSource> event_timestamps_source) {
DCHECK(thread_checker_.CalledOnValidThread());
- capture_scheduler_.Pause(pause);
+ event_timestamps_source_ = event_timestamps_source;
}
-void VideoFramePump::OnInputEventReceived(int64_t event_timestamp) {
+void VideoFramePump::Pause(bool pause) {
DCHECK(thread_checker_.CalledOnValidThread());
- if (!next_frame_timestamps_)
- next_frame_timestamps_.reset(new FrameTimestamps());
- next_frame_timestamps_->input_event_client_timestamp = event_timestamp;
- next_frame_timestamps_->input_event_received_time = base::TimeTicks::Now();
+ capture_scheduler_.Pause(pause);
}
void VideoFramePump::SetLosslessEncode(bool want_lossless) {
@@ -140,15 +138,14 @@ void VideoFramePump::OnCaptureResult(
void VideoFramePump::CaptureNextFrame() {
DCHECK(thread_checker_.CalledOnValidThread());
- // |next_frame_timestamps_| is not set if no input events were received since
- // the previous frame. In that case create FrameTimestamps instance without
- // setting |input_event_client_timestamp| and |input_event_received_time|.
- if (!next_frame_timestamps_)
- next_frame_timestamps_.reset(new FrameTimestamps());
-
- captured_frame_timestamps_ = std::move(next_frame_timestamps_);
+ captured_frame_timestamps_.reset(new FrameTimestamps());
captured_frame_timestamps_->capture_started_time = base::TimeTicks::Now();
+ if (event_timestamps_source_) {
+ captured_frame_timestamps_->input_event_timestamps =
+ event_timestamps_source_->TakeLastEventTimestamps();
+ }
+
capturer_->Capture(webrtc::DesktopRegion());
}
@@ -209,12 +206,13 @@ void VideoFramePump::SendPacket(std::unique_ptr<PacketWithTimestamps> packet) {
void VideoFramePump::UpdateFrameTimers(VideoPacket* packet,
FrameTimestamps* timestamps) {
- if (!timestamps->input_event_received_time.is_null()) {
- packet->set_capture_pending_time_ms((timestamps->capture_started_time -
- timestamps->input_event_received_time)
- .InMilliseconds());
+ if (!timestamps->input_event_timestamps.is_null()) {
+ packet->set_capture_pending_time_ms(
+ (timestamps->capture_started_time -
+ timestamps->input_event_timestamps.host_timestamp)
+ .InMilliseconds());
packet->set_latest_event_timestamp(
- timestamps->input_event_client_timestamp);
+ timestamps->input_event_timestamps.client_timestamp.ToInternalValue());
}
packet->set_capture_overhead_time_ms(
« no previous file with comments | « remoting/protocol/video_frame_pump.h ('k') | remoting/protocol/video_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698