[FFmpeg-cvslog] avcodec/frame_thread_encoder: Improve type safety

Andreas Rheinhardt git at videolan.org
Tue Feb 16 23:43:31 EET 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Sun Feb  7 10:48:17 2021 +0100| [e0f5086fabe6feef362b9398a41ef30de07a08ee] | committer: Andreas Rheinhardt

avcodec/frame_thread_encoder: Improve type safety

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e0f5086fabe6feef362b9398a41ef30de07a08ee
---

 libavcodec/frame_thread_encoder.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c
index 83229f620a..ee289c90e3 100644
--- a/libavcodec/frame_thread_encoder.c
+++ b/libavcodec/frame_thread_encoder.c
@@ -35,8 +35,8 @@
 #define BUFFER_SIZE (2*MAX_THREADS)
 
 typedef struct{
-    void *indata;
-    void *outdata;
+    AVFrame  *indata;
+    AVPacket *outdata;
     int64_t return_code;
     unsigned index;
 } Task;
@@ -255,19 +255,12 @@ void ff_frame_thread_encoder_free(AVCodecContext *avctx){
 
     while (av_fifo_size(c->task_fifo) > 0) {
         Task task;
-        AVFrame *frame;
         av_fifo_generic_read(c->task_fifo, &task, sizeof(task), NULL);
-        frame = task.indata;
-        av_frame_free(&frame);
-        task.indata = NULL;
+        av_frame_free(&task.indata);
     }
 
     for (i=0; i<BUFFER_SIZE; i++) {
-        if (c->finished_tasks[i].outdata != NULL) {
-            AVPacket *pkt = c->finished_tasks[i].outdata;
-            av_packet_free(&pkt);
-            c->finished_tasks[i].outdata = NULL;
-        }
+        av_packet_free(&c->finished_tasks[i].outdata);
     }
 
     pthread_mutex_destroy(&c->task_fifo_mutex);



More information about the ffmpeg-cvslog mailing list