support rtcp without address
tylerlong opened this issue · comments
Tyler Liu commented
function ipAddressFromSdp(sdp: string) {
const m = sdp.match(/^IN (IP4|IP6) ([^ ]+)$/);
if (!m) throw new Error("exception");
return m[2];
}
According to https://www.ietf.org/rfc/rfc3605.txt
m=audio 49170 RTP/AVP 0
a=rtcp:53020
is valid. In such case, there is no IP address.
Tyler Liu commented
Suggested change:
function ipAddressFromSdp(sdp: string) {
const m = sdp.match(/^IN (IP4|IP6) ([^ ]+)$/);
if (!m) return undefined;
return m[2];
}
Or
function ipAddressFromSdp(sdp: string) {
const m = sdp.match(/^IN (IP4|IP6) ([^ ]+)$/);
if (!m) return '0.0.0.0';
return m[2];
}