]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix root cause: make tvh_codec_get_codec more defensive to prevent NULL codecs
authorcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Tue, 23 Sep 2025 12:05:04 +0000 (12:05 +0000)
committercopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Tue, 23 Sep 2025 12:05:04 +0000 (12:05 +0000)
Co-authored-by: Flole998 <9951871+Flole998@users.noreply.github.com>
src/transcoding/codec/codec.c
src/transcoding/transcode/context.c

index 6e5d1e3e78f8031e2701cba2a313cfc74e96237e..38f78c8cac247da8fba25466dfb9d5fec0d8ece7 100644 (file)
@@ -231,7 +231,7 @@ tvh_codec_get_type_string(TVHCodec *self)
 const AVCodec *
 tvh_codec_get_codec(TVHCodec *self)
 {
-    return self->codec;
+    return self ? self->codec : NULL;
 }
 
 
index c2bc8a0e353634aa1530e5c77cd7dd6671e7d4d8..6d939e8f034e434cb0299f65d7e406cce35006e6 100644 (file)
@@ -240,12 +240,6 @@ tvh_context_setup(TVHContext *self, const AVCodec *iavcodec, const AVCodec *oavc
     enum AVMediaType media_type = iavcodec->type;
     const char *media_type_name = av_get_media_type_string(media_type);
 
-    if (!iavcodec || !oavcodec) {
-        tvh_stream_log(self->stream, LOG_ERR,
-                       "invalid codec parameters: input=%p output=%p",
-                       iavcodec, oavcodec);
-        return -1;
-    }
     if (!(self->type = tvh_context_type_find(media_type))) {
         tvh_stream_log(self->stream, LOG_ERR,
                        "failed to find context type for '%s' media type",