From f925b3151e9636fdea24ec67dd996845f2a86ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommi=20My=C3=B6h=C3=A4nen?= Date: Tue, 3 Jul 2007 09:59:46 +0000 Subject: [PATCH] gst/rtp/gstrtpilbcpay.c: Set the encoding-name in the rtp caps to all uppercase, as required by the caps spec. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message from CVS: Patch by: Tommi Myöhänen * gst/rtp/gstrtpilbcpay.c: (gst_rtpilbcpay_setcaps): Set the encoding-name in the rtp caps to all uppercase, as required by the caps spec. Some small cleanups in the error paths. Fixes #453037. --- ChangeLog | 9 ++++++++ gst/rtp/gstrtpilbcpay.c | 46 +++++++++++++++++++++++++++-------------- 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0cf89dc1dd..bcb52cd580 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-07-03 Wim Taymans,,, + + Patch by: Tommi Myöhänen + + * gst/rtp/gstrtpilbcpay.c: (gst_rtpilbcpay_setcaps): + Set the encoding-name in the rtp caps to all uppercase, as required by + the caps spec. + Some small cleanups in the error paths. Fixes #453037. + 2007-06-28 Sebastian Dröge * ext/wavpack/gstwavpackparse.c: diff --git a/gst/rtp/gstrtpilbcpay.c b/gst/rtp/gstrtpilbcpay.c index 39d1832cd5..736e633dd2 100644 --- a/gst/rtp/gstrtpilbcpay.c +++ b/gst/rtp/gstrtpilbcpay.c @@ -125,32 +125,46 @@ gst_rtpilbcpay_setcaps (GstBaseRTPPayload * basertppayload, GstCaps * caps) structure = gst_caps_get_structure (caps, 0); gst_structure_get_int (structure, "mode", &mode); - if (mode != 20 && mode != 30) { - return FALSE; - } + if (mode != 20 && mode != 30) + goto wrong_mode; payload_name = gst_structure_get_name (structure); - if (g_strcasecmp ("audio/x-iLBC", payload_name) == 0) { - gst_basertppayload_set_options (basertppayload, "audio", TRUE, "iLBC", - 8000); - /* set options for this frame based audio codec */ - gst_base_rtp_audio_payload_set_frame_options (basertpaudiopayload, - mode, mode == 30 ? 50 : 38); - } else { - return FALSE; - } + if (g_strcasecmp ("audio/x-iLBC", payload_name)) + goto wrong_caps; + + gst_basertppayload_set_options (basertppayload, "audio", TRUE, "ILBC", 8000); + /* set options for this frame based audio codec */ + gst_base_rtp_audio_payload_set_frame_options (basertpaudiopayload, + mode, mode == 30 ? 50 : 38); ret = gst_basertppayload_set_outcaps (basertppayload, "mode", G_TYPE_INT, mode, NULL); - if (mode != rtpilbcpay->mode && rtpilbcpay->mode != -1) { + if (mode != rtpilbcpay->mode && rtpilbcpay->mode != -1) + goto mode_changed; + + rtpilbcpay->mode = mode; + + return ret; + + /* ERRORS */ +wrong_mode: + { + GST_ERROR_OBJECT (rtpilbcpay, "mode must be 20 or 30, received %d", mode); + return FALSE; + } +wrong_caps: + { + GST_ERROR_OBJECT (rtpilbcpay, "expected audio/x-iLBC, received %s", + payload_name); + return FALSE; + } +mode_changed: + { GST_ERROR_OBJECT (rtpilbcpay, "Mode has changed from %d to %d! " "Mode cannot change while streaming", rtpilbcpay->mode, mode); return FALSE; } - rtpilbcpay->mode = mode; - - return ret; } gboolean