From cecb83e590714c376253dad1d769b3a78162daea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 4 Jun 2015 11:45:05 +0200 Subject: [PATCH] opusdec: gst_structure_fixate_field_nearest_int() only works if the structure has this field Just set the rate/channels directly if the caps don't have this field. --- ext/opus/gstopusdec.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ext/opus/gstopusdec.c b/ext/opus/gstopusdec.c index a634787699..bd9847b0ea 100644 --- a/ext/opus/gstopusdec.c +++ b/ext/opus/gstopusdec.c @@ -224,10 +224,19 @@ gst_opus_dec_negotiate (GstOpusDec * dec, const GstAudioChannelPosition * pos) caps = gst_caps_truncate (caps); caps = gst_caps_make_writable (caps); s = gst_caps_get_structure (caps, 0); - gst_structure_fixate_field_nearest_int (s, "rate", dec->sample_rate); + + if (gst_structure_has_field (s, "rate")) + gst_structure_fixate_field_nearest_int (s, "rate", dec->sample_rate); + else + gst_structure_set (s, "rate", G_TYPE_INT, dec->sample_rate, NULL); gst_structure_get_int (s, "rate", &dec->sample_rate); - gst_structure_fixate_field_nearest_int (s, "channels", dec->n_channels); + + if (gst_structure_has_field (s, "channels")) + gst_structure_fixate_field_nearest_int (s, "channels", dec->n_channels); + else + gst_structure_set (s, "channels", G_TYPE_INT, dec->n_channels, NULL); gst_structure_get_int (s, "channels", &dec->n_channels); + gst_caps_unref (caps); }