[FFmpeg-devel] [PATCH 2/2] ffmpeg: notify when the thread message queue blocks.
Nicolas George
george at nsup.org
Wed Feb 25 12:01:27 CET 2015
This can help finding the source of A-V desync with live input.
Signed-off-by: Nicolas George <george at nsup.org>
---
ffmpeg.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
No functional change since the first version, but reworded to point to the
relevant option and give the current value.
diff --git a/ffmpeg.c b/ffmpeg.c
index 54ba0cb..c6f3dcd 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3356,6 +3356,7 @@ static int check_keyboard_interaction(int64_t cur_time)
static void *input_thread(void *arg)
{
InputFile *f = arg;
+ unsigned flags = f->non_blocking ? AV_THREAD_MESSAGE_NONBLOCK : 0;
int ret = 0;
while (1) {
@@ -3371,7 +3372,15 @@ static void *input_thread(void *arg)
break;
}
av_dup_packet(&pkt);
- ret = av_thread_message_queue_send(f->in_thread_queue, &pkt, 0);
+ ret = av_thread_message_queue_send(f->in_thread_queue, &pkt, flags);
+ if (flags && ret == AVERROR(EAGAIN)) {
+ flags = 0;
+ ret = av_thread_message_queue_send(f->in_thread_queue, &pkt, flags);
+ av_log(f->ctx, AV_LOG_WARNING,
+ "Thread message queue blocking; consider raising the "
+ "thread_queue_size option (current value: %d)\n",
+ f->thread_queue_size);
+ }
if (ret < 0) {
if (ret != AVERROR_EOF)
av_log(f->ctx, AV_LOG_ERROR,
--
2.1.4
More information about the ffmpeg-devel
mailing list