Title: [120563] trunk/Source/WebCore
Revision
120563
Author
[email protected]
Date
2012-06-17 19:42:12 -0700 (Sun, 17 Jun 2012)

Log Message

[GStreamer] optimize ::naturalSize()
https://bugs.webkit.org/show_bug.cgi?id=89314

Reviewed by Martin Robinson.

Keep track of the video-sink sinkpad in the MediaPlayerPrivate and
adapt the webkitGstGetPadCaps API accordingly. The benefit of this
change is to reduce the number of calls to
gst_element_get_static_pad() and the corresponding gst_pad_unref().

* platform/graphics/gstreamer/GStreamerVersioning.cpp:
(webkitGstGetPadCaps):
* platform/graphics/gstreamer/GStreamerVersioning.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::naturalSize):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(MediaPlayerPrivateGStreamer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (120562 => 120563)


--- trunk/Source/WebCore/ChangeLog	2012-06-18 02:35:53 UTC (rev 120562)
+++ trunk/Source/WebCore/ChangeLog	2012-06-18 02:42:12 UTC (rev 120563)
@@ -1,3 +1,23 @@
+2012-06-17  Philippe Normand  <[email protected]>
+
+        [GStreamer] optimize ::naturalSize()
+        https://bugs.webkit.org/show_bug.cgi?id=89314
+
+        Reviewed by Martin Robinson.
+
+        Keep track of the video-sink sinkpad in the MediaPlayerPrivate and
+        adapt the webkitGstGetPadCaps API accordingly. The benefit of this
+        change is to reduce the number of calls to
+        gst_element_get_static_pad() and the corresponding gst_pad_unref().
+
+        * platform/graphics/gstreamer/GStreamerVersioning.cpp:
+        (webkitGstGetPadCaps):
+        * platform/graphics/gstreamer/GStreamerVersioning.h:
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::naturalSize):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        (MediaPlayerPrivateGStreamer):
+
 2012-06-17  Arvid Nilsson  <[email protected]>
 
         Don't mark main frame layer opaque if the frame view is transparent

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp (120562 => 120563)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp	2012-06-18 02:35:53 UTC (rev 120562)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp	2012-06-18 02:42:12 UTC (rev 120563)
@@ -21,6 +21,8 @@
 
 #include "GStreamerVersioning.h"
 
+#include <gst/gst.h>
+
 void webkitGstObjectRefSink(GstObject* gstObject)
 {
 #ifdef GST_API_VERSION_1
@@ -31,9 +33,8 @@
 #endif
 }
 
-GstCaps* webkitGstElementGetPadCaps(GstElement* element, const char* direction)
+GstCaps* webkitGstGetPadCaps(GstPad* pad)
 {
-    GstPad* pad = gst_element_get_static_pad(element, direction);
     if (!pad)
         return 0;
 
@@ -45,6 +46,5 @@
 #else
     caps = GST_PAD_CAPS(pad);
 #endif
-    gst_object_unref(GST_OBJECT(pad));
     return caps;
 }

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h (120562 => 120563)


--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h	2012-06-18 02:35:53 UTC (rev 120562)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h	2012-06-18 02:42:12 UTC (rev 120563)
@@ -20,9 +20,11 @@
 #ifndef GStreamerVersioning_h
 #define GStreamerVersioning_h
 
-#include <gst/gst.h>
+typedef struct _GstCaps GstCaps;
+typedef struct _GstObject GstObject;
+typedef struct _GstPad GstPad;
 
 void webkitGstObjectRefSink(GstObject*);
-GstCaps* webkitGstElementGetPadCaps(GstElement*, const char*);
+GstCaps* webkitGstGetPadCaps(GstPad*);
 
 #endif // GStreamerVersioning_h

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (120562 => 120563)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2012-06-18 02:35:53 UTC (rev 120562)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2012-06-18 02:42:12 UTC (rev 120563)
@@ -493,7 +493,7 @@
     if (!hasVideo())
         return IntSize();
 
-    GstCaps* caps = webkitGstElementGetPadCaps(m_webkitVideoSink, "sink");
+    GstCaps* caps = webkitGstGetPadCaps(m_videoSinkPad.get());
     if (!caps)
         return IntSize();
 
@@ -1676,6 +1676,7 @@
     g_signal_connect(m_playBin, "audio-changed", G_CALLBACK(mediaPlayerPrivateAudioChangedCallback), this);
 
     m_webkitVideoSink = webkitVideoSinkNew(m_gstGWorld.get());
+    m_videoSinkPad = adoptGRef(gst_element_get_static_pad(m_webkitVideoSink, "sink"));
 
     g_signal_connect(m_webkitVideoSink, "repaint-requested", G_CALLBACK(mediaPlayerPrivateRepaintCallback), this);
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (120562 => 120563)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2012-06-18 02:35:53 UTC (rev 120562)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2012-06-18 02:42:12 UTC (rev 120563)
@@ -192,6 +192,7 @@
             guint m_audioTimerHandler;
             guint m_videoTimerHandler;
             GRefPtr<GstElement> m_webkitAudioSink;
+            GRefPtr<GstPad> m_videoSinkPad;
     };
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to