opusdec: Truncate caps first

https://bugzilla.gnome.org/show_bug.cgi?id=665078
This commit is contained in:
Olivier Crête 2011-12-07 00:06:11 -05:00 committed by Vincent Penquerc'h
parent f6ebc2de8e
commit b7d53c866b

View file

@ -217,7 +217,12 @@ static GstCaps *
gst_opus_dec_negotiate (GstOpusDec * dec) gst_opus_dec_negotiate (GstOpusDec * dec)
{ {
GstCaps *caps = gst_pad_get_allowed_caps (GST_AUDIO_DECODER_SRC_PAD (dec)); GstCaps *caps = gst_pad_get_allowed_caps (GST_AUDIO_DECODER_SRC_PAD (dec));
GstStructure *s = gst_caps_get_structure (caps, 0); GstStructure *s;
caps = gst_caps_make_writable (caps);
gst_caps_truncate (caps);
s = gst_caps_get_structure (caps, 0);
gst_structure_fixate_field_nearest_int (s, "rate", 48000); gst_structure_fixate_field_nearest_int (s, "rate", 48000);
gst_structure_get_int (s, "rate", &dec->sample_rate); gst_structure_get_int (s, "rate", &dec->sample_rate);
gst_structure_fixate_field_nearest_int (s, "channels", dec->n_channels); gst_structure_fixate_field_nearest_int (s, "channels", dec->n_channels);