Bug 226515 - [Cocoa] Make the hostTime parameter to playSession a Monotonic time
Summary: [Cocoa] Make the hostTime parameter to playSession a Monotonic time
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords: InRadar
Depends on:
Blocks: 227335
  Show dependency treegraph
 
Reported: 2021-06-01 14:45 PDT by Jer Noble
Modified: 2021-06-23 18:09 PDT (History)
8 users (show)

See Also:


Attachments
Patch (16.80 KB, patch)
2021-06-01 22:14 PDT, Jer Noble
youennf: review+
Details | Formatted Diff | Diff
Patch for landing (16.55 KB, patch)
2021-06-23 09:42 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch for landing (16.55 KB, patch)
2021-06-23 10:00 PDT, Jer Noble
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2021-06-01 14:45:30 PDT
[Cocoa] Make the hostTime parameter to playSession a Monotonic time
Comment 1 Jer Noble 2021-06-01 22:14:37 PDT
Created attachment 430317 [details]
Patch
Comment 2 youenn fablet 2021-06-02 07:11:19 PDT
Comment on attachment 430317 [details]
Patch

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

> Source/WebCore/Modules/mediasession/MediaSessionCoordinator.cpp:355
> +    if (!std::isfinite(delta) || delta <= 0.5_s) {

Why delta <= 0.5_s, it seems we could use dispatchAfter?
Maybe a name for 0.5_s would help understanding.

> Source/WebCore/Modules/mediasession/MediaSessionCoordinatorPrivate.h:53
> +    }

Is it needed to keep it? Can we just move all call sites to use MonotonicTime?
Not sure we need WTFMove(atTime), especially since we are passing by value anyway.

> Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm:606
> +    m_coordinatorClient->playSession({ }, std::optional<MonotonicTime>(), makeBlockPtr(completionHandler));

I guess the change would not be needed if we would keep only one variant of playSession.
Comment 3 Radar WebKit Bug Importer 2021-06-08 14:46:19 PDT
<rdar://problem/79036032>
Comment 4 Jer Noble 2021-06-22 16:20:51 PDT
(In reply to youenn fablet from comment #2)
> Comment on attachment 430317 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=430317&action=review
> 
> > Source/WebCore/Modules/mediasession/MediaSessionCoordinator.cpp:355
> > +    if (!std::isfinite(delta) || delta <= 0.5_s) {
> 
> Why delta <= 0.5_s, it seems we could use dispatchAfter?
> Maybe a name for 0.5_s would help understanding.

Sure, it'll take some time to pre-roll the decoder; so giving a half second head start is just a magic number. I have an idea how to get rid of this in a future patch, but for now, I'll make it a named constant.

> > Source/WebCore/Modules/mediasession/MediaSessionCoordinatorPrivate.h:53
> > +    }
> 
> Is it needed to keep it? Can we just move all call sites to use
> MonotonicTime?
> Not sure we need WTFMove(atTime), especially since we are passing by value
> anyway.


Now that we've upstreamed, we can get rid of this.

> > Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm:606
> > +    m_coordinatorClient->playSession({ }, std::optional<MonotonicTime>(), makeBlockPtr(completionHandler));
> 
> I guess the change would not be needed if we would keep only one variant of
> playSession.

Yep!
Comment 5 Jer Noble 2021-06-23 09:42:51 PDT
Created attachment 432061 [details]
Patch for landing
Comment 6 Jer Noble 2021-06-23 10:00:37 PDT
Created attachment 432063 [details]
Patch for landing
Comment 7 EWS 2021-06-23 14:21:58 PDT
Committed r279186 (239081@main): <https://commits.webkit.org/239081@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 432063 [details].
Comment 8 Darin Adler 2021-06-23 18:05:49 PDT
Comment on attachment 432063 [details]
Patch for landing

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

> Source/WebCore/Modules/mediasession/MediaSessionCoordinatorPrivate.h:36
> +#include <wtf/Optional.h>

Oops! This is wrong!