<div dir="ltr">Please review.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 24, 2018 at 8:06 PM, Vikram Fugro <span dir="ltr"><<a href="mailto:vikram.fugro@gmail.com" target="_blank">vikram.fugro@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Currently, due to few changes in the gstreamer's buffer<br>
handling, the direct-rendering (i.e gstreamer decoders<br>
decoding directly into the downstream VLC provided buffers)<br>
is unstable.<br>
<br>
Hence, added a switch to toggle direct-rendering and is disabled<br>
by default. Works fine otherwise (i.e non direct-rendering)<br>
---<br>
 modules/codec/gstreamer/<wbr>gstdecode.c       | 17 +++++++++++++++--<br>
 modules/codec/gstreamer/<wbr>gstvlcvideosink.c | 21 +++++++++++++++++++--<br>
 modules/codec/gstreamer/<wbr>gstvlcvideosink.h |  1 +<br>
 3 files changed, 35 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/modules/codec/gstreamer/<wbr>gstdecode.c b/modules/codec/gstreamer/<wbr>gstdecode.c<br>
index 3a90ad4e04..ee7d7900f7 100644<br>
--- a/modules/codec/gstreamer/<wbr>gstdecode.c<br>
+++ b/modules/codec/gstreamer/<wbr>gstdecode.c<br>
@@ -84,6 +84,13 @@ static void Flush( decoder_t * );<br>
     "more info such as codec profile, level and other attributes, " \<br>
     "in the form of GstCaps (Stream Capabilities) to decoder." )<br>
<br>
+#define USEVLCPOOL_TEXT N_("Use VLCPool")<br>
+#define USEVLCPOOL_LONGTEXT N_( \<br>
+    "Allow the gstreamer decoders to directly decode (direct render) " \<br>
+    "into the buffers provided and managed by the (downstream)VLC modules " \<br>
+    "that follow. Note: Currently this feature is unstable, enable it at " \<br>
+    "your own risk." )<br>
+<br>
 vlc_module_begin( )<br>
     set_shortname( "GstDecode" )<br>
     add_shortcut( "gstdecode" )<br>
@@ -97,6 +104,8 @@ vlc_module_begin( )<br>
     set_callbacks( OpenDecoder, CloseDecoder )<br>
     add_bool( "use-decodebin", true, USEDECODEBIN_TEXT,<br>
         USEDECODEBIN_LONGTEXT, false )<br>
+    add_bool( "use-vlcpool", false, USEVLCPOOL_TEXT,<br>
+        USEVLCPOOL_LONGTEXT, false )<br>
 vlc_module_end( )<br>
<br>
 void gst_vlc_dec_ensure_empty_<wbr>queue( decoder_t *p_dec )<br>
@@ -448,7 +457,7 @@ static int OpenDecoder( vlc_object_t *p_this )<br>
     GstAppSrcCallbacks cb;<br>
     int i_rval = VLC_SUCCESS;<br>
     GList *p_list;<br>
-    bool dbin;<br>
+    bool dbin, vlc_pool;<br>
<br>
 #define VLC_GST_CHECK( r, v, s, t ) \<br>
     { if( r == v ){ msg_Err( p_dec, s ); i_rval = t; goto fail; } }<br>
@@ -560,10 +569,14 @@ static int OpenDecoder( vlc_object_t *p_this )<br>
     p_sys->p_decode_out = gst_element_factory_make( "vlcvideosink", NULL );<br>
     VLC_GST_CHECK( p_sys->p_decode_out, NULL, "vlcvideosink not found",<br>
             VLC_ENOMOD );<br>
+<br>
+    vlc_pool = var_CreateGetBool( p_dec, "use-vlcpool" );<br>
+    msg_Dbg( p_dec, "Using vlc pool? %s", vlc_pool ? "yes ":"no" );<br>
+<br>
     p_sys->p_allocator = gst_vlc_picture_plane_<wbr>allocator_new(<br>
             (gpointer) p_dec );<br>
     g_object_set( G_OBJECT( p_sys->p_decode_out ), "sync", FALSE, "allocator",<br>
-            p_sys->p_allocator, "id", (gpointer) p_dec, NULL );<br>
+            p_sys->p_allocator, "id", (gpointer) p_dec, "use-pool", vlc_pool, NULL );<br>
     g_signal_connect( G_OBJECT( p_sys->p_decode_out ), "new-buffer",<br>
             G_CALLBACK( frame_handoff_cb ), p_dec );<br>
<br>
diff --git a/modules/codec/gstreamer/<wbr>gstvlcvideosink.c b/modules/codec/gstreamer/<wbr>gstvlcvideosink.c<br>
index 6988e0d0a1..eff97f87dd 100644<br>
--- a/modules/codec/gstreamer/<wbr>gstvlcvideosink.c<br>
+++ b/modules/codec/gstreamer/<wbr>gstvlcvideosink.c<br>
@@ -40,7 +40,8 @@ enum<br>
 {<br>
     PROP_0,<br>
     PROP_ALLOCATOR,<br>
-    PROP_ID<br>
+    PROP_ID,<br>
+    PROP_USE_POOL<br>
 };<br>
<br>
 static guint gst_vlc_video_sink_signals[ LAST_SIGNAL ] = { 0 };<br>
@@ -84,6 +85,11 @@ static void gst_vlc_video_sink_class_init( GstVlcVideoSinkClass *p_klass )<br>
     p_gobject_class->get_property = gst_vlc_video_sink_get_<wbr>property;<br>
     p_gobject_class->finalize = gst_vlc_video_sink_finalize;<br>
<br>
+    g_object_class_install_<wbr>property( G_OBJECT_CLASS( p_klass ), PROP_USE_POOL,<br>
+            g_param_spec_boolean( "use-pool", "Use-Pool", "Use downstream VLC video output pool",<br>
+                FALSE, G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |<br>
+                G_PARAM_STATIC_STRINGS ));<br>
+<br>
     g_object_class_install_<wbr>property( G_OBJECT_CLASS( p_klass ), PROP_ALLOCATOR,<br>
             g_param_spec_pointer( "allocator", "Allocator", "VlcPictureAllocator",<br>
                 G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY |<br>
@@ -162,6 +168,7 @@ static gboolean gst_vlc_video_sink_setcaps( GstBaseSink *p_basesink,<br>
<br>
 static void gst_vlc_video_sink_init( GstVlcVideoSink *p_vlc_video_sink )<br>
 {<br>
+    p_vlc_video_sink->b_use_pool = FALSE;<br>
     gst_base_sink_set_sync( GST_BASE_SINK( p_vlc_video_sink), FALSE );<br>
 }<br>
<br>
@@ -211,7 +218,7 @@ static gboolean gst_vlc_video_sink_propose_<wbr>allocation( GstBaseSink* p_bsink,<br>
     if( p_caps == NULL )<br>
         goto no_caps;<br>
<br>
-    if( b_need_pool )<br>
+    if( p_vsink->b_use_pool && b_need_pool )<br>
     {<br>
         GstVideoInfo info;<br>
<br>
@@ -294,6 +301,12 @@ static void gst_vlc_video_sink_set_<wbr>property( GObject *p_object, guint i_prop_id,<br>
         }<br>
         break;<br>
<br>
+        case PROP_USE_POOL:<br>
+        {<br>
+            p_vsink->b_use_pool = g_value_get_boolean( p_value );<br>
+        }<br>
+        break;<br>
+<br>
         default:<br>
         break;<br>
     }<br>
@@ -312,6 +325,10 @@ static void gst_vlc_video_sink_get_<wbr>property( GObject *p_object, guint i_prop_id,<br>
             g_value_set_pointer( p_value, p_vsink->p_allocator );<br>
         break;<br>
<br>
+        case PROP_USE_POOL:<br>
+            g_value_set_boolean( p_value, p_vsink->b_use_pool );<br>
+        break;<br>
+<br>
         default:<br>
         break;<br>
    }<br>
diff --git a/modules/codec/gstreamer/<wbr>gstvlcvideosink.h b/modules/codec/gstreamer/<wbr>gstvlcvideosink.h<br>
index 5ce0dd2f26..4ec92be880 100644<br>
--- a/modules/codec/gstreamer/<wbr>gstvlcvideosink.h<br>
+++ b/modules/codec/gstreamer/<wbr>gstvlcvideosink.h<br>
@@ -58,6 +58,7 @@ struct _GstVlcVideoSink<br>
<br>
     GstAllocator *p_allocator;<br>
     GstVideoInfo vinfo;<br>
+    gboolean b_use_pool;<br>
<br>
     decoder_t *p_dec;<br>
<span class="HOEnZb"><font color="#888888"> <br>
-- <br>
2.17.1<br>
<br>
</font></span></blockquote></div><br></div>