WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
216299
[Cocoa] PERF: Don't instantiate AVPlayer-based audio decoders or renderers if an element is initially muted.
https://bugs.webkit.org/show_bug.cgi?id=216299
Summary
[Cocoa] PERF: Don't instantiate AVPlayer-based audio decoders or renderers if...
Jer Noble
Reported
2020-09-08 17:35:57 PDT
[Cocoa] Don't instantiate AVPlayer-based audio decoders or renderers if an element is initially muted.
Attachments
Patch
(7.08 KB, patch)
2020-09-08 17:46 PDT
,
Jer Noble
no flags
Details
Formatted Diff
Diff
Patch
(7.15 KB, patch)
2020-09-09 14:10 PDT
,
Jer Noble
eric.carlson
: review+
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch for Landing
(7.15 KB, patch)
2020-09-09 15:34 PDT
,
Jer Noble
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Jer Noble
Comment 1
2020-09-08 17:46:39 PDT
Created
attachment 408296
[details]
Patch
Peng Liu
Comment 2
2020-09-08 18:37:48 PDT
Comment on
attachment 408296
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=408296&action=review
> Source/WebCore/ChangeLog:14 > + audio decoding and rendering until the first time the AVPlayer is unmuted. ThisThe means the first un-mute may
s/ThisThe/This/
> Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h:77 > +@property (nonatomic, getter=_suppressesAudioRendering, setter=_setSuppressesAudioRendering:) BOOL suppressesAudioRendering
Miss a ";"?
Jer Noble
Comment 3
2020-09-09 14:10:37 PDT
Created
attachment 408366
[details]
Patch
Eric Carlson
Comment 4
2020-09-09 14:57:39 PDT
Comment on
attachment 408366
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=408366&action=review
r=me once the bots are happy
> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:946 > + m_avPlayer.get().suppressesAudioRendering = YES;
We should always know if an element is muted or not with the above changes, and setMuted() will always be called if the muted state changes, so how about something like `m_avPlayer.get().suppressesAudioRendering = m_muted`?
> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:1334 > + if (!m_muted) > + m_avPlayer.get().suppressesAudioRendering = NO;
setMuted(true) may be called before playback starts, so something like `m_avPlayer.get().suppressesAudioRendering = m_muted` might be better.
Eric Carlson
Comment 5
2020-09-09 14:58:59 PDT
Comment on
attachment 408366
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=408366&action=review
> Source/WebCore/PAL/pal/spi/cocoa/AVFoundationSPI.h:77 > +@property (nonatomic, getter=_suppressesAudioRendering, setter=_setSuppressesAudioRendering:) BOOL suppressesAudioRendering
Looks like you are missing a semi-colon
Jer Noble
Comment 6
2020-09-09 15:30:48 PDT
Comment on
attachment 408366
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=408366&action=review
>> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:946 >> + m_avPlayer.get().suppressesAudioRendering = YES; > > We should always know if an element is muted or not with the above changes, and setMuted() will always be called if the muted state changes, so how about something like `m_avPlayer.get().suppressesAudioRendering = m_muted`?
If you look deeper in the context for this change, this is already inside a `if (m_muted)` block. And three lines above m_muted is set to `false`, so we literally have no choice but to set this unconditionally to YES on this line.
>> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:1334 >> + m_avPlayer.get().suppressesAudioRendering = NO; > > setMuted(true) may be called before playback starts, so something like `m_avPlayer.get().suppressesAudioRendering = m_muted` might be better.
That would cause suppression to kick in if the video was muted during playback. The existing logic definitely has edge cases where suppression won't kick in (I.e., if you do `video.src = foo; video.addEventListener('loadedmetadata', event => { video.muted = true; });`), but those edge cases feel less common, and we can always expand this behavior.
Jer Noble
Comment 7
2020-09-09 15:34:36 PDT
Created
attachment 408375
[details]
Patch for Landing
EWS
Comment 8
2020-09-10 11:23:56 PDT
Committed
r266844
: <
https://trac.webkit.org/changeset/266844
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 408375
[details]
.
Radar WebKit Bug Importer
Comment 9
2020-09-10 11:24:31 PDT
<
rdar://problem/68654077
>
Chris Dumez
Comment 10
2020-09-14 13:18:51 PDT
I suspect this has caused <
rdar://problem/68743466
>.
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