MT#63317 return RTP extensions from rtp_payload

Change-Id: If7451e3d32ba39cab40f6f09488cd75ccbefa1cc
pull/2008/head
Richard Fuchs 6 months ago
parent 6c5190a79d
commit 2f52fb2511

@ -93,7 +93,7 @@ static int get_clock_rate(struct media_packet *mp, int payload_type) {
}
static struct jb_packet* get_jb_packet(struct media_packet *mp, const str *s) {
if (!(mp->rtp = rtp_payload(&mp->payload, s)))
if (!(mp->rtp = rtp_payload(&mp->payload, s, NULL)))
return NULL;
char *buf = bufferpool_alloc(media_bufferpool, s->len + RTP_BUFFER_HEAD_ROOM + RTP_BUFFER_TAIL_ROOM);

@ -2296,7 +2296,7 @@ static void media_packet_parse(struct packet_handler_ctx *phc) {
return;
if (!phc->rtcp) {
phc->mp.rtp = rtp_payload(&phc->mp.payload, &phc->s);
phc->mp.rtp = rtp_payload(&phc->mp.payload, &phc->s, NULL);
if (G_LIKELY(phc->mp.rtp)) {
// check the payload type
// XXX redundant between SSRC handling and codec_handler stuff -> combine

@ -109,7 +109,7 @@ int rtp_avp2savp(str *s, struct crypto_context *c, struct ssrc_entry_call *ssrc_
if (G_UNLIKELY(!ssrc_ctx))
return -1;
if (!(rtp = rtp_payload(&payload, s)))
if (!(rtp = rtp_payload(&payload, s, NULL)))
return -1;
if (check_session_keys(c))
return -1;
@ -149,7 +149,7 @@ int rtp_update_index(str *s, struct packet_stream *ps, struct ssrc_entry_call *s
if (G_UNLIKELY(!ssrc))
return -1;
if (!(rtp = rtp_payload(NULL, s)))
if (!(rtp = rtp_payload(NULL, s, NULL)))
return -1;
g_autoptr(crypto_debug_string) cds = NULL;
packet_index(ssrc, rtp, &cds);
@ -165,7 +165,7 @@ int rtp_savp2avp(str *s, struct crypto_context *c, struct ssrc_entry_call *ssrc_
if (G_UNLIKELY(!ssrc_ctx))
return -1;
if (!(rtp = rtp_payload(&payload, s)))
if (!(rtp = rtp_payload(&payload, s, NULL)))
return -1;
if (check_session_keys(c))
return -1;

@ -59,7 +59,7 @@ const int num_rfc_rtp_payload_types = G_N_ELEMENTS(rfc_rtp_payload_types);
struct rtp_header *rtp_payload(str *p, const str *s) {
struct rtp_header *rtp_payload(str *p, const str *s, str *exts) {
struct rtp_header *rtp;
const char *err;
@ -90,8 +90,11 @@ struct rtp_header *rtp_payload(str *p, const str *s) {
if (p->len < sizeof(*ext))
goto error;
ext = (void *) p->s;
size_t ext_len = sizeof(*ext) + ntohs(ext->length) * 4;
if (exts)
*exts = STR_LEN(p->s, ext_len);
err = "short packet (header extensions)";
if (str_shift(p, sizeof(*ext) + ntohs(ext->length) * 4))
if (str_shift(p, ext_len))
goto error;
}

@ -128,7 +128,7 @@ extern const int num_rfc_rtp_payload_types;
__attribute__((nonnull(2)))
struct rtp_header *rtp_payload(str *p, const str *s);
struct rtp_header *rtp_payload(str *p, const str *s, str *ext);
__attribute__((nonnull(2)))
bool rtp_padding(const struct rtp_header *header, str *payload);
const struct rtp_payload_type *rtp_get_rfc_payload_type(unsigned int type);

@ -184,7 +184,7 @@ void packet_process(stream_t *stream, unsigned char *buf, unsigned len) {
if (rtcp_demux_is_rtcp(&bufstr))
goto ignore; // for now
if (!(packet->rtp = rtp_payload(&packet->payload, &bufstr)))
if (!(packet->rtp = rtp_payload(&packet->payload, &bufstr, NULL)))
goto err;
if (!rtp_padding(packet->rtp, &packet->payload))
goto err;

Loading…
Cancel
Save