mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
omxvideodec: Improve format negotiation a bit
Don't leak caps and make sure to fixate caps.
This commit is contained in:
parent
a70a71b9a5
commit
7354baec66
1 changed files with 5 additions and 13 deletions
|
@ -833,24 +833,13 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
|
|||
OMX_VIDEO_PARAM_PORTFORMATTYPE param;
|
||||
OMX_ERRORTYPE err;
|
||||
GstCaps *comp_supported_caps;
|
||||
GstCaps *templ_caps;
|
||||
GstCaps *peer_caps, *intersection;
|
||||
GstCaps *intersection;
|
||||
GstVideoFormat format;
|
||||
gint old_index;
|
||||
GstStructure *s;
|
||||
const gchar *format_str;
|
||||
|
||||
templ_caps =
|
||||
gst_caps_copy (gst_pad_get_pad_template_caps (GST_VIDEO_DECODER_SRC_PAD
|
||||
(self)));
|
||||
peer_caps =
|
||||
gst_pad_peer_query_caps (GST_VIDEO_DECODER_SRC_PAD (self), templ_caps);
|
||||
if (peer_caps) {
|
||||
intersection = peer_caps;
|
||||
gst_caps_unref (templ_caps);
|
||||
} else {
|
||||
intersection = templ_caps;
|
||||
}
|
||||
intersection = gst_pad_get_allowed_caps (GST_VIDEO_DECODER_SRC_PAD (self));
|
||||
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = port->index;
|
||||
|
@ -901,6 +890,8 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
|
|||
intersection = tmp;
|
||||
}
|
||||
|
||||
gst_caps_unref (comp_supported_caps);
|
||||
|
||||
if (gst_caps_is_empty (intersection)) {
|
||||
gst_caps_unref (intersection);
|
||||
GST_ERROR_OBJECT (self, "Empty caps");
|
||||
|
@ -908,6 +899,7 @@ gst_omx_video_dec_negotiate (GstOMXVideoDec * self)
|
|||
}
|
||||
|
||||
intersection = gst_caps_truncate (intersection);
|
||||
intersection = gst_caps_fixate (intersection);
|
||||
|
||||
s = gst_caps_get_structure (intersection, 0);
|
||||
format_str = gst_structure_get_string (s, "format");
|
||||
|
|
Loading…
Reference in a new issue