From c563dd7eb2930e0239c537b3c1be0da70d1b4804 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Mon, 11 Jan 2010 14:48:26 -0300 Subject: [PATCH] rtpmp4a(de)pay: Only accept raw aac rtpmp4a(de)pay should only handle raw aac to conform to the RFC --- gst/rtp/gstrtpmp4adepay.c | 6 ++++-- gst/rtp/gstrtpmp4apay.c | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/gst/rtp/gstrtpmp4adepay.c b/gst/rtp/gstrtpmp4adepay.c index de74709a97..9713bdcc83 100644 --- a/gst/rtp/gstrtpmp4adepay.c +++ b/gst/rtp/gstrtpmp4adepay.c @@ -42,7 +42,8 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, GST_STATIC_CAPS ("audio/mpeg," - "mpegversion = (int) 4," "framed = (boolean) true") + "mpegversion = (int) 4," "framed = (boolean) true, " + "stream-format = (string) raw") ); static GstStaticPadTemplate gst_rtp_mp4a_depay_sink_template = @@ -156,7 +157,8 @@ gst_rtp_mp4a_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) srccaps = gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT, 4, - "framed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, channels, NULL); + "framed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, channels, + "stream-format", G_TYPE_STRING, "raw", NULL); if ((str = gst_structure_get_string (structure, "config"))) { GValue v = { 0 }; diff --git a/gst/rtp/gstrtpmp4apay.c b/gst/rtp/gstrtpmp4apay.c index 071e37592f..a401b2cb0a 100644 --- a/gst/rtp/gstrtpmp4apay.c +++ b/gst/rtp/gstrtpmp4apay.c @@ -43,7 +43,8 @@ static GstStaticPadTemplate gst_rtp_mp4a_pay_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/mpeg, mpegversion=(int)4") + GST_STATIC_CAPS ("audio/mpeg, mpegversion=(int)4, " + "stream-format=(string)raw") ); static GstStaticPadTemplate gst_rtp_mp4a_pay_src_template = @@ -246,11 +247,27 @@ gst_rtp_mp4a_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps) GstStructure *structure; const GValue *codec_data; gboolean res, framed = TRUE; + const gchar *stream_format; rtpmp4apay = GST_RTP_MP4A_PAY (payload); structure = gst_caps_get_structure (caps, 0); + /* this is already handled by the template caps, but it is better + * to leave here to have meaningful warning messages when linking + * fails */ + stream_format = gst_structure_get_string (structure, "stream-format"); + if (stream_format) { + if (strcmp (stream_format, "raw") != 0) { + GST_WARNING_OBJECT (rtpmp4apay, "AAC's stream-format must be 'raw', " + "%s is not supported", stream_format); + return FALSE; + } + } else { + GST_WARNING_OBJECT (rtpmp4apay, "AAC's stream-format not specified, " + "assuming 'raw'"); + } + codec_data = gst_structure_get_value (structure, "codec_data"); if (codec_data) { GST_LOG_OBJECT (rtpmp4apay, "got codec_data");