Title: [277432] trunk
Revision
277432
Author
[email protected]
Date
2021-05-13 06:54:43 -0700 (Thu, 13 May 2021)

Log Message

[GStreamer] media/track/in-band/track-in-band-srt-mkv-kind.html is a flaky crash
https://bugs.webkit.org/show_bug.cgi?id=225697

Source/WebCore:

This is a tentative fix for the flaky crash (I can't reproduce it locally after 10000
repetitions). It makes sure that mediaPlayerPrivate and any parameter passed to
handleTextSample() can either survive or detected to be invalid when the lambda is ran in
the main thread.

Reviewed by Alicia Boya Garcia.

Covered by existing tests.

* platform/graphics/gstreamer/TextSinkGStreamer.cpp:
(webkitTextSinkHandleSample): Protect mediaPlayerPrivate and streadId and check if the mediaPlayerPrivate WeakRef is still alive.

LayoutTests:

Reviewed by Alicia Boya Garcia.

* platform/glib/TestExpectations: Unskipped test.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (277431 => 277432)


--- trunk/LayoutTests/ChangeLog	2021-05-13 11:57:22 UTC (rev 277431)
+++ trunk/LayoutTests/ChangeLog	2021-05-13 13:54:43 UTC (rev 277432)
@@ -1,3 +1,12 @@
+2021-05-13  Enrique Ocaña González  <[email protected]>
+
+        [GStreamer] media/track/in-band/track-in-band-srt-mkv-kind.html is a flaky crash
+        https://bugs.webkit.org/show_bug.cgi?id=225697
+
+        Reviewed by Alicia Boya Garcia.
+
+        * platform/glib/TestExpectations: Unskipped test.
+
 2021-05-13  Martin Robinson  <[email protected]>
 
         Import new and updated css-scroll-snap WPT tests

Modified: trunk/LayoutTests/platform/glib/TestExpectations (277431 => 277432)


--- trunk/LayoutTests/platform/glib/TestExpectations	2021-05-13 11:57:22 UTC (rev 277431)
+++ trunk/LayoutTests/platform/glib/TestExpectations	2021-05-13 13:54:43 UTC (rev 277432)
@@ -2381,8 +2381,6 @@
 # Failing since r277091.
 webkit.org/b/225499 imported/w3c/web-platform-tests/css/css-fonts/font-feature-resolution-002.html [ ImageOnlyFailure ]
 
-webkit.org/b/225697 media/track/in-band/track-in-band-srt-mkv-kind.html [ Crash Pass ]
-
 # End: Common failures between GTK and WPE.
 
 #////////////////////////////////////////////////////////////////////////////////////////

Modified: trunk/Source/WebCore/ChangeLog (277431 => 277432)


--- trunk/Source/WebCore/ChangeLog	2021-05-13 11:57:22 UTC (rev 277431)
+++ trunk/Source/WebCore/ChangeLog	2021-05-13 13:54:43 UTC (rev 277432)
@@ -1,3 +1,20 @@
+2021-05-13  Enrique Ocaña González  <[email protected]>
+
+        [GStreamer] media/track/in-band/track-in-band-srt-mkv-kind.html is a flaky crash
+        https://bugs.webkit.org/show_bug.cgi?id=225697
+
+        This is a tentative fix for the flaky crash (I can't reproduce it locally after 10000
+        repetitions). It makes sure that mediaPlayerPrivate and any parameter passed to
+        handleTextSample() can either survive or detected to be invalid when the lambda is ran in
+        the main thread.
+
+        Reviewed by Alicia Boya Garcia.
+
+        Covered by existing tests.
+
+        * platform/graphics/gstreamer/TextSinkGStreamer.cpp:
+        (webkitTextSinkHandleSample): Protect mediaPlayerPrivate and streadId and check if the mediaPlayerPrivate WeakRef is still alive.
+
 2021-05-12  Frederic Wang  <[email protected]>
 
         RELEASE_ASSERT(m_selection->isNone()) fails in Document::removedLastRef

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/TextSinkGStreamer.cpp (277431 => 277432)


--- trunk/Source/WebCore/platform/graphics/gstreamer/TextSinkGStreamer.cpp	2021-05-13 11:57:22 UTC (rev 277431)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/TextSinkGStreamer.cpp	2021-05-13 13:54:43 UTC (rev 277432)
@@ -61,10 +61,13 @@
     }
 
     if (priv->streamId) {
-        // As the mediaPlayerPrivate WeakPtr is constructed from the main thread, we have to use it
-        // from the main thread as well.
-        callOnMainThread([priv, sample = WTFMove(sample)] {
-            priv->mediaPlayerPrivate->handleTextSample(sample.get(), priv->streamId);
+        // Player private methods that interact with WebCore must run from the main thread. Things can be destroyed before that
+        // code runs, including the text sink and priv, so pass everything in a safe way.
+        callOnMainThread([mediaPlayerPrivate = WeakPtr<MediaPlayerPrivateGStreamer>(priv->mediaPlayerPrivate),
+            streamId = priv->streamId, sample = WTFMove(sample)] {
+            if (!mediaPlayerPrivate)
+                return;
+            mediaPlayerPrivate->handleTextSample(sample.get(), streamId);
         });
         return;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to