diff mbox series

[FFmpeg-devel,5/7] avcodec/get_buffer: Don't get AVPixFmtDescriptor unnecessarily

Message ID HE1PR0101MB2219982BAE1D4588088A3DCA8F689@HE1PR0101MB2219.eurprd01.prod.exchangelabs.com
State Accepted
Commit f76cef5c518a9874ec4e3b4b36c5b909c3452919
Headers show
Series [FFmpeg-devel,1/7] avcodec/h263dec: Remove redundant code to set cur_pic_ptr | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 15, 2022, 11:52 a.m. UTC
It is unused since 3575a495f6dcc395656343380e13c57d48b9f976
(and the error message is dangerous: av_get_pix_fmt_name(format)
returns NULL iff av_pix_fmt_desc_get(format) returns NULL
and using a NULL string for %s would be UB).

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

Patch

diff --git a/libavcodec/get_buffer.c b/libavcodec/get_buffer.c
index 3e45a0479f..a04fd878de 100644
--- a/libavcodec/get_buffer.c
+++ b/libavcodec/get_buffer.c
@@ -246,7 +246,6 @@  fail:
 static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
 {
     FramePool *pool = (FramePool*)s->internal->pool->data;
-    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pic->format);
     int i;
 
     if (pic->data[0] || pic->data[1] || pic->data[2] || pic->data[3]) {
@@ -254,13 +253,6 @@  static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
         return -1;
     }
 
-    if (!desc) {
-        av_log(s, AV_LOG_ERROR,
-            "Unable to get pixel format descriptor for format %s\n",
-            av_get_pix_fmt_name(pic->format));
-        return AVERROR(EINVAL);
-    }
-
     memset(pic->data, 0, sizeof(pic->data));
     pic->extended_data = pic->data;