Bug 256090 - Un-necessary text track reconfigurations causes full re-layout
Summary: Un-necessary text track reconfigurations causes full re-layout
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jean-Yves Avenard [:jya]
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-04-28 06:46 PDT by Jean-Yves Avenard [:jya]
Modified: 2023-04-28 16:55 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Yves Avenard [:jya] 2023-04-28 06:46:17 PDT
Whenever the MediaPlayer notifies that the characteristics of the player changed, the code checks if the current subtitle track language is different to the current primary audio track language. And if so we configure the text tracks, leading to the RenderVideo to call updatePlayer [1]

Upon initialisation, and if no subtitle is selected/activated, m_subtitleTrackLanguage is an empty string and as such will always be different to MediaPlayer::languageOfPrimaryAudioTrack(), and so `HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured` will be called each time `HTMLMediaElement::mediaPlayerCharacteristicChanged which will call `HTMLMediaElement::configureTextTracks()` which calls `HTMLMediaElement::updateCaptionContainer();` which will update the media controls and cause re-layout of the player and the media control.


We should only call `markCaptionAndSubtitleTracksAsUnconfigured` again if the MediaPlayer audio track has changed.

[1] https://searchfox.org/wubkat/rev/6fa5a22eeca90d4396d6e6a14e600b672aab49a4/Source/WebCore/html/HTMLMediaElement.cpp#5718-5719
Comment 1 Jean-Yves Avenard [:jya] 2023-04-28 06:46:30 PDT
rdar://108381732
Comment 2 Jean-Yves Avenard [:jya] 2023-04-28 06:52:08 PDT
Pull request: https://github.com/WebKit/WebKit/pull/13273
Comment 3 EWS 2023-04-28 16:55:01 PDT
Committed 263521@main (81f8f7f4b684): <https://commits.webkit.org/263521@main>

Reviewed commits have been landed. Closing PR #13273 and removing active labels.