Changeset 200455 in webkit
- Timestamp:
- May 5, 2016 6:03:46 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r200453 r200455 1 2016-05-05 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GStreamer] Adaptive streaming issues 4 https://bugs.webkit.org/show_bug.cgi?id=144040 5 6 Reviewed by Philippe Normand. 7 8 In the case of adaptive streaming, the GST URI downloader object is creating the source object, in our case 9 WebKitWebSrc, without taking its ownership. This is breaking the lifetime of the WebKitWebSrc element. We are 10 using GRefPtr in WebKitWebSrc to ref/unref the object when sending notifications to the main thread, ensuring 11 that the object is not destroyed before the main thread dispatches the message. But our smart pointers are so 12 smart that in case of receiving a floating reference, it's converted to a full reference, so that the first time 13 we try to take a ref of a WebKitWebSrc having a floating reference we are actually taking the ownership 14 instead. When we try to release the reference, we are actuallty destroying the object, something that the actual 15 owner is not expecting and causing runtime critical warnings and very often web process crashes. 16 17 (WebKitWebProcess:6863): GStreamer-CRITICAL **: 18 Trying to dispose element appsrc1, but it is in READY instead of the NULL state. 19 You need to explicitly set elements to the NULL state before 20 dropping the final reference, to allow them to clean up. 21 This problem may also be caused by a refcounting bug in the 22 application or some element. 23 24 (WebKitWebProcess:6863): GStreamer-CRITICAL **: gst_uri_handler_get_uri: assertion 'GST_IS_URI_HANDLER(handler)' failed 25 26 (WebKitWebProcess:6863): GStreamer-CRITICAL **: gst_uri_get_protocol: assertion 'uri != NULL' failed 27 28 This should be fixed in GST, but we can workaround it in WebKit while it's fixed in GST or to prevent this from 29 happening if other users make the same mistake. The idea is to add a ensureGRef() only available for GRefPtr 30 when using WebKitWebSrc objects that consumes the floating reference if needed before taking the actual reference. 31 32 * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: 33 (WTF::ensureGRef): Consume the floating ref if needed. 34 * platform/graphics/gstreamer/GRefPtrGStreamer.h: 35 * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp: 36 (webKitWebSrcChangeState): Use ensureGRef(). 37 1 38 2016-05-05 Csaba Osztrogonác <ossy@webkit.org> 2 39 -
trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp
r196809 r200455 343 343 } 344 344 345 // This method is only available for WebKitWebSrc and should not be used for any other type. 346 // This is only to work around a bug in GST where the URI downloader is not taking the ownership of WebKitWebSrc. 347 // See https://bugs.webkit.org/show_bug.cgi?id=144040. 348 GRefPtr<WebKitWebSrc> ensureGRef(WebKitWebSrc* ptr) 349 { 350 if (ptr && g_object_is_floating(ptr)) 351 gst_object_ref_sink(GST_OBJECT(ptr)); 352 return GRefPtr<WebKitWebSrc>(ptr); 353 } 354 345 355 template <> WebKitWebSrc* refGPtr<WebKitWebSrc>(WebKitWebSrc* ptr) 346 356 { -
trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h
r195735 r200455 109 109 110 110 template<> GRefPtr<WebKitWebSrc> adoptGRef(WebKitWebSrc* ptr); 111 GRefPtr<WebKitWebSrc> ensureGRef(WebKitWebSrc* ptr); 111 112 template<> WebKitWebSrc* refGPtr<WebKitWebSrc>(WebKitWebSrc* ptr); 112 113 template<> void derefGPtr<WebKitWebSrc>(WebKitWebSrc* ptr); -
trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
r197897 r200455 189 189 } 190 190 191 GRefPtr<WebKitWebSrc> protector (src);191 GRefPtr<WebKitWebSrc> protector = WTF::ensureGRef(src); 192 192 priv->notifier.notify(MainThreadSourceNotification::NeedData, [protector] { webKitWebSrcNeedData(protector.get()); }); 193 193 }, … … 203 203 } 204 204 205 GRefPtr<WebKitWebSrc> protector (src);205 GRefPtr<WebKitWebSrc> protector = WTF::ensureGRef(src); 206 206 priv->notifier.notify(MainThreadSourceNotification::EnoughData, [protector] { webKitWebSrcEnoughData(protector.get()); }); 207 207 }, … … 223 223 } 224 224 225 GRefPtr<WebKitWebSrc> protector (src);225 GRefPtr<WebKitWebSrc> protector = WTF::ensureGRef(src); 226 226 priv->notifier.notify(MainThreadSourceNotification::Seek, [protector] { webKitWebSrcSeek(protector.get()); }); 227 227 return TRUE; … … 641 641 { 642 642 GST_DEBUG_OBJECT(src, "READY->PAUSED"); 643 GRefPtr<WebKitWebSrc> protector (src);643 GRefPtr<WebKitWebSrc> protector = WTF::ensureGRef(src); 644 644 priv->notifier.notify(MainThreadSourceNotification::Start, [protector] { webKitWebSrcStart(protector.get()); }); 645 645 break; … … 649 649 GST_DEBUG_OBJECT(src, "PAUSED->READY"); 650 650 priv->notifier.cancelPendingNotifications(); 651 GRefPtr<WebKitWebSrc> protector (src);651 GRefPtr<WebKitWebSrc> protector = WTF::ensureGRef(src); 652 652 priv->notifier.notify(MainThreadSourceNotification::Stop, [protector] { webKitWebSrcStop(protector.get()); }); 653 653 break;
Note: See TracChangeset
for help on using the changeset viewer.