summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-03-23 12:07:52 +0100
committerSebastian Dröge <sebastian@centricular.com>2015-03-23 12:09:09 +0100
commit65662c89978df493c2005c87bcd375db9178b51b (patch)
tree254d343671dc45f53293657ded3b8b9289f216a3
parentef29b92990665d4db51d252afe6178ad5501011c (diff)
downloadgstreamer-plugins-base-65662c89978df493c2005c87bcd375db9178b51b.tar.gz
opusdec: Reset the decoder if the caps change
-rw-r--r--ext/opus/gstopusdec.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/ext/opus/gstopusdec.c b/ext/opus/gstopusdec.c
index 2b7bcb283..7cffd175b 100644
--- a/ext/opus/gstopusdec.c
+++ b/ext/opus/gstopusdec.c
@@ -541,9 +541,22 @@ gst_opus_dec_set_format (GstAudioDecoder * bdec, GstCaps * caps)
gboolean ret = TRUE;
GstStructure *s;
const GValue *streamheader;
+ GstCaps *old_caps;
GST_DEBUG_OBJECT (dec, "set_format: %" GST_PTR_FORMAT, caps);
+ if ((old_caps = gst_pad_get_current_caps (GST_AUDIO_DECODER_SINK_PAD (bdec)))) {
+ if (gst_caps_is_equal (caps, old_caps)) {
+ gst_caps_unref (old_caps);
+ GST_DEBUG_OBJECT (dec, "caps didn't change");
+ goto done;
+ }
+
+ GST_DEBUG_OBJECT (dec, "caps have changed, resetting decoder");
+ gst_opus_dec_reset (dec);
+ gst_caps_unref (old_caps);
+ }
+
s = gst_caps_get_structure (caps, 0);
if ((streamheader = gst_structure_get_value (s, "streamheader")) &&
G_VALUE_HOLDS (streamheader, GST_TYPE_ARRAY) &&