diff options
author | Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> | 2016-07-04 09:15:03 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-07-25 13:15:08 +0300 |
commit | f1c8a0b31c28f815a6e48f4f5965eba96eee6b90 (patch) | |
tree | ad2652ce3f7b0b6e214b86eb09b16178b7c4e208 | |
parent | 9840f7144cd0ebe28196b2d987037ecd88114b8d (diff) | |
download | gstreamer-plugins-base-f1c8a0b31c28f815a6e48f4f5965eba96eee6b90.tar.gz |
audiodecoder: fix criticals fixating a non existent field
https://bugzilla.gnome.org/show_bug.cgi?id=766970
-rw-r--r-- | gst-libs/gst/audio/gstaudiodecoder.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c index 00837591b..5cd265567 100644 --- a/gst-libs/gst/audio/gstaudiodecoder.c +++ b/gst-libs/gst/audio/gstaudiodecoder.c @@ -2003,10 +2003,18 @@ gst_audio_decoder_negotiate_default_caps (GstAudioDecoder * dec) for (i = 0; i < caps_size; i++) { structure = gst_caps_get_structure (caps, i); - gst_structure_fixate_field_nearest_int (structure, - "channels", GST_AUDIO_DEF_CHANNELS); - gst_structure_fixate_field_nearest_int (structure, - "rate", GST_AUDIO_DEF_RATE); + if (gst_structure_has_field (structure, "channels")) + gst_structure_fixate_field_nearest_int (structure, + "channels", GST_AUDIO_DEF_CHANNELS); + else + gst_structure_set (structure, "channels", G_TYPE_INT, + GST_AUDIO_DEF_CHANNELS, NULL); + if (gst_structure_has_field (structure, "rate")) + gst_structure_fixate_field_nearest_int (structure, + "rate", GST_AUDIO_DEF_RATE); + else + gst_structure_set (structure, "rate", G_TYPE_INT, GST_AUDIO_DEF_RATE, + NULL); } caps = gst_caps_fixate (caps); structure = gst_caps_get_structure (caps, 0); |