Bug 115043 - [Mac] forced subtitle track should change when audio track language changes
Summary: [Mac] forced subtitle track should change when audio track language changes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar, PlatformOnly
Depends on:
Blocks:
 
Reported: 2013-04-23 09:11 PDT by Eric Carlson
Modified: 2013-04-23 16:34 PDT (History)
4 users (show)

See Also:


Attachments
Proposed patch (9.40 KB, patch)
2013-04-23 09:28 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2013-04-23 09:11:44 PDT
Because forced subtitles are always shown in the same language as the primary audio track, the forced track should change when the primary audio track changes to a different language.
Comment 1 Eric Carlson 2013-04-23 09:12:07 PDT
<rdar://problem/13716530>
Comment 2 Eric Carlson 2013-04-23 09:28:53 PDT
Created attachment 199246 [details]
Proposed patch
Comment 3 Jer Noble 2013-04-23 10:34:41 PDT
Comment on attachment 199246 [details]
Proposed patch

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

> Source/WebCore/ChangeLog:16
> +        (WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): Take parameter toa allow

Nit: toa -> to

> Source/WebCore/html/HTMLMediaElement.cpp:3244
> +    if (trackToEnable && m_captionDisplayMode != CaptionUserPreferences::AlwaysOn && !defaultTrack && trackToEnable != fallbackTrack)

Can we move the "trackToEnable" checks together?  They all seem equally cheap (i.e., pointer comparisons).  Also, should this be an else-if?

> Source/WebCore/html/HTMLMediaElement.h:557
> +    enum ReconfigureMode {
> +        Immediately,
> +        AfterDelay,
> +    };
> +    void markCaptionAndSubtitleTracksAsUnconfigured(ReconfigureMode);

Ooh, good use of a boolean enum!

> Source/WebCore/page/CaptionUserPreferencesMac.mm:630
> +    if ((trackHasOnlyForcedSubtitles && displayMode != ForcedOnly) || (displayMode == ForcedOnly && !trackHasOnlyForcedSubtitles))

Why is the trackHasOnlyForcedSubtitles check order reversed?  I mean, if you want to go all funhouse-mirror, it should be:

if ((trackHasOnlyForcedSubtitles && displayMode != ForcedOnly) || (ForcedOnly == displayMode && !trackHasOnlyForcedSubtitles))

:-D

Or, this could just be re-written as:

if (trackHasOnlyForcedSubtitles == (displayMode != ForcedOnly))

But if that's "too clever by half", I'd just move things around to make the two halves more parallel:

if ((trackHasOnlyForcedSubtitles && displayMode != ForcedOnly) 
    || (!trackHasOnlyForcedSubtitles && displayMode == ForcedOnly))
Comment 4 Eric Carlson 2013-04-23 16:34:44 PDT
http://trac.webkit.org/changeset/149005