[vlc-commits] transcode: video: fix dequeing on error

Francois Cartegnie git at videolan.org
Mon Jul 9 16:15:33 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jun 27 18:03:03 2018 +0200| [2b6cd276ccef4878b31ddd5711e1d2fcb74f88c5] | committer: Francois Cartegnie

transcode: video: fix dequeing on error

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2b6cd276ccef4878b31ddd5711e1d2fcb74f88c5
---

 modules/stream_out/transcode/video.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 2895344792..17e47971d6 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -795,23 +795,23 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
         return VLC_EGENERIC;
 
     picture_t *p_pics = transcode_dequeue_all_pics( id );
-    if( p_pics == NULL )
-        goto end;
 
     do
     {
         picture_t *p_pic = p_pics;
-        p_pics = p_pics->p_next;
-        p_pic->p_next = NULL;
+        if( p_pic )
+        {
+            p_pics = p_pic->p_next;
+            p_pic->p_next = NULL;
+        }
 
-        if( id->b_error )
+        if( id->b_error && p_pic )
         {
             picture_Release( p_pic );
             continue;
         }
 
-        if( p_pic &&
-            ( unlikely(id->p_encoder->p_module == NULL) ||
+        if( p_pic && ( unlikely(id->p_encoder->p_module == NULL) ||
               !video_format_IsSimilar( &id->fmt_input_video, &p_pic->format ) ) )
         {
             if( id->p_encoder->p_module == NULL ) /* Configure Encoder input/output */
@@ -900,7 +900,6 @@ error:
         vlc_mutex_unlock( &id->lock_out );
     }
 
-end:
     /* Drain encoder */
     if( unlikely( !id->b_error && in == NULL ) && id->p_encoder->p_module )
     {



More information about the vlc-commits mailing list