encoder: h264: fix level when bitrate is automatically computed.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Tue, 21 Jan 2014 16:04:40 +0000 (17:04 +0100)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 22 Jan 2014 17:30:26 +0000 (18:30 +0100)
Fix level characterisation when the bitrate is automatically computed
from the active coding tools. i.e. ensure the bitrate once the profile
is completely characterized but before the level calculation process.

gst-libs/gst/vaapi/gstvaapiencoder_h264.c

index 57b004b..e8008f4 100644 (file)
@@ -1511,14 +1511,16 @@ ensure_profile_and_level (GstVaapiEncoderH264 * encoder)
   if (!ensure_profile (encoder) || !ensure_profile_limits (encoder))
     return GST_VAAPI_ENCODER_STATUS_ERROR_UNSUPPORTED_PROFILE;
 
-  if (!ensure_level (encoder))
-    return GST_VAAPI_ENCODER_STATUS_ERROR_OPERATION_FAILED;
-
   /* Check HW constraints */
   if (!ensure_hw_profile_limits (encoder))
     return GST_VAAPI_ENCODER_STATUS_ERROR_UNSUPPORTED_PROFILE;
   if (encoder->profile_idc > encoder->hw_max_profile_idc)
     return GST_VAAPI_ENCODER_STATUS_ERROR_UNSUPPORTED_PROFILE;
+
+  /* Ensure bitrate if not set already and derive the right level to use */
+  ensure_bitrate (encoder);
+  if (!ensure_level (encoder))
+    return GST_VAAPI_ENCODER_STATUS_ERROR_OPERATION_FAILED;
   return GST_VAAPI_ENCODER_STATUS_SUCCESS;
 }
 
@@ -1874,8 +1876,6 @@ gst_vaapi_encoder_h264_reconfigure (GstVaapiEncoder * base_encoder)
   if (status != GST_VAAPI_ENCODER_STATUS_SUCCESS)
     return status;
 
-  ensure_bitrate (encoder);
-
   reset_properties (encoder);
   return set_context_info (base_encoder);
 }