Bug 225329

Summary: [GPUP] Use MonotonicTime for elapsed time
Product: WebKit Reporter: Eric Carlson <eric.carlson>
Component: MediaAssignee: Eric Carlson <eric.carlson>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, glenn, jer.noble, philipj, sergio, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=225245
Attachments:
Description Flags
Patch
none
Patch for landing none

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].