Bug 163983 - Opt-out of AVPlayer automatic sleep disabling
Summary: Opt-out of AVPlayer automatic sleep disabling
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: 2016-10-25 14:12 PDT by Jer Noble
Modified: 2022-10-10 12:15 PDT (History)
4 users (show)

See Also:


Attachments
Patch (5.30 KB, patch)
2016-10-25 14:16 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (11.16 KB, patch)
2016-10-25 16:56 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (11.47 KB, patch)
2016-10-28 10:07 PDT, Jer Noble
eric.carlson: review+
Details | Formatted Diff | Diff
Patch for landing (11.45 KB, patch)
2016-10-28 17:59 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 2016-10-25 14:12:32 PDT
Opt-out of AVPlayer automatic sleep disabling
Comment 1 Jer Noble 2016-10-25 14:16:15 PDT
Created attachment 292818 [details]
Patch
Comment 2 Jon Lee 2016-10-25 15:36:21 PDT
Comment on attachment 292818 [details]
Patch

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

> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:1053
> +    if ([m_avPlayer respondsToSelector:@selector(_setPreventsSleepDuringVideoPlayback:)])

Is this check necessary?
Comment 3 Jer Noble 2016-10-25 16:56:13 PDT
Created attachment 292849 [details]
Patch
Comment 4 Jer Noble 2016-10-25 16:58:13 PDT
(In reply to comment #2)
> Comment on attachment 292818 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=292818&action=review
> 
> > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:1053
> > +    if ([m_avPlayer respondsToSelector:@selector(_setPreventsSleepDuringVideoPlayback:)])
> 
> Is this check necessary?

Only a preponderance of caution; since it's SPI, it's not guaranteed to exist in any particular platform.
Comment 5 Jon Lee 2016-10-26 12:42:45 PDT
rdar://problem/28496489
Comment 6 Jer Noble 2016-10-28 10:07:27 PDT
Created attachment 293168 [details]
Patch
Comment 7 Eric Carlson 2016-10-28 12:24:28 PDT
Comment on attachment 293168 [details]
Patch

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

> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:1054
> +    if ([m_avPlayer respondsToSelector:@selector(_setPreventsSleepDuringVideoPlayback:)])
> +        [m_avPlayer _setPreventsSleepDuringVideoPlayback:player()->shouldDisableSleep()];

Nit: you can just call setShouldDisableSleep() here instead of duplicating the code.
Comment 8 Jer Noble 2016-10-28 17:59:47 PDT
Created attachment 293263 [details]
Patch for landing
Comment 9 WebKit Commit Bot 2016-10-31 09:40:22 PDT
Comment on attachment 293263 [details]
Patch for landing

Clearing flags on attachment: 293263

Committed r208151: <http://trac.webkit.org/changeset/208151>
Comment 10 Ahmad Saleem 2022-10-10 12:15:07 PDT
This landed and didn't backed out:

Link - https://github.com/WebKit/WebKit/commit/df60ebbfa340b5663a91c6f04cee23a2772bbbf5

Marking this as "RESOLVED FIXED".