audioaggregator: Fixate to some meaningful values if no sinkpad is configured yet
The default caps fixation code would select a rate of 1 for example,
which is not really ideal.
diff --git a/gst-libs/gst/audio/gstaudioaggregator.c b/gst-libs/gst/audio/gstaudioaggregator.c
index a675473..ab42b73 100644
--- a/gst-libs/gst/audio/gstaudioaggregator.c
+++ b/gst-libs/gst/audio/gstaudioaggregator.c
@@ -783,6 +783,8 @@
first_configured_pad = gst_audio_aggregator_get_first_configured_pad (agg);
+ caps = gst_caps_make_writable (caps);
+
if (first_configured_pad) {
GstStructure *s, *s2;
GstCaps *first_configured_caps =
@@ -790,7 +792,6 @@
gint first_configured_rate, first_configured_channels;
gint channels;
- caps = gst_caps_make_writable (caps);
s = gst_caps_get_structure (caps, 0);
s2 = gst_caps_get_structure (first_configured_caps, 0);
@@ -819,6 +820,21 @@
gst_caps_unref (first_configured_caps);
gst_object_unref (first_configured_pad);
+ } else {
+ GstStructure *s;
+ gint channels;
+
+ s = gst_caps_get_structure (caps, 0);
+
+ gst_structure_fixate_field_nearest_int (s, "rate", GST_AUDIO_DEF_RATE);
+ gst_structure_fixate_field_string (s, "format", GST_AUDIO_NE ("S16"));
+ gst_structure_fixate_field_string (s, "layout", "interleaved");
+ gst_structure_fixate_field_nearest_int (s, "channels", 2);
+
+ if (gst_structure_get_int (s, "channels", &channels) && channels > 2) {
+ if (!gst_structure_has_field_typed (s, "channel-mask", GST_TYPE_BITMASK))
+ gst_structure_set (s, "channel-mask", GST_TYPE_BITMASK, 0ULL, NULL);
+ }
}
if (!gst_caps_is_fixed (caps))