[vlc-commits] vpx: fetch quality-mode only one time

Thomas Guillem git at videolan.org
Thu Mar 29 14:04:03 CEST 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Mar 27 11:25:21 2018 +0200| [81a309e574e2e41fe6f08d84ebea6ed923da699a] | committer: Thomas Guillem

vpx: fetch quality-mode only one time

(cherry picked from commit 6f76042990ceaca0c754d830a21cb0580d862517)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/codec/vpx.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/modules/codec/vpx.c b/modules/codec/vpx.c
index 76331a714b..2b1e37818d 100644
--- a/modules/codec/vpx.c
+++ b/modules/codec/vpx.c
@@ -365,6 +365,7 @@ static void CloseDecoder(vlc_object_t *p_this)
 struct encoder_sys_t
 {
     struct vpx_codec_ctx ctx;
+    unsigned long quality;
 };
 
 /*****************************************************************************
@@ -423,6 +424,19 @@ static int OpenEncoder(vlc_object_t *p_this)
     p_enc->fmt_in.i_codec = VLC_CODEC_I420;
     config_ChainParse(p_enc, ENC_CFG_PREFIX, ppsz_sout_options, p_enc->p_cfg);
 
+    /* Deadline (in ms) to spend in encoder */
+    switch (var_GetInteger(p_enc, ENC_CFG_PREFIX "quality-mode")) {
+        case 1:
+            p_sys->quality = VPX_DL_REALTIME;
+            break;
+        case 2:
+            p_sys->quality = VPX_DL_BEST_QUALITY;
+            break;
+        default:
+            p_sys->quality = VPX_DL_GOOD_QUALITY;
+            break;
+    }
+
     return VLC_SUCCESS;
 }
 
@@ -461,21 +475,9 @@ static block_t *Encode(encoder_t *p_enc, picture_t *p_pict)
     }
 
     int flags = 0;
-    /* Deadline (in ms) to spend in encoder */
-    int quality = VPX_DL_GOOD_QUALITY;
-    switch (var_GetInteger(p_enc, ENC_CFG_PREFIX "quality-mode")) {
-        case 1:
-            quality = VPX_DL_REALTIME;
-            break;
-        case 2:
-            quality = VPX_DL_BEST_QUALITY;
-            break;
-        default:
-            break;
-    }
 
     vpx_codec_err_t res = vpx_codec_encode(ctx, &img, p_pict->date, 1,
-     flags, quality);
+     flags, p_sys->quality);
     if (res != VPX_CODEC_OK) {
         VPX_ERR(p_enc, ctx, "Failed to encode frame");
         vpx_img_free(&img);



More information about the vlc-commits mailing list