[FFmpeg-cvslog] avcodec/frame_thread_encoder: Forward got_packet directly

Andreas Rheinhardt git at videolan.org
Sat Aug 27 05:29:12 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Aug 23 22:38:24 2022 +0200| [4dddcd08c47850fbf3cef2ff6b31f65133856e0f] | committer: Andreas Rheinhardt

avcodec/frame_thread_encoder: Forward got_packet directly

Instead of indicating whether we got a packet by setting
pkt->data and pkt->size to zero.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/frame_thread_encoder.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c
index 07d310a986..b5765b6343 100644
--- a/libavcodec/frame_thread_encoder.c
+++ b/libavcodec/frame_thread_encoder.c
@@ -45,6 +45,7 @@ typedef struct{
     AVPacket *outdata;
     int       return_code;
     int       finished;
+    int       got_packet;
 } Task;
 
 typedef struct{
@@ -110,10 +111,8 @@ static void * attribute_align_arg worker(void *v){
             if (ret >= 0 && ret2 < 0)
                 ret = ret2;
             pkt->pts = pkt->dts = frame->pts;
-        } else {
-            pkt->data = NULL;
-            pkt->size = 0;
         }
+        task->got_packet = got_packet;
         pthread_mutex_lock(&c->buffer_mutex);
         av_frame_unref(frame);
         pthread_mutex_unlock(&c->buffer_mutex);
@@ -315,8 +314,7 @@ int ff_thread_video_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
      * because there is no outstanding task with this index. */
     outtask->finished = 0;
     av_packet_move_ref(pkt, outtask->outdata);
-    if(pkt->data)
-        *got_packet_ptr = 1;
+    *got_packet_ptr = outtask->got_packet;
     c->finished_task_index = (c->finished_task_index + 1) % c->max_tasks;
 
     return outtask->return_code;



More information about the ffmpeg-cvslog mailing list