[vlc-commits] decoder: make sure decoder updates use enough output pictures

Steve Lhomme git at videolan.org
Fri Nov 13 16:52:57 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov  6 12:37:07 2020 +0100| [e326d846bf234d2b705d1359fe2c17e5259f1959] | committer: Steve Lhomme

decoder: make sure decoder updates use enough output pictures

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

 src/input/decoder.c | 51 ++++++++++++++++++++++++++++-----------------------
 1 file changed, 28 insertions(+), 23 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index a509d885ae..d3a02c3b9f 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -425,31 +425,31 @@ static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec, vlc_video_context *
 
     // configure the new vout
 
+    unsigned dpb_size;
+    switch( p_dec->fmt_in.i_codec )
+    {
+    case VLC_CODEC_HEVC:
+    case VLC_CODEC_H264:
+    case VLC_CODEC_DIRAC: /* FIXME valid ? */
+        dpb_size = 18;
+        break;
+    case VLC_CODEC_AV1:
+        dpb_size = 10;
+        break;
+    case VLC_CODEC_MP4V:
+    case VLC_CODEC_VP5:
+    case VLC_CODEC_VP6:
+    case VLC_CODEC_VP6F:
+    case VLC_CODEC_VP8:
+        dpb_size = 3;
+        break;
+    default:
+        dpb_size = 2;
+        break;
+    }
+
     if ( p_owner->out_pool == NULL )
     {
-        unsigned dpb_size;
-        switch( p_dec->fmt_in.i_codec )
-        {
-        case VLC_CODEC_HEVC:
-        case VLC_CODEC_H264:
-        case VLC_CODEC_DIRAC: /* FIXME valid ? */
-            dpb_size = 18;
-            break;
-        case VLC_CODEC_AV1:
-            dpb_size = 10;
-            break;
-        case VLC_CODEC_MP4V:
-        case VLC_CODEC_VP5:
-        case VLC_CODEC_VP6:
-        case VLC_CODEC_VP6F:
-        case VLC_CODEC_VP8:
-            dpb_size = 3;
-            break;
-        default:
-            dpb_size = 2;
-            break;
-        }
-
         p_owner->out_pool = picture_pool_NewFromFormat( &p_dec->fmt_out.video,
                             dpb_size + p_dec->i_extra_picture_buffers + 1 );
         if (p_owner->out_pool == NULL)
@@ -460,6 +460,11 @@ static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec, vlc_video_context *
             return -1;
         }
     }
+    else
+    {
+        assert(dpb_size + p_dec->i_extra_picture_buffers + 1 <=
+               picture_pool_GetSize( p_owner->out_pool ));
+    }
 
     vout_configuration_t cfg = {
         .vout = p_owner->p_vout, .clock = p_owner->p_clock, .fmt = &p_dec->fmt_out.video,



More information about the vlc-commits mailing list