Bug 200457 - Adopt -expectMinimumUpcomingSampleBufferPresentationTime:
Summary: Adopt -expectMinimumUpcomingSampleBufferPresentationTime:
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:
 
Reported: 2019-08-05 16:40 PDT by Jer Noble
Modified: 2019-08-07 08:18 PDT (History)
5 users (show)

See Also:


Attachments
Patch (24.18 KB, patch)
2019-08-05 16:43 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch for landing (24.29 KB, patch)
2019-08-06 09:23 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 2019-08-05 16:40:12 PDT
Adopt -expectMinimumUpcomingSampleBufferPresentationTime:
Comment 1 Jer Noble 2019-08-05 16:40:35 PDT
<rdar://problem/53961130>
Comment 2 Radar WebKit Bug Importer 2019-08-05 16:40:51 PDT
<rdar://problem/53964377>
Comment 3 Jer Noble 2019-08-05 16:43:57 PDT
Created attachment 375584 [details]
Patch
Comment 4 Jer Noble 2019-08-05 17:14:55 PDT
<rdar://problem/53961130>
Comment 5 Eric Carlson 2019-08-06 06:14:44 PDT
Comment on attachment 375584 [details]
Patch

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

> Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:1279
> +    if (trackID != m_enabledVideoTrackID)
> +        return;

Nit: canSetMinimumUpcomingPresentationTime has already done this check.

> Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:1292
> +    int trackID = trackIDString.toInt();
> +    if (trackID != m_enabledVideoTrackID)
> +        return;

Ditto
Comment 6 Jer Noble 2019-08-06 09:23:16 PDT
Created attachment 375626 [details]
Patch for landing
Comment 7 WebKit Commit Bot 2019-08-06 10:05:20 PDT
Comment on attachment 375626 [details]
Patch for landing

Clearing flags on attachment: 375626

Committed r248301: <https://trac.webkit.org/changeset/248301>
Comment 8 WebKit Commit Bot 2019-08-06 10:05:21 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Alicia Boya García 2019-08-07 07:01:15 PDT
What is this used for? It seems to be accessible from internals only.

And why are these the expected values of internals.minimumUpcomingPresentationTimeForTrackID(sourceBuffer, 1) in the first two cases in the provided test?
Comment 10 Jer Noble 2019-08-07 08:18:42 PDT
(In reply to Alicia Boya García from comment #9)
> What is this used for? It seems to be accessible from internals only.

It's an implementation detail of AVSampleBufferDisplayLayer. I tried to set up SourceBufferPrivate so that other ports wouldn't need to worry about it.

That said, it allows SourceBufferPrivate to be notified about timing of not-yet-enqueued samples. If you have a hypothetical decoder that won't start decoding samples until just before the earliest enqueued PTS, but only has a short sample queue, it's possible that an not-yet-enqueued sample has a lower PTS than all the enqueued ones, and unless the decoder knows about it, it could drop that sample by not decoding other samples in the queue until after that PTS.
 
> And why are these the expected values of
> internals.minimumUpcomingPresentationTimeForTrackID(sourceBuffer, 1) in the
> first two cases in the provided test?

The mock SourceBuffer's queue depth is set to 3, and the first three samples have PTSs of 0, 2, and 3. So the minimum upcoming un-enqueued PTS is 1. After a seek to PTS of 4, the buffer is flushed and the samples re-enqueued, starting at PTSs of 4, 5, and 6. The minimum upcoming PTS is 8. When a sample with a PTS of 7 is appended, that gets re-calculated and the minimum upcoming PTS is 7.