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

Unified Diff: content/browser/media/capture/desktop_capture_device.cc

Issue 1983193002: Decouple capture timestamp and reference time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve Comments Created 4 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 | « no previous file | content/browser/media/capture/desktop_capture_device_aura_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/capture/desktop_capture_device.cc
diff --git a/content/browser/media/capture/desktop_capture_device.cc b/content/browser/media/capture/desktop_capture_device.cc
index a76bc8d4fd9bad4cba6f3c32cd2f6c0a423ab122..2524fd1396d7e20ee2da3d5f9cf68ee830e31123 100644
--- a/content/browser/media/capture/desktop_capture_device.cc
+++ b/content/browser/media/capture/desktop_capture_device.cc
@@ -126,6 +126,9 @@ class DesktopCaptureDevice::Core : public webrtc::DesktopCapturer::Callback {
// The type of the capturer.
DesktopMediaID::Type capturer_type_;
+ // The system time when we receive the first frame.
+ base::TimeTicks first_ref_time_;
+
std::unique_ptr<webrtc::BasicDesktopFrame> black_frame_;
// TODO(jiayl): Remove power_save_blocker_ when there is an API to keep the
@@ -308,12 +311,15 @@ void DesktopCaptureDevice::Core::OnCaptureCompleted(
output_data = frame->data();
}
+ base::TimeTicks now = base::TimeTicks::Now();
+ if (first_ref_time_.is_null())
+ first_ref_time_ = now;
client_->OnIncomingCapturedData(
output_data, output_bytes,
media::VideoCaptureFormat(
gfx::Size(output_size.width(), output_size.height()),
requested_frame_rate_, media::PIXEL_FORMAT_ARGB),
- 0, base::TimeTicks::Now());
+ 0, now, now - first_ref_time_);
}
void DesktopCaptureDevice::Core::OnCaptureTimer() {
« no previous file with comments | « no previous file | content/browser/media/capture/desktop_capture_device_aura_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698