]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix libx264 crash by setting default profile and correcting destroy function
authorcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Tue, 23 Sep 2025 11:29:11 +0000 (11:29 +0000)
committercopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Tue, 23 Sep 2025 11:29:11 +0000 (11:29 +0000)
Co-authored-by: Flole998 <9951871+Flole998@users.noreply.github.com>
src/transcoding/codec/codecs/libs/libx26x.c

index abe3ca443289f03fbba951328e693d73fa2b1c7e..bd60d3e6098862a7b74d1eaf798c36ae16eab184 100644 (file)
@@ -137,6 +137,11 @@ tvh_codec_profile_libx264_open(tvh_codec_profile_libx26x_t *self,
     else {
         AV_DICT_SET_CRF(opts, self->crf, 15);
     }
+    // Set default profile if not specified (to avoid profile 0 error)
+    TVHCodecProfile *base_profile = (TVHCodecProfile *)self;
+    if (base_profile->profile == FF_AV_PROFILE_UNKNOWN) {
+        AV_DICT_SET(opts, "profile", "baseline", AV_DICT_DONT_OVERWRITE);
+    }
     // params
     if (self->params && strlen(self->params)) {
         AV_DICT_SET(opts, "x264-params", self->params, 0);
@@ -212,6 +217,7 @@ TVHVideoCodec tvh_codec_libx264 = {
     .size     = sizeof(tvh_codec_profile_libx26x_t),
     .idclass  = &codec_profile_libx264_class,
     .profiles = libx264_profiles,
+    .profile_init = tvh_codec_profile_video_init,
     .profile_destroy = tvh_codec_profile_libx265_destroy,
 };