Bug 225329 - [GPUP] Use MonotonicTime for elapsed time
Summary: [GPUP] Use MonotonicTime for elapsed time
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-05-03 14:34 PDT by Eric Carlson
Modified: 2021-05-04 11:44 PDT (History)
7 users (show)

See Also:


Attachments
Patch (17.44 KB, patch)
2021-05-03 14:44 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch for landing (17.33 KB, patch)
2021-05-03 16:05 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2021-05-03 14:34:01 PDT
MediaPlayerPrivateRemote and RemoteMediaPlayerProxy should use MonotonicTime instead of WallTime
Comment 1 Radar WebKit Bug Importer 2021-05-03 14:34:11 PDT
<rdar://problem/77472811>
Comment 2 Eric Carlson 2021-05-03 14:44:01 PDT
Created attachment 427604 [details]
Patch
Comment 3 Simon Fraser (smfr) 2021-05-03 15:04:05 PDT
Comment on attachment 427604 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=427604&action=review

> Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp:976
> -    auto transmissionTime = MediaTime::createWithDouble((WallTime::now() - messageTime).value(), 1);
> +    auto transmissionTime = MediaTime::createWithDouble((MonotonicTime::now() - messageTime).value(), 1);
>      auto adjustedTaskTime = taskTime - transmissionTime;
>      auto currentTime = m_player->currentTime();
>      if (adjustedTaskTime <= currentTime) {
> -        completionHandler(currentTime, WallTime::now());
> +        completionHandler(currentTime, MonotonicTime::now());

I hate seeing code that fetches current time more than once in the same function (time will have advanced slightly, plus it has cost). So compute 'now' just once.

> Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerState.h:40
> +    MonotonicTime monotonicTime;

The name of the member says what it is, but not what it does.
Comment 4 Eric Carlson 2021-05-03 16:05:04 PDT
Created attachment 427612 [details]
Patch for landing
Comment 5 EWS 2021-05-04 11:44:01 PDT
Committed r276973 (237302@main): <https://commits.webkit.org/237302@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 427612 [details].