mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
opusdec: Reset the decoder if the caps change
This commit is contained in:
parent
bb5b0f2d12
commit
c2f38cd054
1 changed files with 13 additions and 0 deletions
|
@ -541,9 +541,22 @@ gst_opus_dec_set_format (GstAudioDecoder * bdec, GstCaps * caps)
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
const GValue *streamheader;
|
const GValue *streamheader;
|
||||||
|
GstCaps *old_caps;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (dec, "set_format: %" GST_PTR_FORMAT, 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);
|
s = gst_caps_get_structure (caps, 0);
|
||||||
if ((streamheader = gst_structure_get_value (s, "streamheader")) &&
|
if ((streamheader = gst_structure_get_value (s, "streamheader")) &&
|
||||||
G_VALUE_HOLDS (streamheader, GST_TYPE_ARRAY) &&
|
G_VALUE_HOLDS (streamheader, GST_TYPE_ARRAY) &&
|
||||||
|
|
Loading…
Reference in a new issue