summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2016-11-02 09:38:16 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-11-02 09:38:16 -0500
commitabfb7b5d4a77b6fc2a624b545aab53f4319be908 (patch)
tree045cb917d850c740f2185b511565266d0b724218
parent946f55406fa84471ff5f667ea39895fffa41bdf6 (diff)
parent69196a8db4367116144bae6ac7e43f5df573ec11 (diff)
Merge "res_pjsip_sdp_rtp: Limit number of formats to defined maximum." into 14
-rw-r--r--res/res_pjsip_sdp_rtp.c10
-rw-r--r--third-party/pjproject/patches/config_site.h6
2 files changed, 15 insertions, 1 deletions
diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index aad6bb88f..d8b94df9f 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -1180,10 +1180,14 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as
max_packet_size = ast_format_get_maximum_ms(format);
}
ao2_ref(format, -1);
+
+ if (media->desc.fmt_count == PJMEDIA_MAX_SDP_FMT) {
+ break;
+ }
}
/* Add non-codec formats */
- if (media_type != AST_MEDIA_TYPE_VIDEO) {
+ if (media_type != AST_MEDIA_TYPE_VIDEO && media->desc.fmt_count < PJMEDIA_MAX_SDP_FMT) {
for (index = 1LL; index <= AST_RTP_MAX; index <<= 1) {
if (!(noncodec & index)) {
continue;
@@ -1205,6 +1209,10 @@ static int create_outgoing_sdp_stream(struct ast_sip_session *session, struct as
attr = pjmedia_sdp_attr_create(pool, "fmtp", pj_cstr(&stmp, tmp));
media->attr[media->attr_count++] = attr;
}
+
+ if (media->desc.fmt_count == PJMEDIA_MAX_SDP_FMT) {
+ break;
+ }
}
}
diff --git a/third-party/pjproject/patches/config_site.h b/third-party/pjproject/patches/config_site.h
index 0694f120e..564959d84 100644
--- a/third-party/pjproject/patches/config_site.h
+++ b/third-party/pjproject/patches/config_site.h
@@ -57,3 +57,9 @@
/* Defaults too low for WebRTC */
#define PJ_ICE_MAX_CAND 32
#define PJ_ICE_MAX_CHECKS (PJ_ICE_MAX_CAND * 2)
+
+/* Increase limits to allow more formats */
+#define PJMEDIA_MAX_SDP_FMT 64
+#define PJMEDIA_MAX_SDP_BANDW 4
+#define PJMEDIA_MAX_SDP_ATTR (PJMEDIA_MAX_SDP_FMT*2 + 4)
+#define PJMEDIA_MAX_SDP_MEDIA 16