[vlc-commits] vdpau: add two buffer per decoder thread

Rémi Denis-Courmont git at videolan.org
Wed Nov 30 21:40:11 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Nov 30 22:39:26 2016 +0200| [a910b64b2cec0f5f39ebb6c86423a62722f88608] | committer: Rémi Denis-Courmont

vdpau: add two buffer per decoder thread

Now that we do not allow arbitrary large buffers (to avoid crashing the
GPU), the initial boundary needs to be large enough for smooth decoding.

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

 modules/hw/vdpau/avcodec.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index ac95dc9..53ed6d9 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -153,7 +153,7 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt,
         return VLC_EGENERIC;
     }
 
-    unsigned refs = avctx->refs + avctx->thread_count + 5;
+    unsigned refs = avctx->refs + 2 * avctx->thread_count + 5;
     vlc_va_sys_t *sys = malloc(sizeof (*sys)
                                + (refs + 1) * sizeof (sys->pool[0]));
     if (unlikely(sys == NULL))
@@ -199,6 +199,10 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt,
         goto error;
     }
 
+    if (i < refs)
+        msg_Warn(va, "video RAM low (allocated %u of %u buffers)",
+                 i, refs);
+
     const char *infos;
     if (vdp_get_information_string(sys->vdp, &infos) != VDP_STATUS_OK)
         infos = "VDPAU";



More information about the vlc-commits mailing list