audiodecoder: Don't push out identical caps
This avoids triggering plenty of extra code/methods/overhead downstream when we can just quickly check whenever we want to set caps whether they are identical or not https://bugzilla.gnome.org/show_bug.cgi?id=706600
This commit is contained in:
parent
02c6766c8a
commit
cd3fe60c68
@ -562,9 +562,11 @@ gst_audio_decoder_negotiate_default (GstAudioDecoder * dec)
|
|||||||
GstAudioDecoderClass *klass;
|
GstAudioDecoderClass *klass;
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
GstCaps *prevcaps;
|
||||||
GstQuery *query = NULL;
|
GstQuery *query = NULL;
|
||||||
GstAllocator *allocator;
|
GstAllocator *allocator;
|
||||||
GstAllocationParams params;
|
GstAllocationParams params;
|
||||||
|
gboolean set_caps = FALSE;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), FALSE);
|
g_return_val_if_fail (GST_IS_AUDIO_DECODER (dec), FALSE);
|
||||||
g_return_val_if_fail (GST_AUDIO_INFO_IS_VALID (&dec->priv->ctx.info), FALSE);
|
g_return_val_if_fail (GST_AUDIO_INFO_IS_VALID (&dec->priv->ctx.info), FALSE);
|
||||||
@ -575,9 +577,14 @@ gst_audio_decoder_negotiate_default (GstAudioDecoder * dec)
|
|||||||
|
|
||||||
GST_DEBUG_OBJECT (dec, "setting src caps %" GST_PTR_FORMAT, caps);
|
GST_DEBUG_OBJECT (dec, "setting src caps %" GST_PTR_FORMAT, caps);
|
||||||
|
|
||||||
|
prevcaps = gst_pad_get_current_caps (dec->srcpad);
|
||||||
|
if (!prevcaps || !gst_caps_is_equal (prevcaps, caps))
|
||||||
|
set_caps = TRUE;
|
||||||
|
if (prevcaps)
|
||||||
|
gst_caps_unref (prevcaps);
|
||||||
|
|
||||||
if (dec->priv->pending_events) {
|
if (dec->priv->pending_events) {
|
||||||
GList *pending_events, *l;
|
GList *pending_events, *l;
|
||||||
gboolean set_caps = FALSE;
|
|
||||||
|
|
||||||
pending_events = dec->priv->pending_events;
|
pending_events = dec->priv->pending_events;
|
||||||
dec->priv->pending_events = NULL;
|
dec->priv->pending_events = NULL;
|
||||||
@ -596,7 +603,7 @@ gst_audio_decoder_negotiate_default (GstAudioDecoder * dec)
|
|||||||
if (!set_caps) {
|
if (!set_caps) {
|
||||||
res = gst_pad_set_caps (dec->srcpad, caps);
|
res = gst_pad_set_caps (dec->srcpad, caps);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (!set_caps) {
|
||||||
res = gst_pad_set_caps (dec->srcpad, caps);
|
res = gst_pad_set_caps (dec->srcpad, caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user