meetecho / janus-gateway

Janus WebRTC Server
https://janus.conf.meetecho.com
GNU General Public License v3.0
8.17k stars 2.47k forks source link

[1.x] Cannot change video devices in android after initial set up #3201

Closed rjnpnfigueiredo closed 1 year ago

rjnpnfigueiredo commented 1 year ago

Issue can be quickly verified by using the Janus device selection demo from the main website 1.x - https://janus.conf.meetecho.com/devicetest.html 0.x - https://janus-legacy.conf.meetecho.com/devicetest.html

Steps to reproduce:

  1. Start demo
  2. Select any video device
  3. Press "Change Devices"
  4. Wait for video to start
  5. Select a different video device
  6. Press "Change Devices"
  7. Issue should happen

What version of Janus is this happening on? This is happening to 1.x but 0.x versions seem to work fine

Have you tested a more recent version of Janus too? Tested most recent version

Was this working before? 0.x is working, 1.x is not

Is there a gdb or libasan trace of the issue? From android chrome console logs:

janus.js:2273 DOMException: Could not start video source
replaceTracks @ janus.js:2273
await in replaceTracks (async)
replaceTracks @ janus.js:1359
restartCapture @ devicetest.js:124
(anonymous) @ devicetest.js:88
dispatch @ jquery.min.js:3
v.handle @ jquery.min.js:3
lminiero commented 1 year ago

Could not start video source means the WebRTC stack could not access the webcam, so it doesn't look like a video device change issue to me, but a problem with the device itself.

rjnpnfigueiredo commented 1 year ago

Could not start video source means the WebRTC stack could not access the webcam, so it doesn't look like a video device change issue to me, but a problem with the device itself.

I initially though the same, but given that the same example using the 0.x version works fine on the exact same device under the same circumstances, there may be some issue on how it is acquiring access to a different video device after initial capture.

lminiero commented 1 year ago

I've noticed that the demo behaves weirdly on desktop too, since both webcams remain active in the local box. I suspect that's what may be causing the problem on Android too (maybe you can't capture both webcams at the same time?). I'll check what causes the demo to behave like that and come up with a fix, in case.

lminiero commented 1 year ago

@rjnpnfigueiredo please refer to the PR above.

rjnpnfigueiredo commented 1 year ago

@lminiero Looks all good on my end!

lminiero commented 1 year ago

Ack, I'll merge then, thanks!