[vlc-commits] [Git][videolan/vlc][master] 2 commits: qsv: remove commented code

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu May 25 14:13:04 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b3df4c69 by Alaric Senat at 2023-05-25T13:57:11+00:00
qsv: remove commented code

This code is commented since the 2013 release of the module.

- - - - -
78cd293f by Alaric Senat at 2023-05-25T13:57:11+00:00
qsv: fix an error handling crash

By delaying `encoder->p_sys` initialization, a03fdfd9c1dc2cc99b30868de93c3eacd60cc478
introduced a crash due to `Close` requiring `encoder->p_sys` to be
valid.

This patches refactors the encoder closure to workaround that.

- - - - -


1 changed file:

- modules/codec/qsv.c


Changes:

=====================================
modules/codec/qsv.c
=====================================
@@ -364,6 +364,19 @@ static uint64_t qsv_params_get_value(const char *const *text,
     return list[result];
 }
 
+static void delete_sys(encoder_sys_t *sys)
+{
+    MFXVideoENCODE_Close(sys->session);
+    MFXClose(sys->session);
+
+    assert(vlc_list_is_empty(&sys->packets));
+
+    if (sys->input_pool)
+        picture_pool_Release(sys->input_pool);
+
+    free(sys);
+}
+
 static int Open(vlc_object_t *this)
 {
     encoder_t *enc = (encoder_t *)this;
@@ -629,25 +642,16 @@ static int Open(vlc_object_t *this)
     return VLC_SUCCESS;
 
  error:
-    Close(enc);
+    delete_sys(sys);
     return VLC_EGENERIC;
  nomem:
-    Close(enc);
+    delete_sys(sys);
     return VLC_ENOMEM;
 }
 
 static void Close(encoder_t *enc)
 {
-    encoder_sys_t *sys = enc->p_sys;
-
-    MFXVideoENCODE_Close(sys->session);
-    MFXClose(sys->session);
-    /* if (enc->fmt_out.p_extra) */
-    /*     free(enc->fmt_out.p_extra); */
-    assert(vlc_list_is_empty(&sys->packets));
-    if (sys->input_pool)
-        picture_pool_Release(sys->input_pool);
-    free(sys);
+    delete_sys(enc->p_sys);
 }
 
 /*



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8e3fff08a3d617761f7d7b0e55ba6323d0f79287...78cd293ffc5b777f2ca05010b11c565eb30ad035

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8e3fff08a3d617761f7d7b0e55ba6323d0f79287...78cd293ffc5b777f2ca05010b11c565eb30ad035
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list