⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 277433 in webkit


Ignore:
Timestamp:
May 13, 2021, 7:12:22 AM (5 years ago)
Author:
Peng Liu
Message:

Subtitles in Safari fail to appear after switching language
https://bugs.webkit.org/show_bug.cgi?id=225738

Reviewed by Jer Noble.

TextTrackPrivateRemote::setMode() calls InbandTextTrackPrivate::setMode(), but
it does not set the value of TextTrackPrivateRemote::mode properly. Therefore,
TextTrackPrivateRemote::mode will always be Disabled. When we switch text track
in the WebContent process side, we will only send the IPC message TextTrackSetMode
to RemoteMediaPlayerProxy in the GPU process to change the mode from Disabled
to Showing, but cannot change its value back to Disabled. When a user keeps
switching text track, all text tracks in the GPU process will become Showing,
and MediaPlayerPrivateAVFoundation cannot deal with that. As a result,
the WebContent process won't get the correct subtitles from the GPU process.
cueFormat() has the similar issue, it does not impact the functionality though.

Actually, TextTrackPrivateRemote can simply use the implementations of its
base class InbandTextTrackPrivate regarding mode and cue format.

In addition, TextTrackPrivateRemote does not need to get the "mode" value from
RemoteTextTrackProxy in the GPU process. So this patch removes the mode attribute
of TextTrackPrivateRemoteConfiguration.

  • GPUProcess/media/RemoteTextTrackProxy.cpp:

(WebKit::RemoteTextTrackProxy::configuration):

  • GPUProcess/media/TextTrackPrivateRemoteConfiguration.h:

(WebKit::TextTrackPrivateRemoteConfiguration::encode const):
(WebKit::TextTrackPrivateRemoteConfiguration::decode):

  • WebProcess/GPU/media/TextTrackPrivateRemote.cpp:

(WebKit::TextTrackPrivateRemote::setMode):
(WebKit::TextTrackPrivateRemote::updateConfiguration):

  • WebProcess/GPU/media/TextTrackPrivateRemote.h:
Location:
trunk/Source/WebKit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r277428 r277433  
     12021-05-13  Peng Liu  <peng.liu6@apple.com>
     2
     3        Subtitles in Safari fail to appear after switching language
     4        https://bugs.webkit.org/show_bug.cgi?id=225738
     5
     6        Reviewed by Jer Noble.
     7
     8        `TextTrackPrivateRemote::setMode()` calls `InbandTextTrackPrivate::setMode()`, but
     9        it does not set the value of `TextTrackPrivateRemote::mode` properly. Therefore,
     10        `TextTrackPrivateRemote::mode` will always be `Disabled`. When we switch text track
     11        in the WebContent process side, we will only send the IPC message `TextTrackSetMode`
     12        to `RemoteMediaPlayerProxy` in the GPU process to change the mode from `Disabled`
     13        to `Showing`, but cannot change its value back to `Disabled`. When a user keeps
     14        switching text track, all text tracks in the GPU process will become `Showing`,
     15        and `MediaPlayerPrivateAVFoundation` cannot deal with that. As a result,
     16        the WebContent process won't get the correct subtitles from the GPU process.
     17        `cueFormat()` has the similar issue, it does not impact the functionality though.
     18
     19        Actually, `TextTrackPrivateRemote` can simply use the implementations of its
     20        base class `InbandTextTrackPrivate` regarding mode and cue format.
     21
     22        In addition, `TextTrackPrivateRemote` does not need to get the "mode" value from
     23        `RemoteTextTrackProxy` in the GPU process. So this patch removes the `mode` attribute
     24        of `TextTrackPrivateRemoteConfiguration`.
     25
     26        * GPUProcess/media/RemoteTextTrackProxy.cpp:
     27        (WebKit::RemoteTextTrackProxy::configuration):
     28        * GPUProcess/media/TextTrackPrivateRemoteConfiguration.h:
     29        (WebKit::TextTrackPrivateRemoteConfiguration::encode const):
     30        (WebKit::TextTrackPrivateRemoteConfiguration::decode):
     31        * WebProcess/GPU/media/TextTrackPrivateRemote.cpp:
     32        (WebKit::TextTrackPrivateRemote::setMode):
     33        (WebKit::TextTrackPrivateRemote::updateConfiguration):
     34        * WebProcess/GPU/media/TextTrackPrivateRemote.h:
     35
    1362021-05-13  Carlos Garcia Campos  <cgarcia@igalia.com>
    237
  • trunk/Source/WebKit/GPUProcess/media/RemoteTextTrackProxy.cpp

    r277372 r277433  
    7070
    7171    configuration->cueFormat = m_trackPrivate->cueFormat();
    72     configuration->mode = m_trackPrivate->mode();
    7372    configuration->isClosedCaptions = m_trackPrivate->isClosedCaptions();
    7473    configuration->isSDH = m_trackPrivate->isSDH();
  • trunk/Source/WebKit/GPUProcess/media/TextTrackPrivateRemoteConfiguration.h

    r270612 r277433  
    4343
    4444    WebCore::InbandTextTrackPrivate::CueFormat cueFormat { WebCore::InbandTextTrackPrivate::CueFormat::Generic };
    45     WebCore::InbandTextTrackPrivate::Mode mode { WebCore::InbandTextTrackPrivate::Mode::Disabled };
    4645    WebCore::InbandTextTrackPrivate::Kind kind { WebCore::InbandTextTrackPrivate::Kind::None };
    4746
     
    6362        encoder << trackIndex;
    6463        encoder << cueFormat;
    65         encoder << mode;
    6664        encoder << kind;
    6765        encoder << isClosedCaptions;
     
    111109            return WTF::nullopt;
    112110
    113         Optional<WebCore::InbandTextTrackPrivate::Mode> mode;
    114         decoder >> mode;
    115         if (!mode)
    116             return WTF::nullopt;
    117 
    118111        Optional<WebCore::InbandTextTrackPrivate::Kind> kind;
    119112        decoder >> kind;
     
    159152            *trackIndex,
    160153            *cueFormat,
    161             *mode,
    162154            *kind,
    163155            *isClosedCaptions,
  • trunk/Source/WebKit/WebProcess/GPU/media/TextTrackPrivateRemote.cpp

    r277372 r277433  
    5252        return;
    5353
    54     if (mode != m_mode)
    55         m_gpuProcessConnection->connection().send(Messages::RemoteMediaPlayerProxy::TextTrackSetMode(m_identifier, mode), m_playerIdentifier);
     54    if (mode == InbandTextTrackPrivate::mode())
     55        return;
    5656
     57    m_gpuProcessConnection->connection().send(Messages::RemoteMediaPlayerProxy::TextTrackSetMode(m_identifier, mode), m_playerIdentifier);
    5758    InbandTextTrackPrivate::setMode(mode);
    5859}
     
    8586    m_startTimeVariance = configuration.startTimeVariance;
    8687
    87     m_format = configuration.cueFormat;
    8888    m_kind = configuration.kind;
    89     m_mode = configuration.mode;
    9089    m_isClosedCaptions = configuration.isClosedCaptions;
    9190    m_isSDH = configuration.isSDH;
  • trunk/Source/WebKit/WebProcess/GPU/media/TextTrackPrivateRemote.h

    r277372 r277433  
    8181    AtomString inBandMetadataTrackDispatchType() const final { return m_inBandMetadataTrackDispatchType; }
    8282
    83     using TextTrackCueFormat = WebCore::InbandTextTrackPrivate::CueFormat;
    84     TextTrackCueFormat cueFormat() const final { return m_format; }
    85 
    8683    using TextTrackKind = WebCore::InbandTextTrackPrivate::Kind;
    8784    TextTrackKind kind() const final { return m_kind; }
     
    8986    using TextTrackMode = WebCore::InbandTextTrackPrivate::Mode;
    9087    void setMode(TextTrackMode) final;
    91     TextTrackMode mode() const final { return m_mode; }
    9288
    9389    bool isClosedCaptions() const final { return m_isClosedCaptions; }
     
    111107    TrackPrivateRemoteIdentifier m_identifier;
    112108
    113     TextTrackCueFormat m_format { TextTrackCueFormat::Generic };
    114109    TextTrackKind m_kind { TextTrackKind::None };
    115     TextTrackMode m_mode { TextTrackMode::Disabled };
    116110    bool m_isClosedCaptions { false };
    117111    bool m_isSDH { false };
Note: See TracChangeset for help on using the changeset viewer.