mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
omxvideoenc: use gst_omx_video_enc_set_bitrate() when setting bitrate in set_format
We weren't using the usual pattern when re-setting the bitrate: - get parameters from OMX - update only the fields different from 0xffffffff (OMX defaults) - set parameters Also added a comment explaining why we re-set this param. https://bugzilla.gnome.org/show_bug.cgi?id=794998
This commit is contained in:
parent
256f77b621
commit
542faf0f36
1 changed files with 3 additions and 16 deletions
|
@ -2219,22 +2219,9 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
|
|||
NULL) != OMX_ErrorNone)
|
||||
return FALSE;
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (self->target_bitrate != 0xffffffff) {
|
||||
OMX_VIDEO_PARAM_BITRATETYPE config;
|
||||
OMX_ERRORTYPE err;
|
||||
|
||||
GST_OMX_INIT_STRUCT (&config);
|
||||
config.nPortIndex = self->enc_out_port->index;
|
||||
config.nTargetBitrate = self->target_bitrate;
|
||||
config.eControlRate = self->control_rate;
|
||||
err = gst_omx_component_set_parameter (self->enc,
|
||||
OMX_IndexParamVideoBitrate, &config);
|
||||
if (err != OMX_ErrorNone)
|
||||
GST_ERROR_OBJECT (self, "Failed to set bitrate parameter: %s (0x%08x)",
|
||||
gst_omx_error_to_string (err), err);
|
||||
}
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
/* Some OMX implementations reset the bitrate after setting the compression
|
||||
* format, see bgo#698049, so re-set it */
|
||||
gst_omx_video_enc_set_bitrate (self);
|
||||
|
||||
if (self->input_state)
|
||||
gst_video_codec_state_unref (self->input_state);
|
||||
|
|
Loading…
Reference in a new issue