From c76e8c77ebf0d01e793ea79a48f5b814f608faaf Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 4 Jul 2016 09:15:03 +0100 Subject: [PATCH] audiodecoder: fix criticals fixating a non existent field https://bugzilla.gnome.org/show_bug.cgi?id=766970 --- gst-libs/gst/audio/gstaudiodecoder.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c index 9fa2f959dd..19e1c6a731 100644 --- a/gst-libs/gst/audio/gstaudiodecoder.c +++ b/gst-libs/gst/audio/gstaudiodecoder.c @@ -1903,7 +1903,7 @@ gst_audio_decoder_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) dec->priv->ctx.had_input_data = TRUE; if (!dec->priv->expecting_discont_buf && - GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) { + GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) { gint64 samples, ts; /* track present position */ @@ -2012,10 +2012,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);