werift-webrtc icon indicating copy to clipboard operation
werift-webrtc copied to clipboard

support rtcp without address

Open tylerlong opened this issue 1 year ago • 1 comments
trafficstars

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.

tylerlong avatar Nov 28 '23 22:11 tylerlong

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];
}

tylerlong avatar Nov 28 '23 22:11 tylerlong