mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
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:
parent
a8f2309595
commit
acfabb3561
1 changed files with 5 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue