Title: [257468] trunk/Source/WebCore
Revision
257468
Author
[email protected]
Date
2020-02-26 06:45:29 -0800 (Wed, 26 Feb 2020)

Log Message

[GStreamer] Correctly remove webvttenc on WebKitTextCombiner pad release
https://bugs.webkit.org/show_bug.cgi?id=208234

Reviewed by Xabier Rodriguez-Calvar.

The implementation of webkitTextCombinerReleasePad() was wrong in that
it was checking the peer pad of webkittextcombinerpad to check if it
belonged a webvttenc element and remove it... But since this is a
ghostpad, the peer is upstream, not downstream. When the release pad
function is called, upstream is already disconnected, so the branch
was never hit.

To actually remove the webvttenc element we must check the target pad
instead of the peer pad, which corresponds to the element downstream.
Also, we need to set the element state to NULL before removing it,
which the previous code didn't.

* platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
(webkitTextCombinerReleasePad):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (257467 => 257468)


--- trunk/Source/WebCore/ChangeLog	2020-02-26 14:12:35 UTC (rev 257467)
+++ trunk/Source/WebCore/ChangeLog	2020-02-26 14:45:29 UTC (rev 257468)
@@ -1,3 +1,25 @@
+2020-02-26  Alicia Boya GarcĂ­a  <[email protected]>
+
+        [GStreamer] Correctly remove webvttenc on WebKitTextCombiner pad release
+        https://bugs.webkit.org/show_bug.cgi?id=208234
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        The implementation of webkitTextCombinerReleasePad() was wrong in that
+        it was checking the peer pad of webkittextcombinerpad to check if it
+        belonged a webvttenc element and remove it... But since this is a
+        ghostpad, the peer is upstream, not downstream. When the release pad
+        function is called, upstream is already disconnected, so the branch
+        was never hit.
+
+        To actually remove the webvttenc element we must check the target pad
+        instead of the peer pad, which corresponds to the element downstream.
+        Also, we need to set the element state to NULL before removing it,
+        which the previous code didn't.
+
+        * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
+        (webkitTextCombinerReleasePad):
+
 2020-02-26  Antti Koivisto  <[email protected]>
 
         Remove throttling code from RenderLayerCompositor

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp (257467 => 257468)


--- trunk/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp	2020-02-26 14:12:35 UTC (rev 257467)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp	2020-02-26 14:45:29 UTC (rev 257468)
@@ -243,11 +243,13 @@
     WebKitTextCombiner* combiner = WEBKIT_TEXT_COMBINER(element);
     WebKitTextCombinerPad* combinerPad = WEBKIT_TEXT_COMBINER_PAD(pad);
 
-    if (GRefPtr<GstPad> peer = adoptGRef(gst_pad_get_peer(pad))) {
-        GRefPtr<GstElement> parent = adoptGRef(gst_pad_get_parent_element(peer.get()));
+    if (GRefPtr<GstPad> target = adoptGRef(gst_ghost_pad_get_target(GST_GHOST_PAD(pad)))) {
+        GRefPtr<GstElement> parent = adoptGRef(gst_pad_get_parent_element(target.get()));
         ASSERT(parent);
-        if (G_TYPE_FROM_INSTANCE(parent.get()) == webVTTEncType)
+        if (G_TYPE_FROM_INSTANCE(parent.get()) == webVTTEncType) {
+            gst_element_set_state(parent.get(), GST_STATE_NULL);
             gst_bin_remove(GST_BIN(combiner), parent.get());
+        }
     }
 
     gst_element_release_request_pad(combiner->funnel, combinerPad->funnelPad);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to