Commit b5ec2f4a authored by Eugene Zemtsov's avatar Eugene Zemtsov Committed by Commit Bot

Add WALLCLOCK_FRAME_DURATION frame metadata field

This field is intended to be used in following CLs to
annalyze video playback smoothness.

Bug: 1042111
Change-Id: I577916538ca029e437b591ef9d03f04f78e29f8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2097950
Commit-Queue: Eugene Zemtsov <eugene@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750821}
parent f7ff81a5
...@@ -183,6 +183,12 @@ class MEDIA_EXPORT VideoFrameMetadata { ...@@ -183,6 +183,12 @@ class MEDIA_EXPORT VideoFrameMetadata {
// network. // network.
RECEIVE_TIME, RECEIVE_TIME,
// If present, this field represents the duration this frame is ideally
// expected to spend on the screen during playback. Unlike FRAME_DURATION
// this field takes into account current playback rate.
// Use Get/SetTimeDelta() for this key.
WALLCLOCK_FRAME_DURATION,
NUM_KEYS NUM_KEYS
}; };
......
...@@ -394,12 +394,19 @@ void VideoRendererAlgorithm::EnqueueFrame(scoped_refptr<VideoFrame> frame) { ...@@ -394,12 +394,19 @@ void VideoRendererAlgorithm::EnqueueFrame(scoped_refptr<VideoFrame> frame) {
} }
std::vector<base::TimeTicks> wall_clock_times; std::vector<base::TimeTicks> wall_clock_times;
base::TimeDelta wallclock_duration;
wall_clock_time_cb_.Run(media_timestamps, &wall_clock_times); wall_clock_time_cb_.Run(media_timestamps, &wall_clock_times);
ready_frame.start_time = wall_clock_times[0]; ready_frame.start_time = wall_clock_times[0];
if (frame_duration_calculator_.count()) if (frame_duration_calculator_.count()) {
ready_frame.end_time = ready_frame.start_time + average_frame_duration_; ready_frame.end_time = ready_frame.start_time + average_frame_duration_;
else if (wall_clock_times.size() > 1u) wallclock_duration = average_frame_duration_;
} else if (wall_clock_times.size() > 1u) {
ready_frame.end_time = wall_clock_times[1]; ready_frame.end_time = wall_clock_times[1];
wallclock_duration = ready_frame.end_time - ready_frame.start_time;
}
ready_frame.frame->metadata()->SetTimeDelta(
VideoFrameMetadata::WALLCLOCK_FRAME_DURATION, wallclock_duration);
// The vast majority of cases should always append to the back, but in rare // The vast majority of cases should always append to the back, but in rare
// circumstance we get out of order timestamps, http://crbug.com/386551. // circumstance we get out of order timestamps, http://crbug.com/386551.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment