You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avcodec/v4l2_context: Log warning when all capture buffers are in userspace
v4l2_m2m uses device memory mapped buffers to store dequeued frames/packets (reference counted by AVBufferRef). When the reference count drops to zero, the buffer ownership is returned back to the device, so that they can re-filled with frames/packets. There are some cases when all the capture buffers are in userspace (i.e. due to internal buffering in ffmpeg). On the s5p-mfc this causes an infinite wait when polling to dequeue the buffers, which can be prevented by increasing the total number of buffers. This commit adds a warning when all the capture buffers are dequeued. Reviewed-by: Ming Qian <ming.qian@nxp.com> Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
This commit is contained in:
@@ -291,6 +291,18 @@ static V4L2Buffer* v4l2_dequeue_v4l2buf(V4L2Context *ctx, int timeout)
|
|||||||
};
|
};
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
|
if (!V4L2_TYPE_IS_OUTPUT(ctx->type) && ctx->buffers) {
|
||||||
|
for (i = 0; i < ctx->num_buffers; i++) {
|
||||||
|
if (ctx->buffers[i].status == V4L2BUF_IN_DRIVER)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == ctx->num_buffers)
|
||||||
|
av_log(logger(ctx), AV_LOG_WARNING, "All capture buffers returned to "
|
||||||
|
"userspace. Increase num_capture_buffers "
|
||||||
|
"to prevent device deadlock or dropped "
|
||||||
|
"packets/frames.\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* if we are draining and there are no more capture buffers queued in the driver we are done */
|
/* if we are draining and there are no more capture buffers queued in the driver we are done */
|
||||||
if (!V4L2_TYPE_IS_OUTPUT(ctx->type) && ctx_to_m2mctx(ctx)->draining) {
|
if (!V4L2_TYPE_IS_OUTPUT(ctx->type) && ctx_to_m2mctx(ctx)->draining) {
|
||||||
for (i = 0; i < ctx->num_buffers; i++) {
|
for (i = 0; i < ctx->num_buffers; i++) {
|
||||||
|
Reference in New Issue
Block a user