Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using codec unsupported by the server causes uncaught error in promise #42

Open
bekriebel opened this issue Sep 11, 2021 · 6 comments
Open

Comments

@bekriebel
Copy link
Contributor

bekriebel commented Sep 11, 2021

Using v0.12.1 from nmpjs

  1. Use a server that does not have h264 as an enabled codec
  2. Create a video track with videoCodec: "h264"
  3. Note that the track is not published to the server, but no error or warning is spawned
  4. Mute the video track
  5. Unmute the video track, the following error is thrown in the console log:
01:51:47.553 LocalTrack.js?0f51:77 restarting track with constraints {width: {…}, height: {…}, frameRate: {…}, deviceId: {…}, resolution: {…}}
01:51:47.568 LocalVideoTrack {_events: {…}, _eventsCount: 2, _maxListeners: undefined, attachedElements: Array(1), isMuted: false, …}
01:51:48.257 LocalTrack.js?0f51:92 re-acquired MediaStreamTrack
01:51:48.258 LocalVideoTrack.js?646b:6 Uncaught (in promise) Error
Promise.then (async)
step @ LocalVideoTrack.js?646b:7
eval @ LocalVideoTrack.js?646b:8
__awaiter @ LocalVideoTrack.js?646b:4
restartTrack @ LocalVideoTrack.js?646b:163
unmute @ LocalVideoTrack.js?646b:71
(anonymous) @ VM22733:1
@davidzhao
Copy link
Member

hey @bekriebel, I'm unable to reproduce this error. Which browser / OS did you see this with?

Can you reproduce it with the sample JS client? If so, please attach a code snippet on what you've changed.

@bekriebel
Copy link
Contributor Author

@davidzhao Yeah, I'm able to reproduce with the client as well. Tested with both Chrome and Edge on Windows 11 (I'll try again with Windows 10 a bit later, but I doubt that's an issue considering that the video works and it's just unmute that is failing).

The only change needed to the JS client sample is to add videoCodec: 'h264', to the room connect call:

room = await connect(url, token, {
logLevel: LogLevel.debug,
audio: true,
video: {
resolution: VideoPresets.qhd.resolution,
},
simulcast,
rtcConfig,
});
and then connect, mute the video track, and unmute the video track.

This is connecting to a server that is v0.12.5 with my prefer local node selection change added.

@bekriebel
Copy link
Contributor Author

Ahh, I figured it out. I didn't realize that h264 was disabled server-side by default. after adding

room:
  enabled_codecs:
    - mime: audio/opus
    - mime: video/vp8
    - mime: video/h264

to my livekit-config it is no longer throwing the error. Ideally this would output a warning or error message and fall back to VP8 when h264 isn't available.

@davidzhao
Copy link
Member

ah yes.. that would do it. we removed h264 from the default due to a limitation with supporting tracks using multiple codecs in the same room. Once that bug is fixed, we should be able to add both into enabled_codecs by default.

for now, just a heads up that mixing different video codecs in the same room is likely to lead to bugs where participants wouldn't be able to receive certain tracks that's different from their initial subscription.

@bekriebel bekriebel changed the title Unmuting h264 video track causes uncaught error in promise Using codec unsupported by the server causes uncaught error in promise Sep 15, 2021
@bekriebel
Copy link
Contributor Author

Thanks. Yeah, I noticed that mixing the codecs wasn't working very well. I was also getting a lot of frame drops with h264, so I've just disabled it again for now. I updated the issue to reflect what is actually happening. Feel free to close if you consider it a non-issue, though.

@davidzhao
Copy link
Member

oh interesting.. I think we should keep it open for now. I was able to reproduce it with the same setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants