From: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Date: Tue, 23 Sep 2025 11:29:11 +0000 (+0000) Subject: Fix libx264 crash by setting default profile and correcting destroy function X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4e81f199708d29c4c4830f84b5c072c494fd67a6;p=thirdparty%2Ftvheadend.git Fix libx264 crash by setting default profile and correcting destroy function Co-authored-by: Flole998 <9951871+Flole998@users.noreply.github.com> --- diff --git a/src/transcoding/codec/codecs/libs/libx26x.c b/src/transcoding/codec/codecs/libs/libx26x.c index abe3ca443..bd60d3e60 100644 --- a/src/transcoding/codec/codecs/libs/libx26x.c +++ b/src/transcoding/codec/codecs/libs/libx26x.c @@ -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, };