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

Remove Hard Requirement for Pulse Audio by Loading It Dynamically

Open Kas-tle opened this issue 1 month ago • 0 comments

I am trying to use this library in a docker scenario for which I do not require audio or video features. This makes the hard requirement for pulse audio a bit of a pain. See https://github.com/devopvoid/webrtc-java/discussions/153 for example.

Disabling audio as described in the docs does not help (https://jrtc.dev/guide/audio/audio-devices#disabling-audio) still leads to a java.lang.UnsatisfiedLinkError. This is because the static block in AudioDeviceModuleBase that loads all natives https://github.com/devopvoid/webrtc-java/blob/main/webrtc/src/main/java/dev/onvoid/webrtc/media/audio/AudioDeviceModuleBase.java#L44-L51 immediately requires pulse due to the hard link in https://github.com/devopvoid/webrtc-java/blob/main/webrtc-jni/src/main/cpp/CMakeLists.txt#L113.

This PR removes the hard link to pulse and dynamically loads all its functions. This allows use of, e.g. kDummyAudio. I fully understand this could be seen as a hacky solution, so I would be happy to work on any suggestions you might have for an alternate approach.

I also updated the actions to:

  • Archive the artifacts for the various builds so it is easier to test changes without having to setup a whole dev environment
  • Only run the publishing step when the repo is devopvoid/webrtc-java so that the action does not fail on forks

Kas-tle avatar Dec 01 '25 05:12 Kas-tle