From 2953810ba5efccd08e1a1de1b8e150afbe646cfe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 30 May 2013 14:45:58 +0200 Subject: [PATCH] adder: Use gst_audio_info_is_equal() to check if we get the same caps --- gst/adder/gstadder.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c index a72564e..ff97cf8 100644 --- a/gst/adder/gstadder.c +++ b/gst/adder/gstadder.c @@ -321,14 +321,17 @@ gst_adder_sink_query (GstCollectPads * pads, GstCollectData * pad, static gboolean 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 * different upstream threads doing query_caps + accept_caps + sending * (possibly different) CAPS events, but there's not much we can do about * that, upstream needs to deal with it. */ if (adder->current_caps != NULL) { - /* FIXME: not quite right for optional fields such as channel-mask, which - * may or may not be present for mono/stereo */ - if (gst_caps_is_equal (caps, adder->current_caps)) { + if (gst_audio_info_is_equal (&info, &adder->info)) { return TRUE; } else { 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); adder->current_caps = gst_caps_ref (caps); + + memcpy (&adder->info, &info, sizeof (info)); GST_OBJECT_UNLOCK (adder); /* send caps event later, after stream-start event */ 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; /* ERRORS */ -- 2.7.4