adder: Use gst_audio_info_is_equal() to check if we get the same caps
This commit is contained in:
parent
5065e76b1c
commit
2953810ba5
@ -321,14 +321,17 @@ gst_adder_sink_query (GstCollectPads * pads, GstCollectData * pad,
|
|||||||
static gboolean
|
static gboolean
|
||||||
gst_adder_setcaps (GstAdder * adder, GstPad * pad, GstCaps * caps)
|
gst_adder_setcaps (GstAdder * adder, GstPad * pad, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
GstAudioInfo info;
|
||||||
|
|
||||||
|
if (!gst_audio_info_from_caps (&info, caps))
|
||||||
|
goto invalid_format;
|
||||||
|
|
||||||
/* don't allow reconfiguration for now; there's still a race between the
|
/* don't allow reconfiguration for now; there's still a race between the
|
||||||
* different upstream threads doing query_caps + accept_caps + sending
|
* different upstream threads doing query_caps + accept_caps + sending
|
||||||
* (possibly different) CAPS events, but there's not much we can do about
|
* (possibly different) CAPS events, but there's not much we can do about
|
||||||
* that, upstream needs to deal with it. */
|
* that, upstream needs to deal with it. */
|
||||||
if (adder->current_caps != NULL) {
|
if (adder->current_caps != NULL) {
|
||||||
/* FIXME: not quite right for optional fields such as channel-mask, which
|
if (gst_audio_info_is_equal (&info, &adder->info)) {
|
||||||
* may or may not be present for mono/stereo */
|
|
||||||
if (gst_caps_is_equal (caps, adder->current_caps)) {
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (pad, "got input caps %" GST_PTR_FORMAT ", but "
|
GST_DEBUG_OBJECT (pad, "got input caps %" GST_PTR_FORMAT ", but "
|
||||||
@ -342,14 +345,13 @@ gst_adder_setcaps (GstAdder * adder, GstPad * pad, GstCaps * caps)
|
|||||||
|
|
||||||
GST_OBJECT_LOCK (adder);
|
GST_OBJECT_LOCK (adder);
|
||||||
adder->current_caps = gst_caps_ref (caps);
|
adder->current_caps = gst_caps_ref (caps);
|
||||||
|
|
||||||
|
memcpy (&adder->info, &info, sizeof (info));
|
||||||
GST_OBJECT_UNLOCK (adder);
|
GST_OBJECT_UNLOCK (adder);
|
||||||
/* send caps event later, after stream-start event */
|
/* send caps event later, after stream-start event */
|
||||||
|
|
||||||
GST_INFO_OBJECT (pad, "handle caps change to %" GST_PTR_FORMAT, caps);
|
GST_INFO_OBJECT (pad, "handle caps change to %" GST_PTR_FORMAT, caps);
|
||||||
|
|
||||||
if (!gst_audio_info_from_caps (&adder->info, caps))
|
|
||||||
goto invalid_format;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user