diff options
author | Luca Abeni <lucabe72@email.it> | 2010-04-28 08:02:52 +0000 |
---|---|---|
committer | Luca Abeni <lucabe72@email.it> | 2010-04-28 08:02:52 +0000 |
commit | b01dba14f36aa3ff3d6fe89acf71eddbd65e7027 (patch) | |
tree | 264c8dd93efea9a9ff348601a3a6422fcbcd5457 /libavdevice/v4l2.c | |
parent | 337104ac1fe3ded85e5d43e5717a7d934e3da6c4 (diff) | |
download | ffmpeg-b01dba14f36aa3ff3d6fe89acf71eddbd65e7027.tar.gz |
Check the return value of device_try_init() immediately after calling such a
function. Avoids the following warning:
libavdevice/v4l2.c: In function ‘v4l2_read_header’:
libavdevice/v4l2.c:586: warning: ‘codec_id’ may be used uninitialized in this function
Originally committed as revision 22986 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavdevice/v4l2.c')
-rw-r--r-- | libavdevice/v4l2.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 724c014ecf..c8854c05c5 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -616,9 +616,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) } desired_format = device_try_init(s1, ap, &s->width, &s->height, &codec_id); - if (avcodec_check_dimensions(s1, s->width, s->height) < 0) - return AVERROR(EINVAL); - if (desired_format == 0) { av_log(s1, AV_LOG_ERROR, "Cannot find a proper format for " "codec_id %d, pix_fmt %d.\n", s1->video_codec_id, ap->pix_fmt); @@ -626,6 +623,8 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) return AVERROR(EIO); } + if (avcodec_check_dimensions(s1, s->width, s->height) < 0) + return AVERROR(EINVAL); s->frame_format = desired_format; if( v4l2_set_parameters( s1, ap ) < 0 ) |