vaapi_encode: Fix fallback when input does not match any format
authorMark Thompson <sw@jkqxz.net>
Sat, 18 Jun 2016 12:05:23 +0000 (13:05 +0100)
committerMark Thompson <sw@jkqxz.net>
Tue, 21 Jun 2016 19:42:22 +0000 (20:42 +0100)
Just a typo.  Add a comment to make it clearer what it's doing.

libavcodec/vaapi_encode.c

index 45f5e57..c3f4e44 100644 (file)
@@ -1114,8 +1114,11 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx,
                 break;
             }
         }
-        if (recon_format == AV_PIX_FMT_NONE)
-            recon_format = constraints->valid_sw_formats[i];
+        if (recon_format == AV_PIX_FMT_NONE) {
+            // No match.  Just use the first in the supported list and
+            // hope for the best.
+            recon_format = constraints->valid_sw_formats[0];
+        }
     } else {
         // No idea what to use; copy input format.
         recon_format = ctx->input_frames->sw_format;