[FFmpeg-devel] [PATCH 03/50] avcodec/frame_thread_encoder: remove av_init_packet() call

James Almer jamrial at gmail.com
Thu Feb 4 21:09:18 EET 2021


The packet was allocated with av_packet_alloc(), so it's redundant.

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

diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c
index 83229f620a..9ae9d72934 100644
--- a/libavcodec/frame_thread_encoder.c
+++ b/libavcodec/frame_thread_encoder.c
@@ -72,7 +72,6 @@ static void * attribute_align_arg worker(void *v){
 
         if(!pkt) pkt = av_packet_alloc();
         if(!pkt) continue;
-        av_init_packet(pkt);
 
         pthread_mutex_lock(&c->task_fifo_mutex);
         while (av_fifo_size(c->task_fifo) <= 0 || atomic_load(&c->exit)) {
@@ -107,7 +106,7 @@ static void * attribute_align_arg worker(void *v){
         pthread_mutex_unlock(&c->finished_task_mutex);
     }
 end:
-    av_free(pkt);
+    av_packet_free(&pkt);
     pthread_mutex_lock(&c->buffer_mutex);
     avcodec_close(avctx);
     pthread_mutex_unlock(&c->buffer_mutex);
-- 
2.30.0



More information about the ffmpeg-devel mailing list