On Mon, Sep 01, 2014 at 11:00:14PM +0200, Giorgio Vazzana wrote: > 2014-09-01 22:46 GMT+02:00 Reimar Döffinger <reimar.doeffin...@gmx.de>: > > On Mon, Sep 01, 2014 at 10:33:15PM +0200, Giorgio Vazzana wrote: > >> +static int enqueue_buffer(struct video_data *s, struct v4l2_buffer *buf) > >> +{ > >> + int res = 0; > >> + > >> + if (v4l2_ioctl(s->fd, VIDIOC_QBUF, buf) < 0) { > >> + res = AVERROR(errno); > >> + av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n", > >> av_err2str(res)); > >> + } else { > >> + avpriv_atomic_int_add_and_fetch(&s->buffers_queued, 1); > >> + } > >> + > >> + return res; > > > > Nit: I'd prefer something simpler that avoids cluttering the normal path > > because of error handling like: > > > >> + if (v4l2_ioctl(s->fd, VIDIOC_QBUF, buf) < 0) { > >> + av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n", > >> av_err2str(res)); > >> + return AVERROR(errno); > > If we call av_log(), errno is not guaranteed to be the same after the > call. Also, av_err2str() needs AVERROR(errno).
Hmm... if (v4l2_ioctl(s->fd, VIDIOC_QBUF, buf) < 0) { int res = AVERROR(errno); av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n", av_err2str(res)); return res; } avpriv_atomic_int_add_and_fetch(&s->buffers_queued, 1); return 0; Yeah, I guess then it's not really better than your variant anymore, so whatever you want. I haven't reviewed it all that well, but in principle the patch looks good to me, but it might be better to wait until we get a test result? _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel