[FFmpeg-devel] [PATCHv3 4/4] libavcodec: v4l2: add support for v4l2 mem2mem codecs
Jorge Ramirez
jorge.ramirez-ortiz at linaro.org
Fri Aug 4 11:46:53 EEST 2017
On 08/03/2017 01:53 AM, Mark Thompson wrote:
agree with all your previous comments up to here (will fix).
>> + case V4L2_BUF_TYPE_VIDEO_OUTPUT:
>> + case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
>> + pfd.events = POLLOUT | POLLERR | POLLWRNORM;
>> + break;
>> + default:
>> + pfd.events = POLLIN | POLLERR | POLLRDNORM;
> What hits this default case?
nothing, it can't happen will remove.
>
>> + }
>> +
>> + ret = poll(&pfd, 1, timeout);
> Can this poll be interrupted?
yes. when that happens, we indicate no buffer available.
I think the main program should set the necessary masks.
>> + if (ret <= 0)
>> + return NULL;
>> +
>> + memset(&buf, 0, sizeof(buf));
>> + buf.memory = bp->memory;
>> + buf.type = bp->type;
>> + if (V4L2_TYPE_IS_MULTIPLANAR(bp->type)) {
>> + memset(planes, 0, sizeof(planes));
>> + buf.length = VIDEO_MAX_PLANES;
>> + buf.m.planes = planes;
>> + }
>> + ret = ioctl(bp->fd, VIDIOC_DQBUF, &buf);
>> + if (ret) {
>> + if (errno != EAGAIN && errno != EINVAL) {
> EINVAL is considered ok?
no any ioctl that returns non zero is a fault condition.
EINVAL (just as EAGAIN) is just not an unrecoverable error (we will just
return null indicating that there is no buffer available)
>
>> + av_log(bp->log_ctx, AV_LOG_DEBUG, "%s: VIDIOC_DQBUF, errno (%d)\n", bp->name, errno);
>> + bp->broken = errno;
> errno can be overwritten by the av_log() call.
OK.
>
>> + }
>> + return NULL;
>> + }
>> +
More information about the ffmpeg-devel
mailing list