Changeset 202897 in webkit
- Timestamp:
- Jul 6, 2016 11:58:19 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r202895 r202897 1 2016-07-07 Philippe Normand <pnormand@igalia.com> 2 3 [GStreamer][GL] switch to appsink 4 https://bugs.webkit.org/show_bug.cgi?id=159466 5 6 Reviewed by Carlos Garcia Campos. 7 8 Fakesink is mostly used for tests. Appsink provides the same 9 functionality and is actually meant to be used on application 10 side. 11 12 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: 13 (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): 14 (WebCore::newSampleCallback): 15 (WebCore::newPrerollCallback): 16 (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): 17 (WebCore::MediaPlayerPrivateGStreamerBase::drawCallback): Deleted. 18 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 19 1 20 2016-07-06 Chris Dumez <cdumez@apple.com> 2 21 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
r202611 r202897 38 38 #include "VideoSinkGStreamer.h" 39 39 #include "WebKitWebSourceGStreamer.h" 40 #include <gst/gst.h>41 40 #include <wtf/glib/GMutexLocker.h> 42 41 #include <wtf/text/CString.h> … … 46 45 47 46 #if USE(GSTREAMER_GL) 47 #include <gst/app/gstappsink.h> 48 48 #define GST_USE_UNSTABLE_API 49 49 #include <gst/gl/gl.h> … … 169 169 m_notifier.cancelPendingNotifications(); 170 170 171 if (m_videoSink) 171 if (m_videoSink) { 172 172 g_signal_handlers_disconnect_matched(m_videoSink.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this); 173 #if USE(GSTREAMER_GL) 174 if (GST_IS_BIN(m_videoSink.get())) { 175 GRefPtr<GstElement> appsink = adoptGRef(gst_bin_get_by_name(GST_BIN_CAST(m_videoSink.get()), "webkit-gl-video-sink")); 176 g_signal_handlers_disconnect_by_data(appsink.get(), this); 177 } 178 #endif 179 } 173 180 174 181 g_mutex_clear(&m_sampleMutex); … … 580 587 581 588 #if USE(GSTREAMER_GL) 582 gboolean MediaPlayerPrivateGStreamerBase::drawCallback(MediaPlayerPrivateGStreamerBase* player, GstBuffer* buffer, GstPad* pad, GstBaseSink* sink) 583 { 584 GST_PAD_STREAM_LOCK(pad); 585 GRefPtr<GstCaps> caps = adoptGRef(gst_pad_get_current_caps(pad)); 586 GRefPtr<GstSample> sample = adoptGRef(gst_sample_new(buffer, caps.get(), &sink->segment, NULL)); 587 GST_PAD_STREAM_UNLOCK(pad); 589 GstFlowReturn MediaPlayerPrivateGStreamerBase::newSampleCallback(GstElement* sink, MediaPlayerPrivateGStreamerBase* player) 590 { 591 GRefPtr<GstSample> sample = adoptGRef(gst_app_sink_pull_sample(GST_APP_SINK(sink))); 588 592 player->triggerRepaint(sample.get()); 589 return TRUE; 593 return GST_FLOW_OK; 594 } 595 596 GstFlowReturn MediaPlayerPrivateGStreamerBase::newPrerollCallback(GstElement* sink, MediaPlayerPrivateGStreamerBase* player) 597 { 598 GRefPtr<GstSample> sample = adoptGRef(gst_app_sink_pull_preroll(GST_APP_SINK(sink))); 599 player->triggerRepaint(sample.get()); 600 return GST_FLOW_OK; 590 601 } 591 602 #endif … … 781 792 } 782 793 783 GstElement* fakesink = gst_element_factory_make("fakesink", nullptr);784 785 gst_bin_add_many(GST_BIN(videoSink), upload, colorconvert, fakesink, nullptr);794 GstElement* appsink = gst_element_factory_make("appsink", "webkit-gl-video-sink"); 795 796 gst_bin_add_many(GST_BIN(videoSink), upload, colorconvert, appsink, nullptr); 786 797 787 798 GRefPtr<GstCaps> caps = adoptGRef(gst_caps_from_string("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), format = (string) { RGBA }")); 788 799 789 800 result &= gst_element_link_pads(upload, "src", colorconvert, "sink"); 790 result &= gst_element_link_pads_filtered(colorconvert, "src", fakesink, "sink", caps.get());801 result &= gst_element_link_pads_filtered(colorconvert, "src", appsink, "sink", caps.get()); 791 802 792 803 GRefPtr<GstPad> pad = adoptGRef(gst_element_get_static_pad(upload, "sink")); 793 804 gst_element_add_pad(videoSink, gst_ghost_pad_new("sink", pad.get())); 794 805 795 g_object_set(fakesink, "enable-last-sample", FALSE, "signal-handoffs", TRUE, "silent", TRUE, "sync", TRUE, nullptr); 796 797 if (result) 798 g_signal_connect_swapped(fakesink, "handoff", G_CALLBACK(drawCallback), this); 799 else { 806 g_object_set(appsink, "enable-last-sample", FALSE, "emit-signals", TRUE, "max-buffers", 1, nullptr); 807 808 if (result) { 809 g_signal_connect(appsink, "new-sample", G_CALLBACK(newSampleCallback), this); 810 g_signal_connect(appsink, "new-preroll", G_CALLBACK(newPrerollCallback), this); 811 } else { 800 812 WARN_MEDIA_MESSAGE("Failed to link GstGL elements"); 801 813 gst_object_unref(videoSink); -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h
r202854 r202897 30 30 #include "PlatformLayer.h" 31 31 #include <glib.h> 32 #include <gst/gst.h> 32 33 #include <wtf/Condition.h> 33 34 #include <wtf/Forward.h> … … 42 43 #endif 43 44 44 typedef struct _GstBaseSink GstBaseSink;45 typedef struct _GstMessage GstMessage;46 45 typedef struct _GstStreamVolume GstStreamVolume; 47 46 typedef struct _GstVideoInfo GstVideoInfo; … … 138 137 139 138 #if USE(GSTREAMER_GL) 139 static GstFlowReturn newSampleCallback(GstElement*, MediaPlayerPrivateGStreamerBase*); 140 static GstFlowReturn newPrerollCallback(GstElement*, MediaPlayerPrivateGStreamerBase*); 140 141 GstElement* createVideoSinkGL(); 141 142 #endif … … 153 154 154 155 static void repaintCallback(MediaPlayerPrivateGStreamerBase*, GstSample*); 155 #if USE(GSTREAMER_GL)156 static gboolean drawCallback(MediaPlayerPrivateGStreamerBase*, GstBuffer*, GstPad*, GstBaseSink*);157 #endif158 156 159 157 void notifyPlayerOfVolumeChange();
Note: See TracChangeset
for help on using the changeset viewer.