rtpmp4a(de)pay: Only accept raw aac

rtpmp4a(de)pay should only handle raw aac to conform to the RFC
This commit is contained in:
Thiago Santos 2010-01-11 14:48:26 -03:00
parent 6158f401a1
commit c563dd7eb2
2 changed files with 22 additions and 3 deletions

View file

@ -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 };

View file

@ -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");