summaryrefslogtreecommitdiff
path: root/gst/audiomixer
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2015-04-01 20:32:41 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2015-04-01 20:32:41 -0400
commit34a921c31b4be5290b8841fba6bb24ee1b309952 (patch)
tree3be87fcb717047739b8ddefac846ca2a047018ce /gst/audiomixer
parent90028d68fe4b522e8cde88e00d4ff374d53eb90a (diff)
audiomixer: Allow downstream caps with a non-default channel-mask
Instead of failing, take the downstream channel mask if the channel count is 1.
Diffstat (limited to 'gst/audiomixer')
-rw-r--r--gst/audiomixer/gstaudiomixer.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/gst/audiomixer/gstaudiomixer.c b/gst/audiomixer/gstaudiomixer.c
index 40ede8434..f0e8f66eb 100644
--- a/gst/audiomixer/gstaudiomixer.c
+++ b/gst/audiomixer/gstaudiomixer.c
@@ -350,11 +350,12 @@ static gboolean
gst_audiomixer_setcaps (GstAudioMixer * audiomixer, GstPad * pad,
GstCaps * orig_caps)
{
+ GstAggregator *agg = GST_AGGREGATOR (audiomixer);
GstAudioAggregator *aagg = GST_AUDIO_AGGREGATOR (audiomixer);
GstCaps *caps;
GstAudioInfo info;
GstStructure *s;
- gint channels;
+ gint channels = 0;
gboolean ret;
caps = gst_caps_copy (orig_caps);
@@ -367,6 +368,31 @@ gst_audiomixer_setcaps (GstAudioMixer * audiomixer, GstPad * pad,
if (!gst_audio_info_from_caps (&info, caps))
goto invalid_format;
+ if (channels == 1) {
+ GstCaps *filter;
+ GstCaps *downstream_caps;
+
+ if (audiomixer->filter_caps)
+ filter = gst_caps_intersect_full (caps, audiomixer->filter_caps,
+ GST_CAPS_INTERSECT_FIRST);
+ else
+ filter = gst_caps_ref (caps);
+
+ downstream_caps = gst_pad_peer_query_caps (agg->srcpad, filter);
+ gst_caps_unref (filter);
+
+ if (downstream_caps) {
+ gst_caps_unref (caps);
+ caps = downstream_caps;
+
+ if (gst_caps_is_empty (caps)) {
+ gst_caps_unref (caps);
+ return FALSE;
+ }
+ caps = gst_caps_fixate (caps);
+ }
+ }
+
GST_OBJECT_LOCK (audiomixer);
/* don't allow reconfiguration for now; there's still a race between the
* different upstream threads doing query_caps + accept_caps + sending