aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2015-02-16 21:53:27 +0100
committerNicolas George <george@nsup.org>2015-02-26 19:19:56 +0100
commitd92c6d82c03b89d565f70e7a8e5b03b25f78f70c (patch)
tree6502009c4f186100d2a6eae1d895853556560bd8
parent508d6a23b4530d0f3d31451731e5fd1fce32525f (diff)
downloadffmpeg-d92c6d82c03b89d565f70e7a8e5b03b25f78f70c.tar.gz
ffmpeg: notify when the thread message queue blocks.
This can help finding the source of A-V desync with live input.
-rw-r--r--ffmpeg.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 54ba0cbb28..c6f3dcdbde 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,