diff --git a/burrito/burrito.js b/burrito/burrito.js index 22179b9..94aaed3 100644 --- a/burrito/burrito.js +++ b/burrito/burrito.js @@ -39,6 +39,7 @@ let resolutions = [ webCodecVideoElement: spatial240pWebCodecVideoElement, webCodecTrackGenerator: mediaStreamTrackGenerator240p, webCodecWritable: mediaStreamWritable240p, + scaleResolutionDownBy: 4.5, }, { title: "480p", @@ -52,6 +53,7 @@ let resolutions = [ webCodecVideoElement: spatial480pWebCodecVideoElement, webCodecTrackGenerator: mediaStreamTrackGenerator480p, webCodecWritable: mediaStreamWritable480p, + scaleResolutionDownBy: 2.25 }, { title: "720p", @@ -65,6 +67,7 @@ let resolutions = [ webCodecVideoElement: spatial720pWebCodecVideoElement, webCodecTrackGenerator: mediaStreamTrackGenerator720p, webCodecWritable: mediaStreamWritable720p, + scaleResolutionDownBy: 1.5, }, ]; @@ -246,7 +249,8 @@ async function call() { resolution.remoteVideoElement.srcObject = e.streams[0]; }, - scalabilityMode + scalabilityMode, + resolution.scaleResolutionDownBy ); resolution.videoPipe.pc1.getSenders().forEach((s) => { diff --git a/js/main.js b/js/main.js index a045085..8c09f74 100644 --- a/js/main.js +++ b/js/main.js @@ -382,6 +382,7 @@ async function call() { gotRemoteStream(e.streams[0], video2); }, primarySVCModeTitle.innerText, + 1.0, ); startToEnd.pc1.getSenders().forEach((s) => setupSenderTransform(s, true)); await startToEnd.negotiate(); @@ -400,6 +401,7 @@ async function call() { gotRemoteStream(e.streams[0], video2a); }, secondarySVCModeTitle.innerText, + 1.0, ); secondaryStartToEnd.pc1.getSenders().forEach((s) => setupSenderTransform(s, false)); await secondaryStartToEnd.negotiate(); diff --git a/js/videopipe.js b/js/videopipe.js index e6fb4fb..d6e0086 100644 --- a/js/videopipe.js +++ b/js/videopipe.js @@ -21,7 +21,7 @@ // 'use strict'; -function VideoPipe(stream, forceSend, forceReceive, handler, scalabilityMode) { +function VideoPipe(stream, forceSend, forceReceive, handler, scalabilityMode, scaleResolutionDownBy) { this.pc1 = new RTCPeerConnection({ encodedInsertableStreams: forceSend, }); @@ -36,7 +36,12 @@ function VideoPipe(stream, forceSend, forceReceive, handler, scalabilityMode) { } else { let tr = this.pc1.addTransceiver(track, { streams: [stream], - sendEncodings: [{ scalabilityMode: scalabilityMode }], + sendEncodings: [ + { + scalabilityMode: scalabilityMode, + scaleResolutionDownBy: scaleResolutionDownBy + } + ], }); const videoCodecs = RTCRtpSender.getCapabilities('video').codecs; @@ -59,7 +64,7 @@ VideoPipe.prototype.negotiate = async function () { const offer = await this.pc1.createOffer(); // Disable video/red to allow for easier inspection in Wireshark. - await this.pc2.setRemoteDescription({ type: 'offer', sdp: offer.sdp.replace('red/90000', 'green/90000') }); + await this.pc2.setRemoteDescription({type: 'offer', sdp: offer.sdp.replace('red/90000', 'green/90000')}); await this.pc1.setLocalDescription(offer); const answer = await this.pc2.createAnswer();