Title: [160375] trunk/Source/WebCore
Revision
160375
Author
commit-qu...@webkit.org
Date
2013-12-10 10:54:40 -0800 (Tue, 10 Dec 2013)

Log Message

[GTK][GStreamer] media/video-preload.html is flakily crashing on WK2
https://bugs.webkit.org/show_bug.cgi?id=125411

Patch by Brendan Long <b.l...@cablelabs.com> on 2013-12-10
Reviewed by Philippe Normand.

No new tests because this fixes flakeyness in existing tests (media/video-preload.html, and various tests in media/track/{audio,in-band,video}).

* platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
(webkitTextCombinerPadGetProperty): Copy tag list to prevent concurrent modification problems.
(webkitTextCombinerPadEvent): Add locking.
* platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
(WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer): Call tagsChanged() because we need it to setup m_tags.
(WebCore::TrackPrivateBaseGStreamer::disconnect): Clear m_tags.
(WebCore::TrackPrivateBaseGStreamer::tagsChanged): Lookup the tags while we're in this callback, because it's the only time we can guarantee that the input-selector won't unref them.
(WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged): Use m_tags.
* platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h: Add m_tags and a mutex.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (160374 => 160375)


--- trunk/Source/WebCore/ChangeLog	2013-12-10 18:53:51 UTC (rev 160374)
+++ trunk/Source/WebCore/ChangeLog	2013-12-10 18:54:40 UTC (rev 160375)
@@ -1,3 +1,22 @@
+2013-12-10  Brendan Long  <b.l...@cablelabs.com>
+
+        [GTK][GStreamer] media/video-preload.html is flakily crashing on WK2
+        https://bugs.webkit.org/show_bug.cgi?id=125411
+
+        Reviewed by Philippe Normand.
+
+        No new tests because this fixes flakeyness in existing tests (media/video-preload.html, and various tests in media/track/{audio,in-band,video}).
+
+        * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
+        (webkitTextCombinerPadGetProperty): Copy tag list to prevent concurrent modification problems.
+        (webkitTextCombinerPadEvent): Add locking.
+        * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
+        (WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer): Call tagsChanged() because we need it to setup m_tags.
+        (WebCore::TrackPrivateBaseGStreamer::disconnect): Clear m_tags.
+        (WebCore::TrackPrivateBaseGStreamer::tagsChanged): Lookup the tags while we're in this callback, because it's the only time we can guarantee that the input-selector won't unref them.
+        (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged): Use m_tags.
+        * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h: Add m_tags and a mutex.
+
 2013-12-10  László Langó  <la...@inf.u-szeged.hu>
 
         PageConsole::addMessage should automatically determine column number alongside line number

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp	2013-12-10 18:53:51 UTC (rev 160374)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/TextCombinerGStreamer.cpp	2013-12-10 18:54:40 UTC (rev 160375)
@@ -111,7 +111,8 @@
     switch (propertyId) {
     case PROP_PAD_TAGS:
         GST_OBJECT_LOCK(object);
-        g_value_set_boxed(value, pad->tags);
+        if (pad->tags)
+            g_value_take_boxed(value, gst_tag_list_copy(pad->tags));
         GST_OBJECT_UNLOCK(object);
         break;
     default:
@@ -202,10 +203,13 @@
         gst_event_parse_tag(event, &tags);
         ASSERT(tags);
 
+        GST_OBJECT_LOCK(pad);
         if (!combinerPad->tags)
             combinerPad->tags = gst_tag_list_copy(tags);
         else
             gst_tag_list_insert(combinerPad->tags, tags, GST_TAG_MERGE_REPLACE);
+        GST_OBJECT_UNLOCK(pad);
+
         g_object_notify(G_OBJECT(pad), "tags");
         break;
     }

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp (160374 => 160375)


--- trunk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp	2013-12-10 18:53:51 UTC (rev 160374)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp	2013-12-10 18:54:40 UTC (rev 160375)
@@ -75,7 +75,9 @@
     g_signal_connect(m_pad.get(), "notify::active", G_CALLBACK(trackPrivateActiveChangedCallback), this);
     g_signal_connect(m_pad.get(), "notify::tags", G_CALLBACK(trackPrivateTagsChangedCallback), this);
 
-    notifyTrackOfTagsChanged();
+    // We can't call notifyTrackOfTagsChanged() directly, because we need tagsChanged()
+    // to setup m_tags.
+    tagsChanged();
 }
 
 TrackPrivateBaseGStreamer::~TrackPrivateBaseGStreamer()
@@ -100,6 +102,7 @@
         g_source_remove(m_tagTimerHandler);
 
     m_pad.clear();
+    m_tags.clear();
 }
 
 void TrackPrivateBaseGStreamer::activeChanged()
@@ -114,6 +117,14 @@
 {
     if (m_tagTimerHandler)
         g_source_remove(m_tagTimerHandler);
+
+    GRefPtr<GstTagList> tags;
+    g_object_get(m_pad.get(), "tags", &tags.outPtr(), NULL);
+    {
+        MutexLocker lock(m_tagMutex);
+        m_tags.swap(tags);
+    }
+
     m_tagTimerHandler = g_timeout_add(0,
         reinterpret_cast<GSourceFunc>(trackPrivateTagsChangeTimeoutCallback), this);
 }
@@ -149,7 +160,10 @@
 
     TrackPrivateBaseClient* client = m_owner->client();
     GRefPtr<GstTagList> tags;
-    g_object_get(m_pad.get(), "tags", &tags.outPtr(), NULL);
+    {
+        MutexLocker lock(m_tagMutex);
+        tags.swap(m_tags);
+    }
     if (!tags)
         return;
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h (160374 => 160375)


--- trunk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h	2013-12-10 18:53:51 UTC (rev 160374)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h	2013-12-10 18:54:40 UTC (rev 160375)
@@ -29,6 +29,7 @@
 #if ENABLE(VIDEO) && USE(GSTREAMER) && ENABLE(VIDEO_TRACK)
 
 #include "GRefPtrGStreamer.h"
+#include <wtf/ThreadingPrimitives.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -67,6 +68,9 @@
     TrackPrivateBase* m_owner;
     guint m_activeTimerHandler;
     guint m_tagTimerHandler;
+
+    Mutex m_tagMutex;
+    GRefPtr<GstTagList> m_tags;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to