Parse SDP connection info with multicast address (#3529)

This commit is contained in:
sauwming 2023-05-01 09:08:18 +08:00 committed by GitHub
parent dc4778ed8a
commit d6d67b8ac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -383,6 +383,8 @@ struct pjmedia_sdp_conn
pj_str_t net_type; /**< Network type ("IN"). */
pj_str_t addr_type; /**< Address type ("IP4", "IP6"). */
pj_str_t addr; /**< The address. */
pj_uint8_t ttl; /**< Multicast address TTL */
pj_uint8_t no_addr; /**< Multicast number of addresses */
};

View File

@ -1151,7 +1151,28 @@ static void parse_connection_info(pj_scanner *scanner, pjmedia_sdp_conn *conn,
/* address. */
pj_scan_get_until_chr(scanner, "/ \t\r\n", &conn->addr);
PJ_TODO(PARSE_SDP_CONN_ADDRESS_SUBFIELDS);
/* Parse multicast details, if any. */
if (*scanner->curptr == '/') {
pj_str_t str;
unsigned long ul;
pj_scan_get_until_chr(scanner, "/ \t\r\n", &str);
if (*scanner->curptr == '/') {
if ((pj_strtoul3(&str, &ul, 10) != PJ_SUCCESS) || ul > 255) {
on_scanner_error(scanner);
return;
}
conn->ttl = (pj_uint8_t)ul;
}
if ((pj_strtoul3(&str, &ul, 10) != PJ_SUCCESS) || ul > 255) {
on_scanner_error(scanner);
return;
}
conn->no_addr = (pj_uint8_t)ul;
}
/* We've got what we're looking for, skip anything until newline */
pj_scan_skip_line(scanner);