diff mbox series

[FFmpeg-devel] avcodec/libxvid: remove unnecessary output packet data check

Message ID 20210319020157.606-1-jamrial@gmail.com
State Accepted
Commit cad3a5d715a8da2d449b41d3801480fb50d638c2
Headers show
Series [FFmpeg-devel] avcodec/libxvid: remove unnecessary output packet data check
Related show

Checks

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

James Almer March 19, 2021, 2:01 a.m. UTC
The user buffers passed to avcodec_encode_video2() haven't been propagated to
AVCodec.encode2 implementations since 93016f5d1d280f9cb7856883af287fa66affc04c.
Also, the generic encode code already unrefs the packet if nothing was encoded.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/libxvid.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

James Almer March 26, 2021, 6:41 p.m. UTC | #1
On 3/18/2021 11:01 PM, James Almer wrote:
> The user buffers passed to avcodec_encode_video2() haven't been propagated to
> AVCodec.encode2 implementations since 93016f5d1d280f9cb7856883af287fa66affc04c.
> Also, the generic encode code already unrefs the packet if nothing was encoded.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavcodec/libxvid.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
> index 50601807a7..cb9135436a 100644
> --- a/libavcodec/libxvid.c
> +++ b/libavcodec/libxvid.c
> @@ -738,7 +738,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>   static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
>                                const AVFrame *picture, int *got_packet)
>   {
> -    int xerr, i, ret, user_packet = !!pkt->data;
> +    int xerr, i, ret;
>       struct xvid_context *x = avctx->priv_data;
>       int mb_width  = (avctx->width  + 15) / 16;
>       int mb_height = (avctx->height + 15) / 16;
> @@ -866,8 +866,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
>   
>           return 0;
>       } else {
> -        if (!user_packet)
> -            av_packet_unref(pkt);
>           if (!xerr)
>               return 0;
>           av_log(avctx, AV_LOG_ERROR,

Will apply
diff mbox series

Patch

diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index 50601807a7..cb9135436a 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -738,7 +738,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
 static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
                              const AVFrame *picture, int *got_packet)
 {
-    int xerr, i, ret, user_packet = !!pkt->data;
+    int xerr, i, ret;
     struct xvid_context *x = avctx->priv_data;
     int mb_width  = (avctx->width  + 15) / 16;
     int mb_height = (avctx->height + 15) / 16;
@@ -866,8 +866,6 @@  FF_ENABLE_DEPRECATION_WARNINGS
 
         return 0;
     } else {
-        if (!user_packet)
-            av_packet_unref(pkt);
         if (!xerr)
             return 0;
         av_log(avctx, AV_LOG_ERROR,