From 959cca595e35927c7ff1e6a8853eea7d1f5c5c43 Mon Sep 17 00:00:00 2001 From: zuvola Date: Tue, 23 Apr 2024 10:52:33 +0900 Subject: [PATCH 1/2] Added SDP for probator (cherry picked from commit 7a1eeb2be1595bd6a910069d744fb719374116cf) --- .../src/VideoPlayer/StreamController.ts | 5 +++++ SFU/mediasoup-sdp-bridge/lib/index.js | 21 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/Frontend/library/src/VideoPlayer/StreamController.ts b/Frontend/library/src/VideoPlayer/StreamController.ts index 879ab1a2..85849722 100644 --- a/Frontend/library/src/VideoPlayer/StreamController.ts +++ b/Frontend/library/src/VideoPlayer/StreamController.ts @@ -31,6 +31,11 @@ export class StreamController { 'handleOnTrack ' + JSON.stringify(rtcTrackEvent.streams), 6 ); + + if (rtcTrackEvent.track.id == 'probator') { + return; + } + const videoElement = this.videoElementProvider.getVideoElement(); if (rtcTrackEvent.track) { diff --git a/SFU/mediasoup-sdp-bridge/lib/index.js b/SFU/mediasoup-sdp-bridge/lib/index.js index 2725e69c..f4a0baff 100644 --- a/SFU/mediasoup-sdp-bridge/lib/index.js +++ b/SFU/mediasoup-sdp-bridge/lib/index.js @@ -138,10 +138,14 @@ class SdpEndpoint { }); const sendMsid = uuid_1.v4().substr(0, 8); console.log("[SdpEndpoint.createOffer] Make 'sendonly' SDP Offer"); + var videoRtpParameters; for (let i = 0; i < this.consumers.length; i++) { const mid = (_a = this.consumers[i].rtpParameters.mid) !== null && _a !== void 0 ? _a : "nomid"; const kind = this.consumers[i].kind; const sendParams = this.consumers[i].rtpParameters; + if (kind === 'video') { + videoRtpParameters = JSON.parse(JSON.stringify(sendParams)) + } sdpBuilder.receive({ mid, kind, @@ -150,6 +154,23 @@ class SdpEndpoint { trackId: `${sendMsid}-${kind}`, }); } + if (videoRtpParameters) { + videoRtpParameters.codecs[0].payloadType = 127; + const rtpParameters = { + mid: 'probator', + codecs: [videoRtpParameters.codecs[0]], + headerExtensions: videoRtpParameters.headerExtensions, + encodings: [{ ssrc: 1234 }], + rtcp: { cname: 'probator' }, + }; + sdpBuilder.receive({ + mid: 'probator', + kind: 'video', + offerRtpParameters: rtpParameters, + streamId: 'probator', + trackId: 'probator', + }); + } if (this.consumeData) { sdpBuilder.receiveSctpAssociation(); } From 0d8d08184755d177f918235a4e44b4d0ef05d856 Mon Sep 17 00:00:00 2001 From: zuvola Date: Tue, 7 May 2024 15:05:29 +0900 Subject: [PATCH 2/2] Update Frontend/library/src/VideoPlayer/StreamController.ts Co-authored-by: Luke Bermingham <1215582+lukehb@users.noreply.github.com> (cherry picked from commit 35f1733392b0a2659e4b2d35bc7c32bcdd256c2f) --- Frontend/library/src/VideoPlayer/StreamController.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Frontend/library/src/VideoPlayer/StreamController.ts b/Frontend/library/src/VideoPlayer/StreamController.ts index 85849722..d7cad1a4 100644 --- a/Frontend/library/src/VideoPlayer/StreamController.ts +++ b/Frontend/library/src/VideoPlayer/StreamController.ts @@ -31,7 +31,8 @@ export class StreamController { 'handleOnTrack ' + JSON.stringify(rtcTrackEvent.streams), 6 ); - + // Do not add the track if the ID is `probator` as this is special track created by mediasoup for bitrate probing. + // Refer to https://github.com/EpicGamesExt/PixelStreamingInfrastructure/pull/86 for more details. if (rtcTrackEvent.track.id == 'probator') { return; }