[vlc-devel] [PATCH 8/9] decoder: do not use the DPB size to configure the display module

Steve Lhomme robux4 at ycbcr.xyz
Fri Oct 18 17:11:13 CEST 2019


The decoders all have their own pool now.
---
 src/audio_output/filters.c       |  2 +-
 src/input/decoder.c              |  3 +--
 src/video_output/video_output.c  | 12 ++++--------
 src/video_output/vout_internal.h |  4 +---
 src/video_output/vout_wrapper.c  | 12 +++---------
 5 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index 8a1ea0df9c6..a297f4c6974 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -390,7 +390,7 @@ vout_thread_t *aout_filter_GetVout(filter_t *filter, const video_format_t *fmt)
 
     video_format_t adj_fmt = *fmt;
     vout_configuration_t cfg = {
-        .vout = vout, .clock = filter->owner.sys, .fmt = &adj_fmt, .dpb_size = 1,
+        .vout = vout, .clock = filter->owner.sys, .fmt = &adj_fmt,
     };
 
     video_format_AdjustColorSpace(&adj_fmt);
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 46cf7658b8a..f4f0f654080 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -521,7 +521,7 @@ static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec, vlc_video_context *
     int res;
     if (p_owner->vout_thread_started)
     {
-        res = vout_ChangeSource(p_vout, &fmt, 0);
+        res = vout_ChangeSource(p_vout, &fmt);
         if (res == 0)
             // the display/thread is started and can handle the new source format
             return 0;
@@ -529,7 +529,6 @@ static int ModuleThread_UpdateVideoFormat( decoder_t *p_dec, vlc_video_context *
 
     vout_configuration_t cfg = {
         .vout = p_vout, .clock = p_owner->p_clock, .fmt = &fmt,
-        .dpb_size = 0,
         .mouse_event = MouseEvent, .mouse_opaque = p_dec,
     };
     res = input_resource_StartVout( p_owner->p_resource, vctx, &cfg);
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 930a5b61b49..caf11a818a2 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1508,7 +1508,6 @@ static int vout_Start(vout_thread_t *vout, vlc_video_context *vctx, const vout_c
     sys->mouse_opaque = cfg->mouse_opaque;
     vlc_mouse_Init(&sys->mouse);
 
-    sys->dpb_size = cfg->dpb_size;
     sys->decoder_fifo = picture_fifo_New();
     sys->decoder_pool = NULL;
     sys->display_pool = NULL;
@@ -1954,7 +1953,7 @@ vout_thread_t *vout_Hold(vout_thread_t *vout)
     return vout;
 }
 
-int vout_ChangeSource( vout_thread_t *vout, const video_format_t *original, unsigned dpb_size )
+int vout_ChangeSource( vout_thread_t *vout, const video_format_t *original )
 {
     vout_thread_sys_t *sys = vout->p;
 
@@ -1962,11 +1961,8 @@ int vout_ChangeSource( vout_thread_t *vout, const video_format_t *original, unsi
      * ratio and crop settings, instead of recreating a display.
      */
     if (video_format_IsSimilar(original, &sys->original)) {
-        if (dpb_size <= sys->dpb_size) {
-            /* It is assumed that the SPU input matches input already. */
-            return 0;
-        }
-        msg_Warn(vout, "DPB need to be increased");
+        /* It is assumed that the SPU input matches input already. */
+        return 0;
     }
 
     return -1;
@@ -2029,7 +2025,7 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input
     video_format_t original;
     VoutFixFormat(&original, cfg->fmt);
 
-    if (vout_ChangeSource(vout, &original, 0) == 0)
+    if (vout_ChangeSource(vout, &original) == 0)
     {
         video_format_Clean(&original);
         return 0;
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index d7bd809e5dc..ce9c28ee035 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -55,7 +55,6 @@ typedef struct {
     vout_thread_t        *vout;
     vlc_clock_t          *clock;
     const video_format_t *fmt;
-    unsigned             dpb_size;
     vlc_mouse_event      mouse_event;
     void                 *mouse_opaque;
 } vout_configuration_t;
@@ -108,7 +107,6 @@ struct vout_thread_sys_t
             };
         } crop;
     } source;
-    unsigned        dpb_size;
 
     /* Snapshot interface */
     struct vout_snapshot *snapshot;
@@ -253,7 +251,7 @@ void vout_Close( vout_thread_t *p_vout );
  * \retval 0 on success
  * \retval -1 on error, the vout needs to be restarted to handle the format
  */
-int vout_ChangeSource( vout_thread_t *p_vout, const video_format_t *fmt, unsigned dpb_size );
+int vout_ChangeSource( vout_thread_t *p_vout, const video_format_t *fmt );
 
 /* TODO to move them to vlc_vout.h */
 void vout_ChangeFullscreen(vout_thread_t *, const char *id);
diff --git a/src/video_output/vout_wrapper.c b/src/video_output/vout_wrapper.c
index 1f745f97ef5..c9d5fc1c677 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -86,7 +86,6 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
     const bool use_dr = !vout_IsDisplayFiltered(vd);
     const bool allow_dr = !vd->info.has_pictures_invalid && use_dr;
     const unsigned private_picture  = 4; /* XXX 3 for filter, 1 for SPU */
-    unsigned decoder_picture  = 1 + sys->dpb_size;
     const unsigned kept_picture     = 1; /* last displayed picture */
     const unsigned reserved_picture = DISPLAY_PICTURE_COUNT +
                                       private_picture +
@@ -103,11 +102,10 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
     case VLC_VIDEO_CONTEXT_DXVA2:
     case VLC_VIDEO_CONTEXT_D3D11VA:
         display_pool_size = reserved_picture;
-        decoder_picture = 0;
         break;
     default:
         display_pool_size = allow_dr ? __MAX(VOUT_MAX_PICTURES,
-                                             reserved_picture + decoder_picture) : 3;
+                                             reserved_picture) : 3;
         break;
     }
 
@@ -124,21 +122,17 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
 #endif
 
     if (allow_dr &&
-        picture_pool_GetSize(display_pool) >= reserved_picture + decoder_picture) {
-        sys->dpb_size     = picture_pool_GetSize(display_pool) - reserved_picture;
+        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 + decoder_picture - DISPLAY_PICTURE_COUNT));
+                                             reserved_picture - DISPLAY_PICTURE_COUNT));
         if (!sys->decoder_pool)
             goto error;
         if (allow_dr) {
             msg_Warn(vout, "Not enough direct buffers, using system memory");
-            sys->dpb_size = 0;
-        } else {
-            sys->dpb_size = picture_pool_GetSize(sys->decoder_pool) - reserved_picture;
         }
         if (use_dr)
             sys->display_pool = vout_GetPool(vd, 3);
-- 
2.17.1



More information about the vlc-devel mailing list