From 4304e0f4388e94e0bc26a71d995afbdc276f064c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 24 Jul 2006 14:16:06 +0000 Subject: gst/law/: Fix negotiation to deal with ANY/EMPTY caps instead of leaking. Original commit message from CVS: * gst/law/alaw-decode.c: (alawdec_getcaps): * gst/law/alaw-encode.c: (alawenc_getcaps), (gst_alawenc_chain): * gst/law/mulaw-decode.c: (mulawdec_getcaps): * gst/law/mulaw-encode.c: (mulawenc_getcaps): Fix negotiation to deal with ANY/EMPTY caps instead of leaking. --- ChangeLog | 8 ++++++++ gst/law/alaw-decode.c | 9 +++++---- gst/law/alaw-encode.c | 5 ++++- gst/law/mulaw-decode.c | 6 ++---- gst/law/mulaw-encode.c | 5 ++++- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b70fcd7..cf760bdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-07-24 Wim Taymans + + * gst/law/alaw-decode.c: (alawdec_getcaps): + * gst/law/alaw-encode.c: (alawenc_getcaps), (gst_alawenc_chain): + * gst/law/mulaw-decode.c: (mulawdec_getcaps): + * gst/law/mulaw-encode.c: (mulawenc_getcaps): + Fix negotiation to deal with ANY/EMPTY caps instead of leaking. + 2006-07-24 Stefan Kost,,, * gst/wavparse/gstwavparse.c: (gst_wavparse_reset), diff --git a/gst/law/alaw-decode.c b/gst/law/alaw-decode.c index 23ecc2b3..be7eed2f 100644 --- a/gst/law/alaw-decode.c +++ b/gst/law/alaw-decode.c @@ -90,14 +90,16 @@ alawdec_getcaps (GstPad * pad) } /* now intersect rate and channels from peer caps */ othercaps = gst_pad_peer_get_caps (otherpad); - if (othercaps && (!gst_caps_is_empty (othercaps)) - && (!gst_caps_is_any (othercaps))) { + if (othercaps) { GstStructure *structure; const GValue *orate, *ochans; const GValue *rate, *chans; GValue irate = { 0 }, ichans = { 0}; + if (gst_caps_is_empty (othercaps) || gst_caps_is_any (othercaps)) + goto done; + structure = gst_caps_get_structure (othercaps, 0); orate = gst_structure_get_value (structure, "rate"); ochans = gst_structure_get_value (structure, "channels"); @@ -118,10 +120,9 @@ alawdec_getcaps (GstPad * pad) gst_structure_set_value (structure, "rate", &irate); gst_structure_set_value (structure, "channels", &ichans); + done: gst_caps_unref (othercaps); } - -done: return base_caps; } diff --git a/gst/law/alaw-encode.c b/gst/law/alaw-encode.c index 991085da..9cbcae98 100644 --- a/gst/law/alaw-encode.c +++ b/gst/law/alaw-encode.c @@ -139,6 +139,9 @@ alawenc_getcaps (GstPad * pad) GValue irate = { 0 }, ichans = { 0}; + if (gst_caps_is_empty (othercaps) || gst_caps_is_any (othercaps)) + goto done; + structure = gst_caps_get_structure (othercaps, 0); orate = gst_structure_get_value (structure, "rate"); ochans = gst_structure_get_value (structure, "channels"); @@ -159,9 +162,9 @@ alawenc_getcaps (GstPad * pad) gst_structure_set_value (structure, "rate", &irate); gst_structure_set_value (structure, "channels", &ichans); + done: gst_caps_unref (othercaps); } -done: return base_caps; } diff --git a/gst/law/mulaw-decode.c b/gst/law/mulaw-decode.c index d9babea4..786a43f9 100644 --- a/gst/law/mulaw-decode.c +++ b/gst/law/mulaw-decode.c @@ -72,10 +72,8 @@ mulawdec_getcaps (GstPad * pad) GValue irate = { 0 }, ichans = { 0}; - if (gst_caps_is_empty (othercaps) || gst_caps_is_any (othercaps)) { - gst_caps_unref (othercaps); + if (gst_caps_is_empty (othercaps) || gst_caps_is_any (othercaps)) goto done; - } structure = gst_caps_get_structure (othercaps, 0); orate = gst_structure_get_value (structure, "rate"); @@ -97,9 +95,9 @@ mulawdec_getcaps (GstPad * pad) gst_structure_set_value (structure, "rate", &irate); gst_structure_set_value (structure, "channels", &ichans); + done: gst_caps_unref (othercaps); } -done: return base_caps; } diff --git a/gst/law/mulaw-encode.c b/gst/law/mulaw-encode.c index ae92fc40..4b56eb1e 100644 --- a/gst/law/mulaw-encode.c +++ b/gst/law/mulaw-encode.c @@ -72,6 +72,9 @@ mulawenc_getcaps (GstPad * pad) GValue irate = { 0 }, ichans = { 0}; + if (gst_caps_is_empty (othercaps) || gst_caps_is_any (othercaps)) + goto done; + structure = gst_caps_get_structure (othercaps, 0); orate = gst_structure_get_value (structure, "rate"); ochans = gst_structure_get_value (structure, "channels"); @@ -92,9 +95,9 @@ mulawenc_getcaps (GstPad * pad) gst_structure_set_value (structure, "rate", &irate); gst_structure_set_value (structure, "channels", &ichans); + done: gst_caps_unref (othercaps); } -done: return base_caps; } -- cgit