[vlc-devel] [PATCH 10/15] filter_chain.c: use the NULL picture log for all buffer allocations

Steve Lhomme robux4 at ycbcr.xyz
Fri Jul 19 15:32:14 CEST 2019


---
 src/misc/filter_chain.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 839df34ceb..e9c0996245 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -100,6 +100,7 @@ filter_chain_t *filter_chain_NewSPU( vlc_object_t *obj, const char *cap )
 /** Chained filter picture allocator function */
 static picture_t *filter_chain_VideoBufferNew( filter_t *chained_filter, void *sys )
 {
+    picture_t *pic;
     filter_chain_t *chain = sys;
     chained_filter_t *chained = container_of(chained_filter, chained_filter_t, filter);
     if( chained->next != NULL ||
@@ -107,14 +108,16 @@ static picture_t *filter_chain_VideoBufferNew( filter_t *chained_filter, void *s
     {
         // HACK as intermediate filters may not have the same video format as
         // the last one handled by the owner
-        picture_t *pic = picture_NewFromFormat( &chained_filter->fmt_out.video );
-        if( pic == NULL )
-            msg_Err( chained_filter, "Failed to allocate picture" );
-        return pic;
+        pic = picture_NewFromFormat( &chained_filter->fmt_out.video );
     }
-
-    // the owner of the chain requires pictures to be grabbed from its callback
-    return chain->owner.video->buffer_new( chained_filter, chain->owner.sys );
+    else
+    {
+        // the owner of the chain requires pictures to be grabbed from its callback
+        pic = chain->owner.video->buffer_new( chained_filter, chain->downstream.sys );
+    }
+    if( pic == NULL )
+        msg_Err( chained_filter, "Failed to allocate picture" );
+    return pic;
 }
 
 static const struct filter_video_callbacks filter_chain_video_cbs =
-- 
2.17.1



More information about the vlc-devel mailing list