microsoft / MixedReality-WebRTC

MixedReality-WebRTC is a collection of components to help mixed reality app developers integrate audio and video real-time communication into their application and improve their collaborative experience
https://microsoft.github.io/MixedReality-WebRTC/
MIT License
909 stars 283 forks source link

[Question] Is it possible to run the MixedReality-WebRTC inside Docker #785

Open cristianmad opened 3 years ago

cristianmad commented 3 years ago

Hi,

For my project (.netcore 5), I need to establish WebRTC connections with other peers. The application is released as a Docker image and runs in a Kubernetes cluster (as Docker containers).

I was looking at using the MixedReality-WebRTC library in order to establish the WebRTC peer connections however I noticed a problem. If I'm running the application from Visual Studio (in Debug mode), I am able to establish the peer connection and receive RTP packages (already decoded) which is great. However, when trying the same from a Docker image, the peer connection is being established (looks like it is anyway) however no RTP packages ever arrive. I have tried with both Linux and Windows base Docker images. The issue seems to be related to no user being logged into the OS (as far as I could tell), but I could be wrong.

My questions are:

  1. Should I be able to used the MixedReality-WebRTC libary in order to establish peer connections from inside a Docker image/container?
  2. If yes, are there any recommneded base images I should be trying with?
  3. Any other things I may need to be aware of? :)

Thank you, Cristian

spacecheeserocks commented 3 years ago

In theory, there shouldn't be an issue running WebRTC within a Docker container - other than the fact you won't be able to access a microphone/camera from within a docker container.

I'm not 100% sure, but I have a hunch that this library secretly always tries to load a microphone stream (even if you aren't using it), which might cause the library to completely fail to init within Docker.

I don't know any to recommend, but if you are not targeting UWP, you will probably find more flexibility with another WebRTC library.

cristianmad commented 3 years ago

In theory, there shouldn't be an issue running WebRTC within a Docker container - other than the fact you won't be able to access a microphone/camera from within a docker container.

I'm not 100% sure, but I have a hunch that this library secretly always tries to load a microphone stream (even if you aren't using it), which might cause the library to completely fail to init within Docker.

I don't know any to recommend, but if you are not targeting UWP, you will probably find more flexibility with another WebRTC library.

Thank you! (I read your reply back in July but forgot to answer :) )

I was initially using sipsorcery which worked great - on Linux docker images. The problem was (and still is) its lack of support for media renegotiation. In our case, we have use cases where media is being renegotiated multiple times.

The mixed reality webrtc library supports media renegotiation, but it does not work in a Docker container (ideally Linux based).

djee-ms commented 3 years ago

I'm not 100% sure, but I have a hunch that this library secretly always tries to load a microphone stream (even if you aren't using it), which might cause the library to completely fail to init within Docker.

The underlying libwebrtc from Google always tries to open the microphone on startup, and crashes if that fails. This has caused a number of varied issues, several of them have been logged with Google (e.g. 11897, 10881, 9474). Unfortunately it's tricky for mr-werbtc to work around that since audio capture is deeply integrated within libwebrtc. This also causes us troubles on CI, where we had to disable audio tests because of that.