From 002c8a50c5efcf5c6ff511c22f0df5b00c472549 Mon Sep 17 00:00:00 2001
From: Giorgio Vazzana <mywing81@gmail.com>
Date: Thu, 6 Nov 2014 16:03:05 +0100
Subject: [PATCH] lavd/v4l2: revert b1ad9312331759679a9c956233716a67ae681d89

---
 libavdevice/v4l2.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 783a03c..caddf8e 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -881,9 +881,6 @@ static int v4l2_read_header(AVFormatContext *ctx)
 
     avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
 
-    if ((res = v4l2_set_parameters(ctx)) < 0)
-        goto fail;
-
     if (s->pixel_format) {
         AVCodec *codec = avcodec_find_decoder_by_name(s->pixel_format);
 
@@ -934,6 +931,9 @@ static int v4l2_read_header(AVFormatContext *ctx)
 
     s->pixelformat = desired_format;
 
+    if ((res = v4l2_set_parameters(ctx)) < 0)
+        goto fail;
+
     st->codec->pix_fmt = ff_fmt_v4l2ff(desired_format, codec_id);
     s->frame_size =
         avpicture_get_size(st->codec->pix_fmt, s->width, s->height);
-- 
1.7.9.5

