mpromonet / webrtc-streamer

WebRTC streamer for V4L2 capture devices, RTSP sources and Screen Capture
https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/?layout=2x2
The Unlicense
2.8k stars 581 forks source link

SDP munging of offer #181

Open saket424 opened 5 years ago

saket424 commented 5 years ago

Michel, Have you given consideration to supporting sdp munging so that Simulcast and different codecs, bitrate and resolutions including vp9 svc in webrtc-streamer may be supported ? This is achieved by offering munged sdp so the webrtc code knows what needs to be done. Janus Videoroom supports both simulcast and vp9 svc

https://github.com/meetecho/janus-gateway/pull/944

https://webrtchacks.com/a-playground-for-simulcast-without-an-sfu/

saket424 commented 5 years ago

Janus as of chrome73 now supports simulcast for H264 and also VP9(soon to be merged-branch) in addition to VP8. It is enabled just using a query parameter to the videroomtest.html demo

videoroomtest.html?simulcast=true

It would be cool if webrtc-streamer also allows for simulcast in the sdp offer

saket424 commented 5 years ago

Michel, In janus.js(line 2920) there is a function called mungeSdpForSimulcasting(sdp) which will send janus multiple ssrc values. Is this something you can add to the webrtc-streamer html so we can give it a try

Munge the sdp before setting local description (offer) and then janus knows how to interpret the various simulcast streams as part of (answer)

mpromonet commented 5 years ago

Hi saket424, Feel free to submit a pull request to implement it. Best Regards, Michel.

saket424 commented 5 years ago

Hi Michel, I gave it a whirl with chrome73 by copying function called mungeSdpForSimulcasting(sdp) from janus.js -- janus video room now thinks 3 ssrc values are going to come but apparently only one makes it -- so my guess is only one encoder is being wired by your code. When simulcasting works correctly, 3 separate encoders with 3 different spatial resolutions and or temporal resolutions are sent by the encoder and the user is able to select which resolution they want to view.

diff -Narup janusvideoroom.js.orig janusvideoroom.js --- janusvideoroom.js.orig 2019-01-31 17:07:31.909475321 -0600 +++ janusvideoroom.js 2019-01-31 19:28:36.456686688 -0600 @@ -187,6 +187,10 @@ JanusVideoRoom.prototype.onJoinRoomResul // WebRTC streamer callback for Offer // ------------------------------------------ JanusVideoRoom.prototype.onCreateOffer = function(dataJson,name,sessionId,pluginid,peerid) {

simulcastattempt