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

Unified Diff: content/renderer/media/rtc_video_capturer.cc

Issue 13554003: Use NTP time for video frame timestamp. Add tracing for timestamps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | « content/renderer/media/rtc_video_capturer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/rtc_video_capturer.cc
diff --git a/content/renderer/media/rtc_video_capturer.cc b/content/renderer/media/rtc_video_capturer.cc
index d6d665cce1e4599a6c8df2388656c977eb2d106a..52c9f463cae99a6ccaaf892796a824ad74dc8549 100644
--- a/content/renderer/media/rtc_video_capturer.cc
+++ b/content/renderer/media/rtc_video_capturer.cc
@@ -5,6 +5,7 @@
#include "content/renderer/media/rtc_video_capturer.h"
#include "base/bind.h"
+#include "base/debug/trace_event.h"
namespace content {
@@ -15,6 +16,16 @@ RtcVideoCapturer::RtcVideoCapturer(
: is_screencast_(is_screencast),
delegate_(new RtcVideoCaptureDelegate(id, vc_manager)),
state_(VIDEO_CAPTURE_STATE_STOPPED) {
+ base::Time::Exploded exploded;
no longer working on chromium 2013/04/05 08:56:34 nit, initialize the value to {}
justinlin 2013/04/05 19:03:42 Done.
+ exploded.year = 1900;
+ exploded.month = 1;
+ exploded.day_of_week = 0;
+ exploded.day_of_month = 1;
+ exploded.hour = 0;
+ exploded.minute = 0;
+ exploded.second = 0;
+ exploded.millisecond = 0;
+ ntp_epoch_ = base::Time::FromUTCExploded(exploded);
}
RtcVideoCapturer::~RtcVideoCapturer() {
@@ -100,11 +111,20 @@ void RtcVideoCapturer::OnFrameCaptured(
// cricket::CapturedFrame time is in nanoseconds.
frame.elapsed_time = (buf.timestamp - start_time_).InMicroseconds() *
base::Time::kNanosecondsPerMicrosecond;
- frame.time_stamp = frame.elapsed_time;
+ // Timestamp in NTP time (seconds since 0:00 UTC 1 January 1900) in ms.
+ frame.time_stamp = (buf.timestamp - ntp_epoch_).InMilliseconds();
frame.data = buf.memory_pointer;
frame.pixel_height = 1;
frame.pixel_width = 1;
+ TRACE_EVENT_INSTANT2("rtc_video_capturer",
+ "OnFrameCaptured",
+ TRACE_EVENT_SCOPE_THREAD,
+ "elapsed time",
+ frame.elapsed_time,
+ "timestamp",
+ frame.time_stamp);
+
// This signals to libJingle that a new VideoFrame is available.
// libJingle have no assumptions on what thread this signal come from.
SignalFrameCaptured(this, &frame);
« no previous file with comments | « content/renderer/media/rtc_video_capturer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698