diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-23 22:38:24 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-27 02:23:43 +0200 |
commit | 4dddcd08c47850fbf3cef2ff6b31f65133856e0f (patch) | |
tree | 8f65b0205b303b00ae6dbe7373b3fdfcc8b64a95 /libavcodec/frame_thread_encoder.c | |
parent | 312d4467f379d34257f60aeb7ad88fb29b11caeb (diff) | |
download | ffmpeg-4dddcd08c47850fbf3cef2ff6b31f65133856e0f.tar.gz |
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@outlook.com>
Diffstat (limited to 'libavcodec/frame_thread_encoder.c')
-rw-r--r-- | libavcodec/frame_thread_encoder.c | 8 |
1 files 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; |