Title: [277433] trunk/Source/WebKit
Revision
277433
Author
peng.l...@apple.com
Date
2021-05-13 07:12:22 -0700 (Thu, 13 May 2021)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (277432 => 277433)


--- trunk/Source/WebKit/ChangeLog	2021-05-13 13:54:43 UTC (rev 277432)
+++ trunk/Source/WebKit/ChangeLog	2021-05-13 14:12:22 UTC (rev 277433)
@@ -1,3 +1,38 @@
+2021-05-13  Peng Liu  <peng.l...@apple.com>
+
+        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:
+
 2021-05-13  Carlos Garcia Campos  <cgar...@igalia.com>
 
         REGRESSION(r277262): test imported/w3c/web-platform-tests/css/selectors/focus-visible-002.html is crashing

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteTextTrackProxy.cpp (277432 => 277433)


--- trunk/Source/WebKit/GPUProcess/media/RemoteTextTrackProxy.cpp	2021-05-13 13:54:43 UTC (rev 277432)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteTextTrackProxy.cpp	2021-05-13 14:12:22 UTC (rev 277433)
@@ -69,7 +69,6 @@
     configuration->startTimeVariance = m_trackPrivate->startTimeVariance();
 
     configuration->cueFormat = m_trackPrivate->cueFormat();
-    configuration->mode = m_trackPrivate->mode();
     configuration->isClosedCaptions = m_trackPrivate->isClosedCaptions();
     configuration->isSDH = m_trackPrivate->isSDH();
     configuration->containsOnlyForcedSubtitles = m_trackPrivate->containsOnlyForcedSubtitles();

Modified: trunk/Source/WebKit/GPUProcess/media/TextTrackPrivateRemoteConfiguration.h (277432 => 277433)


--- trunk/Source/WebKit/GPUProcess/media/TextTrackPrivateRemoteConfiguration.h	2021-05-13 13:54:43 UTC (rev 277432)
+++ trunk/Source/WebKit/GPUProcess/media/TextTrackPrivateRemoteConfiguration.h	2021-05-13 14:12:22 UTC (rev 277433)
@@ -42,7 +42,6 @@
     int trackIndex;
 
     WebCore::InbandTextTrackPrivate::CueFormat cueFormat { WebCore::InbandTextTrackPrivate::CueFormat::Generic };
-    WebCore::InbandTextTrackPrivate::Mode mode { WebCore::InbandTextTrackPrivate::Mode::Disabled };
     WebCore::InbandTextTrackPrivate::Kind kind { WebCore::InbandTextTrackPrivate::Kind::None };
 
     bool isClosedCaptions { false };
@@ -62,7 +61,6 @@
         encoder << startTimeVariance;
         encoder << trackIndex;
         encoder << cueFormat;
-        encoder << mode;
         encoder << kind;
         encoder << isClosedCaptions;
         encoder << isSDH;
@@ -110,11 +108,6 @@
         if (!cueFormat)
             return WTF::nullopt;
 
-        Optional<WebCore::InbandTextTrackPrivate::Mode> mode;
-        decoder >> mode;
-        if (!mode)
-            return WTF::nullopt;
-
         Optional<WebCore::InbandTextTrackPrivate::Kind> kind;
         decoder >> kind;
         if (!kind)
@@ -158,7 +151,6 @@
             WTFMove(*startTimeVariance),
             *trackIndex,
             *cueFormat,
-            *mode,
             *kind,
             *isClosedCaptions,
             *isSDH,

Modified: trunk/Source/WebKit/WebProcess/GPU/media/TextTrackPrivateRemote.cpp (277432 => 277433)


--- trunk/Source/WebKit/WebProcess/GPU/media/TextTrackPrivateRemote.cpp	2021-05-13 13:54:43 UTC (rev 277432)
+++ trunk/Source/WebKit/WebProcess/GPU/media/TextTrackPrivateRemote.cpp	2021-05-13 14:12:22 UTC (rev 277433)
@@ -51,9 +51,10 @@
     if (!m_gpuProcessConnection)
         return;
 
-    if (mode != m_mode)
-        m_gpuProcessConnection->connection().send(Messages::RemoteMediaPlayerProxy::TextTrackSetMode(m_identifier, mode), m_playerIdentifier);
+    if (mode == InbandTextTrackPrivate::mode())
+        return;
 
+    m_gpuProcessConnection->connection().send(Messages::RemoteMediaPlayerProxy::TextTrackSetMode(m_identifier, mode), m_playerIdentifier);
     InbandTextTrackPrivate::setMode(mode);
 }
 
@@ -84,9 +85,7 @@
     m_inBandMetadataTrackDispatchType = configuration.inBandMetadataTrackDispatchType;
     m_startTimeVariance = configuration.startTimeVariance;
 
-    m_format = configuration.cueFormat;
     m_kind = configuration.kind;
-    m_mode = configuration.mode;
     m_isClosedCaptions = configuration.isClosedCaptions;
     m_isSDH = configuration.isSDH;
     m_containsOnlyForcedSubtitles = configuration.containsOnlyForcedSubtitles;

Modified: trunk/Source/WebKit/WebProcess/GPU/media/TextTrackPrivateRemote.h (277432 => 277433)


--- trunk/Source/WebKit/WebProcess/GPU/media/TextTrackPrivateRemote.h	2021-05-13 13:54:43 UTC (rev 277432)
+++ trunk/Source/WebKit/WebProcess/GPU/media/TextTrackPrivateRemote.h	2021-05-13 14:12:22 UTC (rev 277433)
@@ -80,15 +80,11 @@
     int trackIndex() const final { return m_trackIndex; }
     AtomString inBandMetadataTrackDispatchType() const final { return m_inBandMetadataTrackDispatchType; }
 
-    using TextTrackCueFormat = WebCore::InbandTextTrackPrivate::CueFormat;
-    TextTrackCueFormat cueFormat() const final { return m_format; }
-
     using TextTrackKind = WebCore::InbandTextTrackPrivate::Kind;
     TextTrackKind kind() const final { return m_kind; }
 
     using TextTrackMode = WebCore::InbandTextTrackPrivate::Mode;
     void setMode(TextTrackMode) final;
-    TextTrackMode mode() const final { return m_mode; }
 
     bool isClosedCaptions() const final { return m_isClosedCaptions; }
     bool isSDH() const final { return m_isSDH; }
@@ -110,9 +106,7 @@
     WebCore::MediaPlayerIdentifier m_playerIdentifier;
     TrackPrivateRemoteIdentifier m_identifier;
 
-    TextTrackCueFormat m_format { TextTrackCueFormat::Generic };
     TextTrackKind m_kind { TextTrackKind::None };
-    TextTrackMode m_mode { TextTrackMode::Disabled };
     bool m_isClosedCaptions { false };
     bool m_isSDH { false };
     bool m_containsOnlyForcedSubtitles { false };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to