|
@@ -630,6 +630,50 @@ TraceablePeerConnection.prototype.getRemoteTracks = function(
|
630
|
630
|
return remoteTracks;
|
631
|
631
|
};
|
632
|
632
|
|
|
633
|
+/**
|
|
634
|
+ * Parses the remote description and returns the sdp lines of the sources associated with a remote participant.
|
|
635
|
+ *
|
|
636
|
+ * @param {string} id Endpoint id of the remote participant.
|
|
637
|
+ * @returns {Array<string>} The sdp lines that have the ssrc information.
|
|
638
|
+ */
|
|
639
|
+TraceablePeerConnection.prototype.getRemoteSourceInfoByParticipant = function(id) {
|
|
640
|
+ const removeSsrcInfo = [];
|
|
641
|
+ const remoteTracks = this.getRemoteTracks(id);
|
|
642
|
+
|
|
643
|
+ if (!remoteTracks?.length) {
|
|
644
|
+ return removeSsrcInfo;
|
|
645
|
+ }
|
|
646
|
+ const primarySsrcs = remoteTracks.map(track => track.getSSRC());
|
|
647
|
+ const sdp = new SDP(this.remoteDescription.sdp);
|
|
648
|
+
|
|
649
|
+ for (const media of sdp.media) {
|
|
650
|
+ primarySsrcs.forEach((ssrc, idx) => {
|
|
651
|
+ let lines = '';
|
|
652
|
+ let ssrcLines = SDPUtil.findLines(media, `a=ssrc:${ssrc}`);
|
|
653
|
+
|
|
654
|
+ if (ssrcLines.length) {
|
|
655
|
+ if (!removeSsrcInfo[idx]) {
|
|
656
|
+ removeSsrcInfo[idx] = '';
|
|
657
|
+ }
|
|
658
|
+
|
|
659
|
+ // Check if there are any FID groups are present for the primary ssrc.
|
|
660
|
+ const fidLines = SDPUtil.findLines(media, `a=ssrc-group:FID ${ssrc}`);
|
|
661
|
+
|
|
662
|
+ if (fidLines.length) {
|
|
663
|
+ const secondarySsrc = fidLines[0].split(' ')[2];
|
|
664
|
+
|
|
665
|
+ lines += `${fidLines[0]}\r\n`;
|
|
666
|
+ ssrcLines = ssrcLines.concat(SDPUtil.findLines(media, `a=ssrc:${secondarySsrc}`));
|
|
667
|
+ }
|
|
668
|
+ removeSsrcInfo[idx] += `${ssrcLines.join('\r\n')}\r\n`;
|
|
669
|
+ }
|
|
670
|
+ removeSsrcInfo[idx] += lines;
|
|
671
|
+ });
|
|
672
|
+ }
|
|
673
|
+
|
|
674
|
+ return removeSsrcInfo;
|
|
675
|
+};
|
|
676
|
+
|
633
|
677
|
/**
|
634
|
678
|
* Tries to find {@link JitsiTrack} for given SSRC number. It will search both
|
635
|
679
|
* local and remote tracks bound to this instance.
|
|
@@ -2128,20 +2172,18 @@ TraceablePeerConnection.prototype.setSenderVideoDegradationPreference = function
|
2128
|
2172
|
return Promise.resolve();
|
2129
|
2173
|
}
|
2130
|
2174
|
const parameters = videoSender.getParameters();
|
|
2175
|
+ const preference = localVideoTrack.videoType === VideoType.CAMERA
|
|
2176
|
+ ? DEGRADATION_PREFERENCE_CAMERA
|
|
2177
|
+ : this.options.capScreenshareBitrate && browser.usesPlanB()
|
2131
|
2178
|
|
2132
|
|
- if (!parameters.encodings || !parameters.encodings.length) {
|
2133
|
|
- return Promise.resolve();
|
2134
|
|
- }
|
2135
|
|
- for (const encoding in parameters.encodings) {
|
2136
|
|
- if (parameters.encodings.hasOwnProperty(encoding)) {
|
2137
|
|
- const preference = localVideoTrack.videoType === VideoType.CAMERA
|
2138
|
|
- ? DEGRADATION_PREFERENCE_CAMERA
|
2139
|
|
- : DEGRADATION_PREFERENCE_DESKTOP;
|
|
2179
|
+ // Prefer resolution for low fps share.
|
|
2180
|
+ ? DEGRADATION_PREFERENCE_DESKTOP
|
2140
|
2181
|
|
2141
|
|
- logger.info(`Setting video sender degradation preference on ${this} to ${preference}`);
|
2142
|
|
- parameters.encodings[encoding].degradationPreference = preference;
|
2143
|
|
- }
|
2144
|
|
- }
|
|
2182
|
+ // Prefer frame-rate for high fps share.
|
|
2183
|
+ : DEGRADATION_PREFERENCE_CAMERA;
|
|
2184
|
+
|
|
2185
|
+ logger.info(`Setting a degradation preference of ${preference} on local video track`);
|
|
2186
|
+ parameters.degradationPreference = preference;
|
2145
|
2187
|
this.tpcUtils.updateEncodingsResolution(parameters);
|
2146
|
2188
|
|
2147
|
2189
|
return videoSender.setParameters(parameters);
|