[FFmpeg-devel] [PATCH] avcodec/videotoolboxenc: don't wait when flushing data
Steven Liu
lq at chinaffmpeg.org
Thu Aug 27 05:53:27 EEST 2020
From: Tian Qi <tianqi at kuaishou.com>
because there is run in thread mode, few times will block
the workflow at the wait, so check the status is flushing data,
don't wait when flushing data.
Signed-off-by: Tian Qi <tianqi at kuaishou.com>
Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
libavcodec/videotoolboxenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index e89cfaeed8..f9626be18f 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -292,7 +292,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef *buf, E
return 0;
}
- while (!vtctx->q_head && !vtctx->async_error && wait) {
+ while (!vtctx->q_head && !vtctx->async_error && wait && !vtctx->flushing) {
pthread_cond_wait(&vtctx->cv_sample_sent, &vtctx->lock);
}
@@ -308,6 +308,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef *buf, E
vtctx->q_tail = NULL;
}
+ vtctx->frame_ct_out++;
pthread_mutex_unlock(&vtctx->lock);
*buf = info->cm_buffer;
@@ -319,7 +320,6 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef *buf, E
}
av_free(info);
- vtctx->frame_ct_out++;
return 0;
}
--
2.25.0
More information about the ffmpeg-devel
mailing list