WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
234131
[Cocoa] -[AVPlayerItem liveUpdateTime] can hang the main thread for ~60ms
https://bugs.webkit.org/show_bug.cgi?id=234131
Summary
[Cocoa] -[AVPlayerItem liveUpdateTime] can hang the main thread for ~60ms
Jer Noble
Reported
2021-12-10 01:28:48 PST
[Cocoa] -[AVPlayerItem liveUpdateThread] can hang the main thread for ~60ms
Attachments
Patch
(17.67 KB, patch)
2021-12-10 01:34 PST
,
Jer Noble
eric.carlson
: review+
Details
Formatted Diff
Diff
Patch for landing
(18.96 KB, patch)
2021-12-10 10:30 PST
,
Jer Noble
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Jer Noble
Comment 1
2021-12-10 01:29:17 PST
<
rdar://86307593
>
Jer Noble
Comment 2
2021-12-10 01:34:04 PST
Created
attachment 446682
[details]
Patch
Eric Carlson
Comment 3
2021-12-10 08:39:36 PST
Comment on
attachment 446682
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=446682&action=review
> Source/WebCore/ChangeLog:3 > + [Cocoa] -[AVPlayerItem liveUpdateThread] can hang the main thread for ~60ms
Do you mean -[AVPlayerItem liveUpdateInterval]?
> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3839 > + auto queueTaskOnEventLoopWithPlayer = [self, strongSelf = retainPtr(self)] (Function<void(MediaPlayerPrivateAVFoundationObjC&)>&& function) mutable {
s/strongSelf = retainPtr(self)/strongSelf = RetainPtr { self }/
> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3856 > + auto seekableTimeRanges = retainPtr((NSArray*)newValue);
s/ = retainPtr( ... )/ = RetainPtr { ... }/
> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3858 > + auto playerItem = retainPtr((AVPlayerItem*)object);
The player doesn't need to be kept alive so you could avoid the refcount churn by just casting to an AVPlayerItem
> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3866 > + queueTaskOnEventLoopWithPlayer([keyPath = retainPtr(keyPath), change = retainPtr(change), object = retainPtr(object), context] (auto& player) mutable {
s/ = retainPtr( ... )/ = RetainPtr { ... }/
Jer Noble
Comment 4
2021-12-10 09:20:40 PST
(In reply to Eric Carlson from
comment #3
)
> Comment on
attachment 446682
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=446682&action=review
> > > Source/WebCore/ChangeLog:3 > > + [Cocoa] -[AVPlayerItem liveUpdateThread] can hang the main thread for ~60ms > > Do you mean -[AVPlayerItem liveUpdateInterval]?
Whoops, yes I do.
> > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3839 > > + auto queueTaskOnEventLoopWithPlayer = [self, strongSelf = retainPtr(self)] (Function<void(MediaPlayerPrivateAVFoundationObjC&)>&& function) mutable { > > s/strongSelf = retainPtr(self)/strongSelf = RetainPtr { self }/
Ok.
> > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3856 > > + auto seekableTimeRanges = retainPtr((NSArray*)newValue); > > s/ = retainPtr( ... )/ = RetainPtr { ... }/ > > > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:3858 > > + auto playerItem = retainPtr((AVPlayerItem*)object); > > The player doesn't need to be kept alive so you could avoid the refcount > churn by just casting to an AVPlayerItem
So, I think I'm going to have to modify the patch to explicitly do this query on a background queue. The KVO will happen on the main thread most of the time, in which case, I need to keep this a RetainPtr so I can pass it through to a background queue.
Jer Noble
Comment 5
2021-12-10 10:30:11 PST
Created
attachment 446753
[details]
Patch for landing
EWS
Comment 6
2021-12-11 00:48:37 PST
Committed
r286907
(
245133@main
): <
https://commits.webkit.org/245133@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 446753
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug