[vlc-devel] [PATCH] gstreamer: Minor comments & logging fixes

Vikram Fugro vikram.fugro at gmail.com
Sun Feb 14 14:30:36 CET 2016


 - Appropriately treat warnings as errors wherever needed
 - Remove unnecessary warnings
 - Fix comments in few places
---
 modules/codec/gstreamer/gstdecode.c                   | 12 ++++++------
 modules/codec/gstreamer/gstvlcpictureplaneallocator.c | 17 +++++++++--------
 modules/codec/gstreamer/gstvlcvideopool.c             | 11 +++++++++++
 modules/codec/gstreamer/gstvlcvideosink.c             |  2 +-
 4 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/modules/codec/gstreamer/gstdecode.c b/modules/codec/gstreamer/gstdecode.c
index 413d5b9..10f59a6 100644
--- a/modules/codec/gstreamer/gstdecode.c
+++ b/modules/codec/gstreamer/gstdecode.c
@@ -141,7 +141,7 @@ static gboolean seek_data_cb( GstAppSrc *p_src, guint64 l_offset,
     return TRUE;
 }
 
-/* Emitted by decodebin and links decodebin to fakesink.
+/* Emitted by decodebin and links decodebin to vlcvideosink.
  * Since only one elementary codec stream is fed to decodebin,
  * this signal cannot be emitted more than once. */
 static void pad_added_cb( GstElement *p_ele, GstPad *p_pad, gpointer p_data )
@@ -161,7 +161,7 @@ static void pad_added_cb( GstElement *p_ele, GstPad *p_pad, gpointer p_data )
                 p_sys->p_decode_out, "sink" );
         ret = gst_pad_link( p_pad, p_sinkpad );
         if( ret != GST_PAD_LINK_OK )
-            msg_Warn( p_dec, "failed to link decoder with vsink");
+            msg_Err( p_dec, "failed to link decoder with vsink");
 
         gst_object_unref( p_sinkpad );
     }
@@ -184,7 +184,7 @@ static gboolean caps_handoff_cb( GstElement* p_ele, GstCaps *p_caps,
 
     if( !gst_video_info_from_caps( &p_sys->vinfo, p_caps ))
     {
-        msg_Warn( p_dec, "failed to negotiate" );
+        msg_Err( p_dec, "failed to negotiate" );
         return FALSE;
     }
 
@@ -193,7 +193,7 @@ static gboolean caps_handoff_cb( GstElement* p_ele, GstCaps *p_caps,
     return gst_vlc_set_vout_fmt( &p_sys->vinfo, p_caps, p_dec );
 }
 
-/* Emitted by fakesink for every buffer and sets the
+/* Emitted by vlcvideosink for every buffer,
  * Adds the buffer to the queue */
 static void frame_handoff_cb( GstElement *p_ele, GstBuffer *p_buf,
         gpointer p_data )
@@ -845,7 +845,7 @@ static void CloseDecoder( vlc_object_t *p_this )
             default:
                 p_dec->b_error = default_msg_handler( p_dec, p_msg );
                 if( p_dec->b_error )
-                    msg_Warn( p_dec, "pipeline may not close gracefully" );
+                    msg_Err( p_dec, "pipeline may not close gracefully" );
                 break;
             }
 
@@ -867,7 +867,7 @@ static void CloseDecoder( vlc_object_t *p_this )
 
     if( b_running && gst_element_set_state( p_sys->p_decoder, GST_STATE_NULL )
             != GST_STATE_CHANGE_SUCCESS )
-        msg_Warn( p_dec,
+        msg_Err( p_dec,
                 "failed to change the state to NULL," \
                 "pipeline may not close gracefully" );
 
diff --git a/modules/codec/gstreamer/gstvlcpictureplaneallocator.c b/modules/codec/gstreamer/gstvlcpictureplaneallocator.c
index 2d9776f..d802ac6 100644
--- a/modules/codec/gstreamer/gstvlcpictureplaneallocator.c
+++ b/modules/codec/gstreamer/gstvlcpictureplaneallocator.c
@@ -140,16 +140,17 @@ void gst_vlc_picture_plane_allocator_release(
     guint i_plane;
 
     if( p_mem->p_pic )
+    {
         picture_Release( p_mem->p_pic );
-    else
-        msg_Warn( p_allocator->p_dec, "pic null inside the plane -> buffer" );
 
-    for( i_plane = 0; i_plane < gst_buffer_n_memory( p_buffer ); i_plane++ )
-    {
-        p_mem = (GstVlcPicturePlane*) gst_buffer_peek_memory ( p_buffer,
-                i_plane );
-        p_mem->p_pic = NULL;
-        p_mem->p_plane = NULL;
+        for( i_plane = 0; i_plane < gst_buffer_n_memory( p_buffer );
+                i_plane++ )
+        {
+            p_mem = (GstVlcPicturePlane*) gst_buffer_peek_memory ( p_buffer,
+                    i_plane );
+            p_mem->p_pic = NULL;
+            p_mem->p_plane = NULL;
+        }
     }
 }
 
diff --git a/modules/codec/gstreamer/gstvlcvideopool.c b/modules/codec/gstreamer/gstvlcvideopool.c
index 35229a3..2347b89 100644
--- a/modules/codec/gstreamer/gstvlcvideopool.c
+++ b/modules/codec/gstreamer/gstvlcvideopool.c
@@ -92,6 +92,10 @@ static gboolean gst_vlc_video_pool_set_config( GstBufferPool *p_pool,
     p_vpool->p_caps = gst_caps_ref( p_caps );
     p_vpool->info = info;
 
+    msg_Dbg( p_vpool->p_dec, "setting the following config on the pool: %s, \
+            size: %u, min buffers: %u, max buffers: %u", gst_caps_to_string( p_caps ),
+            info.size, min_buffers, max_buffers );
+
     gst_buffer_pool_config_set_params( p_config, p_caps, info.size,
             min_buffers, max_buffers );
 
@@ -162,6 +166,8 @@ static void gst_vlc_video_pool_free_buffer( GstBufferPool *p_pool,
 
     gst_vlc_picture_plane_allocator_release( p_vpool->p_allocator, p_buffer );
 
+    msg_Dbg( p_vpool->p_dec, "freed buffer %p", p_buffer );
+
     GST_BUFFER_POOL_CLASS( parent_class )->free_buffer( p_pool, p_buffer );
 
     return;
@@ -177,7 +183,10 @@ static GstFlowReturn gst_vlc_video_pool_alloc_buffer( GstBufferPool *p_pool,
 
     if( !gst_vlc_picture_plane_allocator_alloc( p_vpool->p_allocator,
                 *p_buffer ))
+    {
+        msg_Err( p_vpool->p_dec, "buffer allocation failed" );
         return GST_FLOW_EOS;
+    }
 
     if( p_vpool->b_add_metavideo )
     {
@@ -189,6 +198,8 @@ static GstFlowReturn gst_vlc_video_pool_alloc_buffer( GstBufferPool *p_pool,
                 p_info->offset, p_info->stride );
     }
 
+    msg_Dbg( p_vpool->p_dec, "allocated buffer %p", *p_buffer );
+
     return GST_FLOW_OK;
 }
 
diff --git a/modules/codec/gstreamer/gstvlcvideosink.c b/modules/codec/gstreamer/gstvlcvideosink.c
index 49ac12b..e23020b 100644
--- a/modules/codec/gstreamer/gstvlcvideosink.c
+++ b/modules/codec/gstreamer/gstvlcvideosink.c
@@ -294,7 +294,7 @@ static void gst_vlc_video_sink_set_property( GObject *p_object, guint i_prop_id,
                     gst_object_unref( p_vsink->p_allocator );
                 p_vsink->p_allocator = gst_object_ref( p_allocator );
             } else
-                msg_Warn( p_vsink->p_dec, "Invalid Allocator set");
+                msg_Err( p_vsink->p_dec, "Invalid Allocator set");
         }
         break;
 
-- 
2.5.0



More information about the vlc-devel mailing list