[vlc-devel] [PATCH 16/16] video_output: remove the decoder pool

Steve Lhomme robux4 at ycbcr.xyz
Thu Oct 24 16:20:30 CEST 2019


There's only the display pool and the private pool (which will also go away at
some point).

The size of pool is now reserved_picture instead of VOUT_MAX_PICTURES in many
cases.
---
 src/video_output/video_output.c  | 11 +++---
 src/video_output/vout_internal.h |  1 -
 src/video_output/vout_wrapper.c  | 57 ++++----------------------------
 3 files changed, 12 insertions(+), 57 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 4dc19559f4b..cac94bac1a9 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1509,7 +1509,6 @@ static int vout_Start(vout_thread_t *vout, vlc_video_context *vctx, const vout_c
     vlc_mouse_Init(&sys->mouse);
 
     sys->decoder_fifo = picture_fifo_New();
-    sys->decoder_pool = NULL;
     sys->display_pool = NULL;
     sys->private_pool = NULL;
 
@@ -1586,7 +1585,7 @@ static int vout_Start(vout_thread_t *vout, vlc_video_context *vctx, const vout_c
         vout_SetDisplayAspect(sys->display, num, den);
     vlc_mutex_unlock(&sys->display_lock);
 
-    assert(sys->decoder_pool != NULL && sys->private_pool != NULL);
+    assert(sys->display_pool != NULL && sys->private_pool != NULL);
 
     sys->displayed.current       = NULL;
     sys->displayed.next          = NULL;
@@ -1630,8 +1629,8 @@ void vout_Cancel(vout_thread_t *vout, bool canceled)
     assert(sys->display);
 
     vout_control_Hold(&sys->control);
-    if (sys->decoder_pool != NULL)
-        picture_pool_Cancel(sys->decoder_pool, canceled);
+    if (sys->display_pool != NULL)
+        picture_pool_Cancel(sys->display_pool, canceled);
     vout_control_Release(&sys->control);
 }
 
@@ -1710,7 +1709,7 @@ static void vout_ReleaseDisplay(vout_thread_t *vout)
         filter_DeleteBlend(sys->spu_blend);
 
     /* Destroy the rendering display */
-    if (sys->decoder_pool != NULL)
+    if (sys->display_pool != NULL)
         vout_FlushUnlocked(vout, true, INT64_MAX);
 
     vlc_mutex_lock(&sys->display_lock);
@@ -1730,7 +1729,7 @@ static void vout_ReleaseDisplay(vout_thread_t *vout)
         picture_fifo_Delete(sys->decoder_fifo);
         sys->decoder_fifo = NULL;
     }
-    assert(sys->decoder_pool == NULL);
+    assert(sys->display_pool == NULL);
 
     if (sys->mouse_event)
         sys->mouse_event(NULL, sys->mouse_opaque);
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index ce9c28ee035..22c90c07a2b 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -185,7 +185,6 @@ struct vout_thread_sys_t
 
     picture_pool_t  *private_pool;
     picture_pool_t  *display_pool;
-    picture_pool_t  *decoder_pool;
     picture_fifo_t  *decoder_fifo;
     vout_chrono_t   render;           /**< picture render time estimator */
 
diff --git a/src/video_output/vout_wrapper.c b/src/video_output/vout_wrapper.c
index d67e96845b4..62cbf08cf24 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -80,7 +80,6 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
     if (vd == NULL)
         return NULL;
 
-    sys->decoder_pool = NULL;
     sys->display_pool = NULL;
 
     const bool use_dr = !vout_IsDisplayFiltered(vd);
@@ -90,61 +89,22 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
     const unsigned reserved_picture = DISPLAY_PICTURE_COUNT +
                                       private_picture +
                                       kept_picture;
-    unsigned display_pool_size;
-
-    /* TODO: During the push transition, both decoder and vout handle a picture
-     * pool. Therefore we can lower this picture count when we know it is
-     * handled by the decoder. The vout pool will be only used for filters */
-    switch (vctx ? vlc_video_context_GetType(vctx) : VLC_VIDEO_CONTEXT_NONE)
-    {
-    case VLC_VIDEO_CONTEXT_VAAPI:
-    case VLC_VIDEO_CONTEXT_VDPAU:
-    case VLC_VIDEO_CONTEXT_NVDEC:
-    case VLC_VIDEO_CONTEXT_DXVA2:
-    case VLC_VIDEO_CONTEXT_D3D11VA:
-        display_pool_size = reserved_picture;
-        break;
-    default:
-        display_pool_size = allow_dr ? __MAX(VOUT_MAX_PICTURES,
-                                             reserved_picture) : 3;
-        break;
-    }
 
-    picture_pool_t *display_pool = vout_GetPool(vd, display_pool_size);
+    picture_pool_t *display_pool = vout_GetPool(vd, reserved_picture);
     if (display_pool == NULL)
         goto error;
 
-    picture_pool_t *decoder_pool = NULL;
-
 #ifndef NDEBUG
-    if ( picture_pool_GetSize(display_pool) < display_pool_size )
+    if ( picture_pool_GetSize(display_pool) < reserved_picture )
         msg_Warn(vout, "Not enough display buffers in the pool, requested %u got %u",
-                 display_pool_size, picture_pool_GetSize(display_pool));
+                 reserved_picture, picture_pool_GetSize(display_pool));
 #endif
 
-    if (allow_dr &&
-        picture_pool_GetSize(display_pool) >= reserved_picture) {
-        sys->decoder_pool = display_pool;
-    } else {
-        sys->decoder_pool = decoder_pool =
-            picture_pool_NewFromFormat(&vd->source,
-                                       __MAX(VOUT_MAX_PICTURES,
-                                             reserved_picture - DISPLAY_PICTURE_COUNT));
-        if (!sys->decoder_pool)
-            goto error;
-        if (allow_dr) {
-            msg_Warn(vout, "Not enough direct buffers, using system memory");
-        }
-        if (use_dr)
-            sys->display_pool = vout_GetPool(vd, 3);
-    }
-    sys->private_pool = picture_pool_Reserve(sys->decoder_pool, private_picture);
+    sys->private_pool = picture_pool_Reserve(display_pool, private_picture);
     if (sys->private_pool == NULL) {
-        if (decoder_pool != NULL)
-            picture_pool_Release(decoder_pool);
-        sys->decoder_pool = NULL;
         goto error;
     }
+    sys->display_pool = display_pool;
 
 #ifdef _WIN32
     var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
@@ -166,17 +126,14 @@ void vout_CloseWrapper(vout_thread_t *vout, vout_display_t *vd)
 {
     vout_thread_sys_t *sys = vout->p;
 
-    assert(vout->p->decoder_pool && vout->p->private_pool);
+    assert(sys->display_pool && sys->private_pool);
 
     picture_pool_Release(sys->private_pool);
-
-    if (sys->display_pool != NULL || vout_IsDisplayFiltered(vd))
-        picture_pool_Release(sys->decoder_pool);
+    sys->display_pool = NULL;
 
 #ifdef _WIN32
     var_DelCallback(vout, "video-wallpaper", Forward, vd);
 #endif
-    sys->decoder_pool = NULL; /* FIXME remove */
 
     vout_display_Delete(vd);
 }
-- 
2.17.1



More information about the vlc-devel mailing list