diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2015-06-04 11:45:05 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-06-04 11:45:05 +0200 |
commit | cecb83e590714c376253dad1d769b3a78162daea (patch) | |
tree | bb3a37429f99abb3a4e50f8ce30b34deaa2b140c | |
parent | ee3135c4a677e27a1256c6c4728c11bd1a5885d8 (diff) | |
download | gstreamer-plugins-base-cecb83e590714c376253dad1d769b3a78162daea.tar.gz |
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.
-rw-r--r-- | ext/opus/gstopusdec.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/opus/gstopusdec.c b/ext/opus/gstopusdec.c index a63478769..bd9847b0e 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); } |