GNOME Bugzilla – Bug 761218
audio/videodecoder: Use gst_pad_peer_query_caps() instead of using gst_pad_get_allowed_caps() to make negotiated output caps before forwarding GAP event
Last modified: 2016-01-28 12:23:26 UTC
Dear All. When making output caps before handling GAP event, gst_pad_get_allowed_caps() may return NULL if the srcpad has no peer. It is better to use gst_pad_peer_query_caps() with filter(e.g. source pads template caps) to have negotiated output caps properly before forwarding GAP event. It will never return NULL and we can make output caps properly before forwarding GAP event.
Created attachment 319890 [details] [review] use gst_pad_peer_query_caps to make output caps before handling GAP Dear Sebastian Dröge and All. Please check and review this patch. Thanks.
Review of attachment 319890 [details] [review]: Thanks! :) ::: gst-libs/gst/audio/gstaudiodecoder.c @@ +2025,3 @@ + filter = gst_pad_get_pad_template_caps (dec->srcpad); + caps = gst_pad_peer_query_caps (dec->srcpad, filter); + GST_LOG_OBJECT (dec, "peer caps %" GST_PTR_FORMAT, caps); This will still return NULL if there is no peer. My point was that if it returns NULL, you would just use the template caps further here. Also the checks for empty/any caps is still needed
Created attachment 319901 [details] [review] audio/videodecoder: use gst_pad_peer_query_caps to make output caps Dear Sebastian Dröge Please check and review again. Thanks.
Review of attachment 319901 [details] [review]: ::: gst-libs/gst/audio/gstaudiodecoder.c @@ +2034,3 @@ + gst_caps_unref (filter); + GST_LOG_OBJECT (dec, "peer caps %" GST_PTR_FORMAT, caps); + } No, what I mean here is: templcaps = gst_pad_get_pad_template_caps (srcpad); caps = gst_pad_peer_query (srcpad, templcaps); if (caps) { gst_caps_unref (templcaps); templcaps = NULL; } else { caps = templcaps; templcaps = NULL; } if (!caps || gst_caps_is_empty (caps) || gst_caps_is_any (caps)) goto caps_error; and then all the old code.
Created attachment 319909 [details] [review] audio/videodecoder: use gst_pad_peer_query_caps to make output caps Dear Sebastian Dröge Sorry for my misunderstanding. I thought gst_pad_peer_query_caps never return NULL even though there is no peer. Please review again.
Attachment 319909 [details] pushed as 15df3c8 - audio/videodecoder: use gst_pad_peer_query_caps to make output caps
Created attachment 319911 [details] [review] Remove duplicated code Sorry. Please review again.
Comment on attachment 319911 [details] [review] Remove duplicated code commit dfa2f4952321f72e664946d5537bf0291b24459f Author: HoonHee Lee <hoonhee.lee@lge.com> Date: Thu Jan 28 13:21:33 2016 +0100 audio/videodecoder: Minor cleanup of last commit https://bugzilla.gnome.org/show_bug.cgi?id=761218