Skip to content

Commit

Permalink
Merge branch 'dev/fix-uninferred-types' of github.com:DanielMcAssey/l…
Browse files Browse the repository at this point in the history
…ib-jitsi-meet into dev/fix-uninferred-types
  • Loading branch information
DanielMcAssey committed Jan 8, 2024
2 parents 11a870b + 04416f8 commit 1ee0293
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 39 deletions.
13 changes: 11 additions & 2 deletions JitsiConference.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ JitsiConference.prototype._init = function(options = {}) {
? config.videoQuality.mobileCodecPreferenceOrder
: config.videoQuality?.codecPreferenceOrder,
disabledCodec: _getCodecMimeType(config.videoQuality?.disabledCodec),
preferredCodec: _getCodecMimeType(config.videoQuality?.preferredCodec)
preferredCodec: _getCodecMimeType(config.videoQuality?.preferredCodec),
supportsAv1: config.testing?.enableAv1Support
},
p2p: {
preferenceOrder: browser.isMobileDevice() && config.p2p?.mobileCodecPreferenceOrder
Expand Down Expand Up @@ -3077,6 +3078,13 @@ JitsiConference.prototype._updateProperties = function(properties = {}) {
});
}
});

const oldValue = this._hasVisitors;

this._hasVisitors = this.properties['visitor-count'] > 0;

// as this is visitor leaving, consider it leaving for _maybeStartOrStopP2P
oldValue && !this._hasVisitors && this._maybeStartOrStopP2P(true);
}
};

Expand Down Expand Up @@ -3269,7 +3277,8 @@ JitsiConference.prototype._maybeStartOrStopP2P = function(userLeftEvent) {
if (!this.isP2PEnabled()
|| this.isP2PTestModeEnabled()
|| (browser.isFirefox() && !this._firefoxP2pEnabled)
|| this.isE2EEEnabled()) {
|| this.isE2EEEnabled()
|| this._hasVisitors) {
logger.info('Auto P2P disabled');

return;
Expand Down
6 changes: 5 additions & 1 deletion modules/RTC/CodecSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import browser from '../browser';
const logger = getLogger(__filename);

// Default video codec preferences on mobile and desktop endpoints.
const DESKTOP_VIDEO_CODEC_ORDER = [ CodecMimeType.VP9, CodecMimeType.VP8, CodecMimeType.H264, CodecMimeType.AV1 ];
const DESKTOP_VIDEO_CODEC_ORDER = [ CodecMimeType.VP9, CodecMimeType.VP8, CodecMimeType.H264 ];
const MOBILE_P2P_VIDEO_CODEC_ORDER = [ CodecMimeType.H264, CodecMimeType.VP8, CodecMimeType.VP9 ];
const MOBILE_VIDEO_CODEC_ORDER = [ CodecMimeType.VP8, CodecMimeType.VP9, CodecMimeType.H264 ];

Expand Down Expand Up @@ -112,6 +112,10 @@ export class CodecSelection {
? MOBILE_P2P_VIDEO_CODEC_ORDER
: browser.isMobileDevice() ? MOBILE_VIDEO_CODEC_ORDER : DESKTOP_VIDEO_CODEC_ORDER;

if (connectionType === 'p2p' || this.options.jvb.supportsAv1) {
videoCodecMimeTypes.push(CodecMimeType.AV1);
}

const supportedCodecs = videoCodecMimeTypes.filter(codec =>
(window.RTCRtpReceiver?.getCapabilities?.(MediaType.VIDEO)?.codecs ?? [])
.some(supportedCodec => supportedCodec.mimeType.toLowerCase() === `${MediaType.VIDEO}/${codec}`));
Expand Down
36 changes: 18 additions & 18 deletions modules/connectivity/ConnectionQuality.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,30 @@ const logger = getLogger(__filename);
const STATS_MESSAGE_TYPE = 'stats';

const kSimulcastFormats = [
{ width: 1920,
{
height: 1080,
layers: 3,
target: 'high' },
{ width: 1280,
target: 'high'
},
{
height: 720,
layers: 3,
target: 'high' },
{ width: 960,
target: 'high'
},
{
height: 540,
layers: 3,
target: 'standard' },
{ width: 640,
target: 'standard'
},
{
height: 360,
layers: 2,
target: 'standard' },
{ width: 480,
target: 'standard'
},
{
height: 270,
layers: 2,
target: 'low' },
{ width: 320,
target: 'low'
},
{
height: 180,
layers: 1,
target: 'low' }
target: 'low'
}
];

/**
Expand Down
33 changes: 16 additions & 17 deletions modules/statistics/RTPStatsCollector.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ const logger = getLogger(__filename);
* @returns {number} packet loss percent
*/
function calculatePacketLoss(lostPackets, totalPackets) {
if (!totalPackets || totalPackets <= 0
|| !lostPackets || lostPackets <= 0) {
return 0;
if (lostPackets > 0 && totalPackets > 0) {
return Math.round(lostPackets / totalPackets * 100);
}

return Math.round((lostPackets / totalPackets) * 100);
return 0;
}

/**
Expand Down Expand Up @@ -354,18 +353,18 @@ StatsCollector.prototype._processAndEmitReport = function() {
}

this.conferenceStats.bitrate = {
'upload': bitrateUpload,
'download': bitrateDownload
upload: bitrateUpload,
download: bitrateDownload
};

this.conferenceStats.bitrate.audio = {
'upload': audioBitrateUpload,
'download': audioBitrateDownload
upload: audioBitrateUpload,
download: audioBitrateDownload
};

this.conferenceStats.bitrate.video = {
'upload': videoBitrateUpload,
'download': videoBitrateDownload
upload: videoBitrateUpload,
download: videoBitrateDownload
};

this.conferenceStats.packetLoss = {
Expand Down Expand Up @@ -406,13 +405,13 @@ StatsCollector.prototype._processAndEmitReport = function() {
StatisticsEvents.CONNECTION_STATS,
this.peerconnection,
{
'bandwidth': this.conferenceStats.bandwidth,
'bitrate': this.conferenceStats.bitrate,
'packetLoss': this.conferenceStats.packetLoss,
'resolution': resolutions,
'framerate': framerates,
'codec': codecs,
'transport': this.conferenceStats.transport,
bandwidth: this.conferenceStats.bandwidth,
bitrate: this.conferenceStats.bitrate,
packetLoss: this.conferenceStats.packetLoss,
resolution: resolutions,
framerate: framerates,
codec: codecs,
transport: this.conferenceStats.transport,
localAvgAudioLevels,
avgAudioLevels
});
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
},
"browser": "dist/umd/lib-jitsi-meet.min.js",
"module": "dist/esm/JitsiMeetJS.js",
"types": "types/index.d.ts",
"files": [
"dist",
"types"
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"**/*.spec.ts",
"*.conf*.js",
"index.js",
"index.d.ts",
"lib-jitsi-meet.*.js",
"webpack*.js",
]
Expand Down

0 comments on commit 1ee0293

Please sign in to comment.