diff mbox series

[FFmpeg-devel,2/2] avcodec/bsf: Simplify getting codec name

Message ID HE1PR0301MB215464CC65D62C1E2FAA987C8F7A9@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit 3e16d1c8a63f68b882acab980b2ecc7ce7cc14f6
Headers show
Series [FFmpeg-devel,1/2] avcodec/bsf: Fix segfault when freeing half-allocated BSF
Related show


Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt April 2, 2021, 1:26 p.m. UTC
All codec ids on BSF whitelists have a codec descriptor, so one can just
use avcodec_get_name() without worrying about the case of what happens
when no codec descriptor is found.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
 libavcodec/bsf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series


diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index 157984bd9a..543fe87b30 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -160,9 +160,9 @@  int av_bsf_init(AVBSFContext *ctx)
                    "bitstream filter '%s'. Supported codecs are: ",
                    desc ? desc->name : "unknown", ctx->par_in->codec_id, ctx->filter->name);
             for (i = 0; ctx->filter->codec_ids[i] != AV_CODEC_ID_NONE; i++) {
-                desc = avcodec_descriptor_get(ctx->filter->codec_ids[i]);
+                enum AVCodecID codec_id = ctx->filter->codec_ids[i];
                 av_log(ctx, AV_LOG_ERROR, "%s (%d) ",
-                       desc ? desc->name : "unknown", ctx->filter->codec_ids[i]);
+                       avcodec_get_name(codec_id), codec_id);
             av_log(ctx, AV_LOG_ERROR, "\n");
             return AVERROR(EINVAL);