I am trying to control the input to a WebRTC web application running on Chrome, controlled by Selenium, inside a Docker container.
This is part of an automated test of the WebRTC application.
As part of the test, I need to be able to check that the audio is being received on the other side when it supposed to be.
Basically, I want to check that if one client speaks, the other client hears it, and vice-versa, unless the client is on mute.
Now, I can easily get Chrome to emulate microphone (and camera) input by starting it with the command-line parameters:
Which has the problem that the default sample has a lot of silence in it (harder to detect). I can solve that by supplying my own audio file with more consistent audio:
But this has another problem - if Chrome is both sending and receiving audio at the same time, the received audio is severely clobbered, almost into complete silence, as part of Chrome's echo cancellation functionality. (Echo cancellation is set as part of the WebRTC application, and not as part of Chrome itself, and I don't want to make changes to the code being tested to facilitate the test.)
Using two different samples (one for each client) helps slightly, but not very much.
The real problem is that both clients "talk" non-stop for as long as they are running, which both messes up the audio because of the aforementioned echo cancellation, and also isn't a realistic scenario to test because people don't usually talk over each other constantly.
I could theoretically use specially-created samples with intentional sections of noise/silence in them, but then aligning those samples between clients and with the test validation would be a nightmare.
What I really I need is to be able to start and stop playing audio into the client on demand.
There doesn't seem to be any way to control the fake media stream in Chrome, so it seems that my best option is probably to somehow create a fake "microphone" audio input device inside the Docker container, and control that instead.
On a standard Linux, you can use pulseaudio to loop the audio output back in as a capture device, which looks promising, but I don't know how to use that inside a Docker container.
The Docker container doesn't even have any audio devices to use it with.
I've found various guides on how to set up a Docker to use the audio hardware of the host machine, but that isn't very useful since these containers are running on eSXI servers and don't have any sound cards to use.
Pulseaudio also supports virtual devices, but those need drivers / kernel modules to work. I may be wrong, but I don't think you can use those inside a Docker container.
Sorry if the above was a bit wordy, but I was trying to explain the problem and the various directions I've already looked into.
So, does anyone know a way that I could control audio input into Chrome's capture device inside a Docker container, either using a fake capture device, or through some other means?