obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

obs-webrtc: Add Link Header support

Open Sean-Der opened this issue 1 year ago • 1 comments

Description

WHIP/WHEP allows ICE Servers to be specified via Link Headers

Motivation and Context

Some WebRTC deployments are behind a NAT. Companies/developers place their TURN server on the edge, and use that to access the TURN servers.

I have had 3 companies reach out to me about this, so implemented it.

How Has This Been Tested?

Ran broadcast-box and only listened on 127.0.0.1 and confirmed that traffic could be routed through pion/turn

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [x] I have included updates to all appropriate documentation.

Sean-Der avatar Apr 12 '24 18:04 Sean-Der

I just tested this against OBS Studio and it seems to be working flawlessly.

iameli avatar Apr 12 '24 22:04 iameli

@tt2468 Could I get a review of this one now please?

Sean-Der avatar May 14 '24 20:05 Sean-Der

I have created a test application that confirms this is working. You can get it here https://github.com/Sean-Der/whip-turn-test

The only thing you need to change is the IP address of the host you are running the server on here

OBS without this patch running against this server behaves like this. It shows WHIP connected and starting pushing media.

Running WHIP server at http://localhost:8085
ICE Connection State has changed: checking
ICE Connection State has changed: connected
Getting incoming media audio/opus
Getting incoming media video/H264

Without this change the server prints the following. OBS doesn't have TURN support so is unable to connect

Running WHIP server at http://localhost:8085
ICE Connection State has changed: checking

Some users today who are using WHIP will see OBS unable to connect and have no idea why

Sean-Der avatar May 24 '24 16:05 Sean-Der

Thank you so much @DDRBoxman @RytoEX I really appreciate the reviews :)

Sean-Der avatar Jun 03 '24 03:06 Sean-Der

I'm noticing that this PR appears to be un-compilable on Ubuntu 22.04 due to the usage of CURLH_HEADER and Ubuntu's CURL version not having support. We have existing header parsing logic which was used to parse the Location header. I would say we will need to expand that existing logic instead of using CURLH_HEADER.

tt2468 avatar Jun 06 '24 05:06 tt2468

I will work on fixing this now @tt2468

Sean-Der avatar Jun 06 '24 14:06 Sean-Der

Fixed with https://github.com/obsproject/obs-studio/pull/10786

Sean-Der avatar Jun 07 '24 18:06 Sean-Der