mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
rtpmp4adepay: grab the sampling arte and put into caps
This is needed to be able to mux the received audio into mp4 (in the case of aac). Fixes #625825.
This commit is contained in:
parent
22560c473d
commit
988f228da7
1 changed files with 13 additions and 0 deletions
|
@ -165,6 +165,10 @@ gst_rtp_mp4a_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
guint8 *data;
|
||||
guint size;
|
||||
gint i;
|
||||
guint sr_idx;
|
||||
static const guint aac_sample_rates[] = { 96000, 88200, 64000, 48000,
|
||||
44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000
|
||||
};
|
||||
|
||||
buffer = gst_value_get_buffer (&v);
|
||||
gst_buffer_ref (buffer);
|
||||
|
@ -207,6 +211,15 @@ gst_rtp_mp4a_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
data[i] = ((data[i + 1] & 1) << 7) | ((data[i + 2] & 0xfe) >> 1);
|
||||
}
|
||||
|
||||
/* grab and set sampling rate */
|
||||
sr_idx = ((data[0] & 0x07) << 1) | ((data[1] & 0x80) >> 7);
|
||||
if (sr_idx < G_N_ELEMENTS (aac_sample_rates)) {
|
||||
gst_caps_set_simple (srccaps,
|
||||
"rate", G_TYPE_INT, (gint) aac_sample_rates[sr_idx], NULL);
|
||||
} else {
|
||||
GST_WARNING ("Invalid sample rate index %u", sr_idx);
|
||||
}
|
||||
|
||||
/* ignore remaining bit, we're only interested in full bytes */
|
||||
GST_BUFFER_SIZE (buffer) = size;
|
||||
|
||||
|
|
Loading…
Reference in a new issue