[vlc-commits] avcodec: vaapi: reduce variable scope

Thomas Guillem git at videolan.org
Sun Sep 3 09:21:13 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Sep  3 09:17:02 2017 +0200| [9507b5b8aa185df45dd52057396494c884bd8857] | committer: Thomas Guillem

avcodec: vaapi: reduce variable scope

Closes CID #1417232

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

 modules/codec/avcodec/vaapi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index 957bb7b8a8..58d40df563 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -288,7 +288,6 @@ static int CreateDRM(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt
     VANativeDisplay native = NULL;
     vlc_vaapi_native_destroy_cb native_destroy_cb = NULL;
 
-    int drm_fd = -1;
     static const char drm_device_paths[][20] = {
         "/dev/dri/renderD128",
         "/dev/dri/card0"
@@ -296,7 +295,7 @@ static int CreateDRM(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt
 
     for (int i = 0; ARRAY_SIZE(drm_device_paths); i++)
     {
-        drm_fd = vlc_open(drm_device_paths[i], O_RDWR);
+        int drm_fd = vlc_open(drm_device_paths[i], O_RDWR);
         if (drm_fd < 0)
             continue;
 
@@ -309,7 +308,6 @@ static int CreateDRM(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt
         }
 
         vlc_close(drm_fd);
-        drm_fd = -1;
     }
 
     if (sys->hw_ctx.display == NULL)



More information about the vlc-commits mailing list