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

Unified Diff: media/cast/sender/video_sender.cc

Issue 955253002: Add metadata to media::VideoFrame and plumb it through IPC/MediaStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tommi's nits addressed Created 5 years, 10 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 | « media/base/video_frame_unittest.cc ('k') | media/media.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/sender/video_sender.cc
diff --git a/media/cast/sender/video_sender.cc b/media/cast/sender/video_sender.cc
index 2389e9f3a13b76d4e56643694084697f7b727909..e4e3a452c2b34aa0431f3c7c16d88e4a4bf2e3fb 100644
--- a/media/cast/sender/video_sender.cc
+++ b/media/cast/sender/video_sender.cc
@@ -30,6 +30,30 @@ const int kRoundTripsNeeded = 4;
// time).
const int kConstantTimeMs = 75;
+// Extract capture begin/end timestamps from |video_frame|'s metadata and log
+// it.
+void LogVideoCaptureTimestamps(const CastEnvironment& cast_environment,
+ const media::VideoFrame& video_frame,
+ RtpTimestamp rtp_timestamp) {
+ base::TimeTicks capture_begin_time;
+ base::TimeTicks capture_end_time;
+ if (!video_frame.metadata()->GetTimeTicks(
+ media::VideoFrameMetadata::CAPTURE_BEGIN_TIME, &capture_begin_time) ||
+ !video_frame.metadata()->GetTimeTicks(
+ media::VideoFrameMetadata::CAPTURE_END_TIME, &capture_end_time)) {
+ // The frame capture timestamps were not provided by the video capture
+ // source. Simply log the events as happening right now.
+ capture_begin_time = capture_end_time =
+ cast_environment.Clock()->NowTicks();
+ }
+ cast_environment.Logging()->InsertFrameEvent(
+ capture_begin_time, FRAME_CAPTURE_BEGIN, VIDEO_EVENT, rtp_timestamp,
+ kFrameIdUnknown);
+ cast_environment.Logging()->InsertFrameEvent(
+ capture_end_time, FRAME_CAPTURE_END, VIDEO_EVENT, rtp_timestamp,
+ kFrameIdUnknown);
+}
+
} // namespace
// Note, we use a fixed bitrate value when external video encoder is used.
@@ -108,15 +132,7 @@ void VideoSender::InsertRawVideoFrame(
const RtpTimestamp rtp_timestamp =
TimeDeltaToRtpDelta(video_frame->timestamp(), kVideoFrequency);
- const base::TimeTicks insertion_time = cast_environment_->Clock()->NowTicks();
- // TODO(miu): Plumb in capture timestamps. For now, make it look like capture
- // took zero time by setting the BEGIN and END event to the same timestamp.
- cast_environment_->Logging()->InsertFrameEvent(
- insertion_time, FRAME_CAPTURE_BEGIN, VIDEO_EVENT, rtp_timestamp,
- kFrameIdUnknown);
- cast_environment_->Logging()->InsertFrameEvent(
- insertion_time, FRAME_CAPTURE_END, VIDEO_EVENT, rtp_timestamp,
- kFrameIdUnknown);
+ LogVideoCaptureTimestamps(*cast_environment_, *video_frame, rtp_timestamp);
// Used by chrome/browser/extension/api/cast_streaming/performance_test.cc
TRACE_EVENT_INSTANT2(
« no previous file with comments | « media/base/video_frame_unittest.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698