libs: encoder: allow to set bitrate on runtime

In case of streaming, controlling bitrate dynamically for encoder might be
important to manage quality of the streaming.

This patch is to support such a scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=786321
This commit is contained in:
Hyunjun Ko 2017-09-15 15:38:18 +09:00 committed by Víctor Manuel Jáquez Leal
parent a8f2309595
commit acfabb3561

View file

@ -1122,18 +1122,14 @@ gst_vaapi_encoder_set_bitrate (GstVaapiEncoder * encoder, guint bitrate)
{
g_return_val_if_fail (encoder != NULL, 0);
if (encoder->bitrate != bitrate && encoder->num_codedbuf_queued > 0)
goto error_operation_failed;
if (encoder->bitrate != bitrate && encoder->num_codedbuf_queued > 0) {
GST_INFO ("Bitrate is changed to %d on runtime", bitrate);
encoder->bitrate = bitrate;
return gst_vaapi_encoder_reconfigure_internal (encoder);
}
encoder->bitrate = bitrate;
return GST_VAAPI_ENCODER_STATUS_SUCCESS;
/* ERRORS */
error_operation_failed:
{
GST_ERROR ("could not change bitrate value after encoding started");
return GST_VAAPI_ENCODER_STATUS_ERROR_OPERATION_FAILED;
}
}
/**