From 553ef36aa80de32b3742b44c475a9a806a97ff13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Mon, 18 Dec 2023 12:07:45 +0100 Subject: [PATCH 1/6] JS: Require curly braces in switch cases (#1268) --- node/.eslintrc.js | 8 ++++ node/src/Channel.ts | 22 +++++++++- node/src/Consumer.ts | 34 +++++++++++++++ node/src/DataConsumer.ts | 13 ++++++ node/src/DataProducer.ts | 13 ++++++ node/src/Producer.ts | 48 +++++++++++++++++++++ node/src/RtpParameters.ts | 67 +++++++++++++++++++++++++++++ node/src/SrtpParameters.ts | 18 ++++++++ node/src/Transport.ts | 39 +++++++++++++++++ node/src/WebRtcTransport.ts | 84 +++++++++++++++++++++++++++++++++++++ node/src/utils.ts | 6 +++ 11 files changed, 351 insertions(+), 1 deletion(-) diff --git a/node/.eslintrc.js b/node/.eslintrc.js index e541c5acd6..1d0f1e8728 100644 --- a/node/.eslintrc.js +++ b/node/.eslintrc.js @@ -45,6 +45,14 @@ const eslintConfig = 'computed-property-spacing' : 2, 'constructor-super' : 2, 'curly' : [ 2, 'all' ], + // Unfortunatelly `curly` does not apply to blocks in `switch` cases so + // this is needed. + 'no-restricted-syntax' : [ 2, + { + 'selector' : 'SwitchCase > *.consequent[type!="BlockStatement"]', + 'message' : 'Switch cases without blocks are disallowed' + } + ], 'func-call-spacing' : 2, 'generator-star-spacing' : 2, 'guard-for-in' : 2, diff --git a/node/src/Channel.ts b/node/src/Channel.ts index 654c588b32..7f41ca9f2f 100644 --- a/node/src/Channel.ts +++ b/node/src/Channel.ts @@ -164,10 +164,13 @@ export class Channel extends EnhancedEventEmitter } default: + { // eslint-disable-next-line no-console console.warn( `worker[pid:${pid}] unexpected data: %s`, - payload.toString('utf8', 1)); + payload.toString('utf8', 1) + ); + } } } catch (error) @@ -432,11 +435,16 @@ export class Channel extends EnhancedEventEmitter switch (response.error()!) { case 'TypeError': + { sent.reject(new TypeError(response.reason()!)); + break; + } default: + { sent.reject(new Error(response.reason()!)); + } } } else @@ -470,24 +478,36 @@ export class Channel extends EnhancedEventEmitter { // 'D' (a debug log). case 'D': + { logger.debug(`[pid:${pid}] ${logData.slice(1)}`); + break; + } // 'W' (a warn log). case 'W': + { logger.warn(`[pid:${pid}] ${logData.slice(1)}`); + break; + } // 'E' (a error log). case 'E': + { logger.error(`[pid:${pid}] ${logData.slice(1)}`); + break; + } // 'X' (a dump log). case 'X': + { // eslint-disable-next-line no-console console.log(logData.slice(1)); + break; + } } } } diff --git a/node/src/Consumer.ts b/node/src/Consumer.ts index e8d9a5981d..e2ab1167e7 100644 --- a/node/src/Consumer.ts +++ b/node/src/Consumer.ts @@ -999,17 +999,34 @@ function consumerTraceEventTypeToFbs(eventType: ConsumerTraceEventType) switch (eventType) { case 'keyframe': + { return FbsConsumer.TraceEventType.KEYFRAME; + } + case 'fir': + { return FbsConsumer.TraceEventType.FIR; + } + case 'nack': + { return FbsConsumer.TraceEventType.NACK; + } + case 'pli': + { return FbsConsumer.TraceEventType.PLI; + } + case 'rtp': + { return FbsConsumer.TraceEventType.RTP; + } + default: + { throw new TypeError(`invalid ConsumerTraceEventType: ${eventType}`); + } } } @@ -1019,17 +1036,34 @@ function consumerTraceEventTypeFromFbs(traceType: FbsConsumer.TraceEventType) switch (traceType) { case FbsConsumer.TraceEventType.KEYFRAME: + { return 'keyframe'; + } + case FbsConsumer.TraceEventType.FIR: + { return 'fir'; + } + case FbsConsumer.TraceEventType.NACK: + { return 'nack'; + } + case FbsConsumer.TraceEventType.PLI: + { return 'pli'; + } + case FbsConsumer.TraceEventType.RTP: + { return 'rtp'; + } + default: + { throw new TypeError(`invalid FbsConsumer.TraceEventType: ${traceType}`); + } } } diff --git a/node/src/DataConsumer.ts b/node/src/DataConsumer.ts index 52ccd0284b..799001cef0 100644 --- a/node/src/DataConsumer.ts +++ b/node/src/DataConsumer.ts @@ -762,11 +762,19 @@ export function dataConsumerTypeToFbs(type: DataConsumerType): FbsDataProducer.T switch (type) { case 'sctp': + { return FbsDataProducer.Type.SCTP; + } + case 'direct': + { return FbsDataProducer.Type.DIRECT; + } + default: + { throw new TypeError('invalid DataConsumerType: ${type}'); + } } } @@ -775,9 +783,14 @@ export function dataConsumerTypeFromFbs(type: FbsDataProducer.Type): DataConsume switch (type) { case FbsDataProducer.Type.SCTP: + { return 'sctp'; + } + case FbsDataProducer.Type.DIRECT: + { return 'direct'; + } } } diff --git a/node/src/DataProducer.ts b/node/src/DataProducer.ts index 94ffccf5cf..ee3cf29ef8 100644 --- a/node/src/DataProducer.ts +++ b/node/src/DataProducer.ts @@ -475,11 +475,19 @@ export function dataProducerTypeToFbs(type: DataProducerType): FbsDataProducer.T switch (type) { case 'sctp': + { return FbsDataProducer.Type.SCTP; + } + case 'direct': + { return FbsDataProducer.Type.DIRECT; + } + default: + { throw new TypeError('invalid DataConsumerType: ${type}'); + } } } @@ -488,9 +496,14 @@ export function dataProducerTypeFromFbs(type: FbsDataProducer.Type): DataProduce switch (type) { case FbsDataProducer.Type.SCTP: + { return 'sctp'; + } + case FbsDataProducer.Type.DIRECT: + { return 'direct'; + } } } diff --git a/node/src/Producer.ts b/node/src/Producer.ts index d45c1d1be7..dcae6545ea 100644 --- a/node/src/Producer.ts +++ b/node/src/Producer.ts @@ -630,13 +630,24 @@ export function producerTypeFromFbs(type: FbsRtpParameters.Type): ProducerType switch (type) { case FbsRtpParameters.Type.SIMPLE: + { return 'simple'; + } + case FbsRtpParameters.Type.SIMULCAST: + { return 'simulcast'; + } + case FbsRtpParameters.Type.SVC: + { return 'svc'; + } + default: + { throw new TypeError(`invalid FbsRtpParameters.Type: ${type}`); + } } } @@ -645,13 +656,19 @@ export function producerTypeToFbs(type: ProducerType): FbsRtpParameters.Type switch (type) { case 'simple': + { return FbsRtpParameters.Type.SIMPLE; + } case 'simulcast': + { return FbsRtpParameters.Type.SIMULCAST; + } case 'svc': + { return FbsRtpParameters.Type.SVC; + } } } @@ -661,17 +678,34 @@ function producerTraceEventTypeToFbs(eventType: ProducerTraceEventType) switch (eventType) { case 'keyframe': + { return FbsProducer.TraceEventType.KEYFRAME; + } + case 'fir': + { return FbsProducer.TraceEventType.FIR; + } + case 'nack': + { return FbsProducer.TraceEventType.NACK; + } + case 'pli': + { return FbsProducer.TraceEventType.PLI; + } + case 'rtp': + { return FbsProducer.TraceEventType.RTP; + } + default: + { throw new TypeError(`invalid ProducerTraceEventType: ${eventType}`); + } } } @@ -681,15 +715,29 @@ function producerTraceEventTypeFromFbs(eventType: FbsProducer.TraceEventType) switch (eventType) { case FbsProducer.TraceEventType.KEYFRAME: + { return 'keyframe'; + } + case FbsProducer.TraceEventType.FIR: + { return 'fir'; + } + case FbsProducer.TraceEventType.NACK: + { return 'nack'; + } + case FbsProducer.TraceEventType.PLI: + { return 'pli'; + } + case FbsProducer.TraceEventType.RTP: + { return 'rtp'; + } } } diff --git a/node/src/RtpParameters.ts b/node/src/RtpParameters.ts index 95308b7a29..99e9f528ed 100644 --- a/node/src/RtpParameters.ts +++ b/node/src/RtpParameters.ts @@ -709,27 +709,59 @@ export function rtpHeaderExtensionUriFromFbs(uri: FbsRtpHeaderExtensionUri): Rtp switch (uri) { case FbsRtpHeaderExtensionUri.Mid: + { return 'urn:ietf:params:rtp-hdrext:sdes:mid'; + } + case FbsRtpHeaderExtensionUri.RtpStreamId: + { return 'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id'; + } + case FbsRtpHeaderExtensionUri.RepairRtpStreamId: + { return 'urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id'; + } + case FbsRtpHeaderExtensionUri.FrameMarkingDraft07: + { return 'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07'; + } + case FbsRtpHeaderExtensionUri.FrameMarking: + { return 'urn:ietf:params:rtp-hdrext:framemarking'; + } + case FbsRtpHeaderExtensionUri.AudioLevel: + { return 'urn:ietf:params:rtp-hdrext:ssrc-audio-level'; + } + case FbsRtpHeaderExtensionUri.VideoOrientation: + { return 'urn:3gpp:video-orientation'; + } + case FbsRtpHeaderExtensionUri.TimeOffset: + { return 'urn:ietf:params:rtp-hdrext:toffset'; + } + case FbsRtpHeaderExtensionUri.TransportWideCcDraft01: + { return 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01'; + } + case FbsRtpHeaderExtensionUri.AbsSendTime: + { return 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time'; + } + case FbsRtpHeaderExtensionUri.AbsCaptureTime: + { return 'http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time'; + } } } @@ -738,29 +770,64 @@ export function rtpHeaderExtensionUriToFbs(uri: RtpHeaderExtensionUri): FbsRtpHe switch (uri) { case 'urn:ietf:params:rtp-hdrext:sdes:mid': + { return FbsRtpHeaderExtensionUri.Mid; + } + case 'urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id': + { return FbsRtpHeaderExtensionUri.RtpStreamId; + } + case 'urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id': + { return FbsRtpHeaderExtensionUri.RepairRtpStreamId; + } + case 'http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07': + { return FbsRtpHeaderExtensionUri.FrameMarkingDraft07; + } + case 'urn:ietf:params:rtp-hdrext:framemarking': + { return FbsRtpHeaderExtensionUri.FrameMarking; + } + case 'urn:ietf:params:rtp-hdrext:ssrc-audio-level': + { return FbsRtpHeaderExtensionUri.AudioLevel; + } + case 'urn:3gpp:video-orientation': + { return FbsRtpHeaderExtensionUri.VideoOrientation; + } + case 'urn:ietf:params:rtp-hdrext:toffset': + { return FbsRtpHeaderExtensionUri.TimeOffset; + } + case 'http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01': + { return FbsRtpHeaderExtensionUri.TransportWideCcDraft01; + } + case 'http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time': + { return FbsRtpHeaderExtensionUri.AbsSendTime; + } + case 'http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time': + { return FbsRtpHeaderExtensionUri.AbsCaptureTime; + } + default: + { throw new TypeError(`invalid RtpHeaderExtensionUri: ${uri}`); + } } } diff --git a/node/src/SrtpParameters.ts b/node/src/SrtpParameters.ts index 7c5937c05e..87470bb5a4 100644 --- a/node/src/SrtpParameters.ts +++ b/node/src/SrtpParameters.ts @@ -31,16 +31,24 @@ export function cryptoSuiteFromFbs(binary: FbsSrtpParameters.SrtpCryptoSuite): S switch (binary) { case FbsSrtpParameters.SrtpCryptoSuite.AEAD_AES_256_GCM: + { return 'AEAD_AES_256_GCM'; + } case FbsSrtpParameters.SrtpCryptoSuite.AEAD_AES_128_GCM: + { return 'AEAD_AES_128_GCM'; + } case FbsSrtpParameters.SrtpCryptoSuite.AES_CM_128_HMAC_SHA1_80: + { return 'AES_CM_128_HMAC_SHA1_80'; + } case FbsSrtpParameters.SrtpCryptoSuite.AES_CM_128_HMAC_SHA1_32: + { return 'AES_CM_128_HMAC_SHA1_32'; + } } } @@ -50,19 +58,29 @@ export function cryptoSuiteToFbs(cryptoSuite: SrtpCryptoSuite) switch (cryptoSuite) { case 'AEAD_AES_256_GCM': + { return FbsSrtpParameters.SrtpCryptoSuite.AEAD_AES_256_GCM; + } case 'AEAD_AES_128_GCM': + { return FbsSrtpParameters.SrtpCryptoSuite.AEAD_AES_128_GCM; + } case 'AES_CM_128_HMAC_SHA1_80': + { return FbsSrtpParameters.SrtpCryptoSuite.AES_CM_128_HMAC_SHA1_80; + } case 'AES_CM_128_HMAC_SHA1_32': + { return FbsSrtpParameters.SrtpCryptoSuite.AES_CM_128_HMAC_SHA1_32; + } default: + { throw new TypeError(`invalid SrtpCryptoSuite: ${cryptoSuite}`); + } } } diff --git a/node/src/Transport.ts b/node/src/Transport.ts index a0e3449a62..7c68ad0143 100644 --- a/node/src/Transport.ts +++ b/node/src/Transport.ts @@ -1321,11 +1321,19 @@ function transportTraceEventTypeToFbs(eventType: TransportTraceEventType) switch (eventType) { case 'probation': + { return FbsTransport.TraceEventType.PROBATION; + } + case 'bwe': + { return FbsTransport.TraceEventType.BWE; + } + default: + { throw new TypeError(`invalid TransportTraceEventType: ${eventType}`); + } } } @@ -1335,9 +1343,15 @@ function transportTraceEventTypeFromFbs(eventType: FbsTransport.TraceEventType) switch (eventType) { case FbsTransport.TraceEventType.PROBATION: + { return 'probation'; + } + case FbsTransport.TraceEventType.BWE: + { return 'bwe'; + } + } } @@ -1346,17 +1360,34 @@ export function parseSctpState(fbsSctpState: FbsSctpState): SctpState switch (fbsSctpState) { case FbsSctpState.NEW: + { return 'new'; + } + case FbsSctpState.CONNECTING: + { return 'connecting'; + } + case FbsSctpState.CONNECTED: + { return 'connected'; + } + case FbsSctpState.FAILED: + { return 'failed'; + } + case FbsSctpState.CLOSED: + { return 'closed'; + } + default: + { throw new TypeError(`invalid SctpState: ${fbsSctpState}`); + } } } @@ -1365,10 +1396,14 @@ export function parseProtocol(protocol: FbsTransport.Protocol): TransportProtoco switch (protocol) { case FbsTransport.Protocol.UDP: + { return 'udp'; + } case FbsTransport.Protocol.TCP: + { return 'tcp'; + } } } @@ -1377,10 +1412,14 @@ export function serializeProtocol(protocol: TransportProtocol): FbsTransport.Pro switch (protocol) { case 'udp': + { return FbsTransport.Protocol.UDP; + } case 'tcp': + { return FbsTransport.Protocol.TCP; + } } } diff --git a/node/src/WebRtcTransport.ts b/node/src/WebRtcTransport.ts index 96b5165035..64fec095e0 100644 --- a/node/src/WebRtcTransport.ts +++ b/node/src/WebRtcTransport.ts @@ -650,13 +650,24 @@ function iceStateFromFbs(fbsIceState: FbsIceState): IceState switch (fbsIceState) { case FbsIceState.NEW: + { return 'new'; + } + case FbsIceState.CONNECTED: + { return 'connected'; + } + case FbsIceState.COMPLETED: + { return 'completed'; + } + case FbsIceState.DISCONNECTED: + { return 'disconnected'; + } } } @@ -665,9 +676,14 @@ function iceRoleFromFbs(role: FbsIceRole): IceRole switch (role) { case FbsIceRole.CONTROLLED: + { return 'controlled'; + } + case FbsIceRole.CONTROLLING: + { return 'controlling'; + } } } @@ -676,7 +692,9 @@ function iceCandidateTypeFromFbs(type: FbsIceCandidateType): IceCandidateType switch (type) { case FbsIceCandidateType.HOST: + { return 'host'; + } } } @@ -685,7 +703,9 @@ function iceCandidateTcpTypeFromFbs(type: FbsIceCandidateTcpType): IceCandidateT switch (type) { case FbsIceCandidateTcpType.PASSIVE: + { return 'passive'; + } } } @@ -694,15 +714,29 @@ function dtlsStateFromFbs(fbsDtlsState: FbsDtlsState): DtlsState switch (fbsDtlsState) { case FbsDtlsState.NEW: + { return 'new'; + } + case FbsDtlsState.CONNECTING: + { return 'connecting'; + } + case FbsDtlsState.CONNECTED: + { return 'connected'; + } + case FbsDtlsState.FAILED: + { return 'failed'; + } + case FbsDtlsState.CLOSED: + { return 'closed'; + } } } @@ -711,11 +745,19 @@ function dtlsRoleFromFbs(role: FbsDtlsRole): DtlsRole switch (role) { case FbsDtlsRole.AUTO: + { return 'auto'; + } + case FbsDtlsRole.CLIENT: + { return 'client'; + } + case FbsDtlsRole.SERVER: + { return 'server'; + } } } @@ -725,15 +767,29 @@ function fingerprintAlgorithmsFromFbs(algorithm: FbsFingerprintAlgorithm) switch (algorithm) { case FbsFingerprintAlgorithm.SHA1: + { return 'sha-1'; + } + case FbsFingerprintAlgorithm.SHA224: + { return 'sha-224'; + } + case FbsFingerprintAlgorithm.SHA256: + { return 'sha-256'; + } + case FbsFingerprintAlgorithm.SHA384: + { return 'sha-384'; + } + case FbsFingerprintAlgorithm.SHA512: + { return 'sha-512'; + } } } @@ -743,17 +799,34 @@ function fingerprintAlgorithmToFbs(algorithm: FingerprintAlgorithm) switch (algorithm) { case 'sha-1': + { return FbsFingerprintAlgorithm.SHA1; + } + case 'sha-224': + { return FbsFingerprintAlgorithm.SHA224; + } + case 'sha-256': + { return FbsFingerprintAlgorithm.SHA256; + } + case 'sha-384': + { return FbsFingerprintAlgorithm.SHA384; + } + case 'sha-512': + { return FbsFingerprintAlgorithm.SHA512; + } + default: + { throw new TypeError(`invalid FingerprintAlgorithm: ${algorithm}`); + } } } @@ -762,13 +835,24 @@ function dtlsRoleToFbs(role: DtlsRole): FbsDtlsRole switch (role) { case 'auto': + { return FbsDtlsRole.AUTO; + } + case 'client': + { return FbsDtlsRole.CLIENT; + } + case 'server': + { return FbsDtlsRole.SERVER; + } + default: + { throw new TypeError(`invalid DtlsRole: ${role}`); + } } } diff --git a/node/src/utils.ts b/node/src/utils.ts index 6f9ad900d2..439f1fcaaf 100644 --- a/node/src/utils.ts +++ b/node/src/utils.ts @@ -57,13 +57,19 @@ export function getRtpParametersType( switch (producerType) { case 'simple': + { return FbsRtpParametersType.SIMPLE; + } case 'simulcast': + { return FbsRtpParametersType.SIMULCAST; + } case 'svc': + { return FbsRtpParametersType.SVC; + } } } From d7bee8a34cf0880de6508fc57be1c049375e88fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Mon, 18 Dec 2023 16:56:33 +0100 Subject: [PATCH 2/6] 3.13.12 --- CHANGELOG.md | 3 ++- package-lock.json | 64 +++++++++++++++++++++++------------------------ package.json | 8 +++--- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4690870b50..370e19885b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,11 @@ # Changelog -### NEXT +### 3.13.12 * worker: Disable `RtcLogger` usage if not enabled ([PR #1264](https://github.com/versatica/mediasoup/pull/1264)). * npm installation: Don't require Python if valid worker prebuilt binary is fetched ([PR #1265](https://github.com/versatica/mediasoup/pull/1265)). +* Update h264-profile-level-id NPM dependency to 1.1.0. ### 3.13.11 diff --git a/package-lock.json b/package-lock.json index e2b9f758c5..0bc80cc4df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,18 @@ { "name": "mediasoup", - "version": "3.13.11", + "version": "3.13.12", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mediasoup", - "version": "3.13.11", + "version": "3.13.12", "hasInstallScript": true, "license": "ISC", "dependencies": { "debug": "^4.3.4", "flatbuffers": "^23.5.26", - "h264-profile-level-id": "^1.0.2", + "h264-profile-level-id": "^1.1.0", "node-fetch": "^3.3.2", "supports-color": "^9.4.0", "tar": "^6.2.0" @@ -21,10 +21,10 @@ "@octokit/rest": "^20.0.2", "@types/debug": "^4.1.12", "@types/jest": "^29.5.11", - "@types/node": "^20.10.4", + "@types/node": "^20.10.5", "@typescript-eslint/eslint-plugin": "^6.14.0", "@typescript-eslint/parser": "^6.14.0", - "eslint": "^8.55.0", + "eslint": "^8.56.0", "eslint-plugin-jest": "^27.6.0", "jest": "^29.7.0", "marked": "^11.1.0", @@ -765,9 +765,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.55.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz", - "integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", + "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1619,9 +1619,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.10.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.4.tgz", - "integrity": "sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==", + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -3023,15 +3023,15 @@ } }, "node_modules/eslint": { - "version": "8.55.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz", - "integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", + "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.55.0", + "@eslint/js": "8.56.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -3647,14 +3647,14 @@ "dev": true }, "node_modules/h264-profile-level-id": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/h264-profile-level-id/-/h264-profile-level-id-1.0.2.tgz", - "integrity": "sha512-bsSv/bHq4eIUt4iMycA9rn1C28gtXwrKLAkbpzuZmkQp4u3M6QlF5y6DlTMy5fGDkVGbMLxFGeL7Ra8JKMm4Dg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/h264-profile-level-id/-/h264-profile-level-id-1.1.0.tgz", + "integrity": "sha512-kASSjiJii6zPurTkCyaxxw3IaI1ahnylJNpdcxRhpUebHy/jpyjgIZ+8YcqjYaX+HtAPlpw9rKbvWBLc4jRjPw==", "dependencies": { "debug": "^4.3.4" }, "engines": { - "node": ">=8.0.0" + "node": ">=10.0.0" } }, "node_modules/hard-rejection": { @@ -7301,9 +7301,9 @@ } }, "@eslint/js": { - "version": "8.55.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz", - "integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", + "integrity": "sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==", "dev": true }, "@humanwhocodes/config-array": { @@ -8006,9 +8006,9 @@ "dev": true }, "@types/node": { - "version": "20.10.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.4.tgz", - "integrity": "sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==", + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", "dev": true, "requires": { "undici-types": "~5.26.4" @@ -8949,15 +8949,15 @@ "dev": true }, "eslint": { - "version": "8.55.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz", - "integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==", + "version": "8.56.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz", + "integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==", "dev": true, "requires": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.55.0", + "@eslint/js": "8.56.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -9399,9 +9399,9 @@ "dev": true }, "h264-profile-level-id": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/h264-profile-level-id/-/h264-profile-level-id-1.0.2.tgz", - "integrity": "sha512-bsSv/bHq4eIUt4iMycA9rn1C28gtXwrKLAkbpzuZmkQp4u3M6QlF5y6DlTMy5fGDkVGbMLxFGeL7Ra8JKMm4Dg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/h264-profile-level-id/-/h264-profile-level-id-1.1.0.tgz", + "integrity": "sha512-kASSjiJii6zPurTkCyaxxw3IaI1ahnylJNpdcxRhpUebHy/jpyjgIZ+8YcqjYaX+HtAPlpw9rKbvWBLc4jRjPw==", "requires": { "debug": "^4.3.4" } diff --git a/package.json b/package.json index dcfbfe77ea..31b18d59e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mediasoup", - "version": "3.13.11", + "version": "3.13.12", "description": "Cutting Edge WebRTC Video Conferencing", "contributors": [ "IƱaki Baz Castillo (https://inakibaz.me)", @@ -99,7 +99,7 @@ "dependencies": { "debug": "^4.3.4", "flatbuffers": "^23.5.26", - "h264-profile-level-id": "^1.0.2", + "h264-profile-level-id": "^1.1.0", "node-fetch": "^3.3.2", "supports-color": "^9.4.0", "tar": "^6.2.0" @@ -108,10 +108,10 @@ "@octokit/rest": "^20.0.2", "@types/debug": "^4.1.12", "@types/jest": "^29.5.11", - "@types/node": "^20.10.4", + "@types/node": "^20.10.5", "@typescript-eslint/eslint-plugin": "^6.14.0", "@typescript-eslint/parser": "^6.14.0", - "eslint": "^8.55.0", + "eslint": "^8.56.0", "eslint-plugin-jest": "^27.6.0", "jest": "^29.7.0", "marked": "^11.1.0", From f9c081c41e90a84d837d2a26b700d1fee84430c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Mon, 18 Dec 2023 19:21:58 +0100 Subject: [PATCH 3/6] Rust: Update h264-profile-level-id dependency to 0.2.0 --- rust/CHANGELOG.md | 4 ++++ rust/Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rust/CHANGELOG.md b/rust/CHANGELOG.md index 4697ba666e..c00c8ae3d8 100644 --- a/rust/CHANGELOG.md +++ b/rust/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +# NEXT + +* Update h264-profile-level-id dependency to 0.2.0. + # 0.13.0 * Updates from mediasoup TypeScript `3.13.0..=3.13.7`. diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 4c35295b11..3ccbd1e8c1 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -30,7 +30,7 @@ atomic-take = "1.0.0" event-listener-primitives = "2.0.1" fastrand = "1.8.0" futures-lite = "1.12.0" -h264-profile-level-id = "0.1.1" +h264-profile-level-id = "0.2.0" hash_hasher = "2.0.3" log = "0.4.17" nohash-hasher = "0.2.0" From c5eb1b40534b5fa2ce991f17df2a5947378004bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Mon, 18 Dec 2023 23:01:34 +0100 Subject: [PATCH 4/6] Fix Rust docs build (#1271) --- .github/workflows/mediasoup-rust.yaml | 7 +++++++ Cargo.lock | 5 ++--- rust/CHANGELOG.md | 2 ++ rust/src/data_structures.rs | 2 +- rust/src/router/data_consumer.rs | 5 ++++- worker/build.rs | 10 +++++----- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/mediasoup-rust.yaml b/.github/workflows/mediasoup-rust.yaml index 0778129e84..f89b64b9ab 100644 --- a/.github/workflows/mediasoup-rust.yaml +++ b/.github/workflows/mediasoup-rust.yaml @@ -46,3 +46,10 @@ jobs: - name: cargo test run: cargo test --verbose + + - name: cargo doc + run: cargo doc --locked --all --no-deps --lib + env: + DOCS_RS: '1' + RUSTDOCFLAGS: '-D rustdoc::broken-intra-doc-links -D rustdoc::private_intra_doc_links' + diff --git a/Cargo.lock b/Cargo.lock index 25f9f06ee3..7a0eadf2d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1028,13 +1028,12 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "h264-profile-level-id" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12ebc03fc4f14b7ddc94da90cfb28ba3edee2d926798a9eef89f8a27bbdbca5" +checksum = "45d0dbf6a9847b64c9b06938660891f983434dcc009b5ae6a58f5e34af74a649" dependencies = [ "bitpattern", "log", - "once_cell", "thiserror", ] diff --git a/rust/CHANGELOG.md b/rust/CHANGELOG.md index c00c8ae3d8..dad75c4f0f 100644 --- a/rust/CHANGELOG.md +++ b/rust/CHANGELOG.md @@ -3,6 +3,8 @@ # NEXT * Update h264-profile-level-id dependency to 0.2.0. +* Fix docs build (PR #1271). +* Rename `data_consumer::on_producer_resume` to `data_consumer::on_data_producer_resume` (PR #1271). # 0.13.0 diff --git a/rust/src/data_structures.rs b/rust/src/data_structures.rs index d1940de235..a5c2cc1856 100644 --- a/rust/src/data_structures.rs +++ b/rust/src/data_structures.rs @@ -45,7 +45,7 @@ impl AppData { } } -/// Listening protocol, IP and port for [`WebRtcServer`] to listen on. +/// Listening protocol, IP and port for [`WebRtcServer`](crate::webrtc_server::WebRtcServer) to listen on. /// /// # Notes on usage /// If you use "0.0.0.0" or "::" as ip value, then you need to also provide `announced_ip`. diff --git a/rust/src/router/data_consumer.rs b/rust/src/router/data_consumer.rs index 88ca1a5742..bafaffd240 100644 --- a/rust/src/router/data_consumer.rs +++ b/rust/src/router/data_consumer.rs @@ -903,7 +903,10 @@ impl DataConsumer { } /// Callback is called when the associated data producer is resumed. - pub fn on_producer_resume(&self, callback: F) -> HandlerId { + pub fn on_data_producer_resume( + &self, + callback: F, + ) -> HandlerId { self.inner() .handlers .data_producer_resume diff --git a/worker/build.rs b/worker/build.rs index 5139edef80..920d185d7b 100644 --- a/worker/build.rs +++ b/worker/build.rs @@ -2,11 +2,6 @@ use std::process::Command; use std::{env, fs}; fn main() { - if env::var("DOCS_RS").is_ok() { - // Skip everything when building docs on docs.rs - return; - } - // On Windows Rust always links against release version of MSVC runtime, thus requires // Release build here let build_type = if cfg!(all(debug_assertions, not(windows))) { @@ -45,6 +40,11 @@ fn main() { ) .expect("Failed to write generated Rust flatbuffers into fbs.rs"); + if env::var("DOCS_RS").is_ok() { + // Skip everything when building docs on docs.rs + return; + } + // Force forward slashes on Windows too so that is plays well with our tasks.py let mediasoup_out_dir = format!("{}/out", out_dir.replace('\\', "/")); From c2c4323da4a90817d2e1ee14ff45b2188d67f2b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Mon, 18 Dec 2023 23:21:25 +0100 Subject: [PATCH 5/6] Update Rust versions (#1272) --- Cargo.lock | 4 ++-- rust/CHANGELOG.md | 3 ++- rust/Cargo.toml | 4 ++-- worker/Cargo.toml | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a0eadf2d9..aa5dfcfb45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1354,7 +1354,7 @@ checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" [[package]] name = "mediasoup" -version = "0.13.0" +version = "0.14.0" dependencies = [ "actix", "actix-web", @@ -1391,7 +1391,7 @@ dependencies = [ [[package]] name = "mediasoup-sys" -version = "0.7.0" +version = "0.7.1" dependencies = [ "planus", "planus-codegen", diff --git a/rust/CHANGELOG.md b/rust/CHANGELOG.md index dad75c4f0f..c6148b0170 100644 --- a/rust/CHANGELOG.md +++ b/rust/CHANGELOG.md @@ -1,7 +1,8 @@ # Changelog -# NEXT +# 0.14.0 +* Updates from mediasoup TypeScript `3.13.8..=3.13.12`. * Update h264-profile-level-id dependency to 0.2.0. * Fix docs build (PR #1271). * Rename `data_consumer::on_producer_resume` to `data_consumer::on_data_producer_resume` (PR #1271). diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 3ccbd1e8c1..66ed81c861 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mediasoup" -version = "0.13.0" +version = "0.14.0" description = "Cutting Edge WebRTC Video Conferencing in Rust" categories = ["api-bindings", "multimedia", "network-programming"] authors = ["Nazar Mokrynskyi "] @@ -46,7 +46,7 @@ version = "0.8.1" [dependencies.mediasoup-sys] path = "../worker" -version = "0.7.0" +version = "0.7.1" [dependencies.parking_lot] version = "0.12.1" diff --git a/worker/Cargo.toml b/worker/Cargo.toml index edf5687367..c3911071e9 100644 --- a/worker/Cargo.toml +++ b/worker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mediasoup-sys" -version = "0.7.0" +version = "0.7.1" description = "FFI bindings to C++ libmediasoup-worker" authors = ["Nazar Mokrynskyi "] edition = "2021" From 8365c62fde60337d8bffd56ee414ef2eab45b676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Wed, 20 Dec 2023 20:15:52 +0100 Subject: [PATCH 6/6] worker: Do not use references for async callbacks (#1274) * worker: Do not use references for async callbacks If the callback is not executed in the same uv_loop iteration, the access to such values upon executing the callback is undefined. * Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ worker/include/RTC/SenderBandwidthEstimator.hpp | 2 +- .../include/RTC/TransportCongestionControlClient.hpp | 2 +- worker/src/RTC/SenderBandwidthEstimator.cpp | 2 +- worker/src/RTC/Transport.cpp | 12 ++++++------ worker/src/RTC/TransportCongestionControlClient.cpp | 3 ++- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 370e19885b..24a5e5405b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog +### NEXT + +* worker: Do not use references for async callbacks ([PR #1274](https://github.com/versatica/mediasoup/pull/1274)). + + ### 3.13.12 * worker: Disable `RtcLogger` usage if not enabled ([PR #1264](https://github.com/versatica/mediasoup/pull/1264)). diff --git a/worker/include/RTC/SenderBandwidthEstimator.hpp b/worker/include/RTC/SenderBandwidthEstimator.hpp index b25f5df385..208b188f93 100644 --- a/worker/include/RTC/SenderBandwidthEstimator.hpp +++ b/worker/include/RTC/SenderBandwidthEstimator.hpp @@ -89,7 +89,7 @@ namespace RTC public: void TransportConnected(); void TransportDisconnected(); - void RtpPacketSent(SentInfo& sentInfo); + void RtpPacketSent(const SentInfo& sentInfo); void ReceiveRtcpTransportFeedback(const RTC::RTCP::FeedbackRtpTransportPacket* feedback); void EstimateAvailableBitrate(CummulativeResult& cummulativeResult); void UpdateRtt(float rtt); diff --git a/worker/include/RTC/TransportCongestionControlClient.hpp b/worker/include/RTC/TransportCongestionControlClient.hpp index 1c2fb61f6c..4bd3796284 100644 --- a/worker/include/RTC/TransportCongestionControlClient.hpp +++ b/worker/include/RTC/TransportCongestionControlClient.hpp @@ -69,7 +69,7 @@ namespace RTC void TransportDisconnected(); void InsertPacket(webrtc::RtpPacketSendInfo& packetInfo); webrtc::PacedPacketInfo GetPacingInfo(); - void PacketSent(webrtc::RtpPacketSendInfo& packetInfo, int64_t nowMs); + void PacketSent(const webrtc::RtpPacketSendInfo& packetInfo, int64_t nowMs); void ReceiveEstimatedBitrate(uint32_t bitrate); void ReceiveRtcpReceiverReport(RTC::RTCP::ReceiverReportPacket* packet, float rtt, int64_t nowMs); void ReceiveRtcpTransportFeedback(const RTC::RTCP::FeedbackRtpTransportPacket* feedback); diff --git a/worker/src/RTC/SenderBandwidthEstimator.cpp b/worker/src/RTC/SenderBandwidthEstimator.cpp index 6cc7476a72..834c21ea35 100644 --- a/worker/src/RTC/SenderBandwidthEstimator.cpp +++ b/worker/src/RTC/SenderBandwidthEstimator.cpp @@ -47,7 +47,7 @@ namespace RTC this->cummulativeResult.Reset(); } - void SenderBandwidthEstimator::RtpPacketSent(SentInfo& sentInfo) + void SenderBandwidthEstimator::RtpPacketSent(const SentInfo& sentInfo) { MS_TRACE(); diff --git a/worker/src/RTC/Transport.cpp b/worker/src/RTC/Transport.cpp index e76d9adad0..2d1da9e623 100644 --- a/worker/src/RTC/Transport.cpp +++ b/worker/src/RTC/Transport.cpp @@ -2493,7 +2493,7 @@ namespace RTC sentInfo.sendingAtMs = DepLibUV::GetTimeMs(); auto* cb = new onSendCallback( - [tccClientWeakPtr, &packetInfo, senderBweWeakPtr, &sentInfo](bool sent) + [tccClientWeakPtr, packetInfo, senderBweWeakPtr, sentInfo](bool sent) { if (sent) { @@ -2517,7 +2517,7 @@ namespace RTC SendRtpPacket(consumer, packet, cb); #else const auto* cb = new onSendCallback( - [tccClientWeakPtr, &packetInfo](bool sent) + [tccClientWeakPtr, packetInfo](bool sent) { if (sent) { @@ -2582,7 +2582,7 @@ namespace RTC sentInfo.sendingAtMs = DepLibUV::GetTimeMs(); auto* cb = new onSendCallback( - [tccClientWeakPtr, &packetInfo, senderBweWeakPtr, &sentInfo](bool sent) + [tccClientWeakPtr, packetInfo, senderBweWeakPtr, sentInfo](bool sent) { if (sent) { @@ -2606,7 +2606,7 @@ namespace RTC SendRtpPacket(consumer, packet, cb); #else const auto* cb = new onSendCallback( - [tccClientWeakPtr, &packetInfo](bool sent) + [tccClientWeakPtr, packetInfo](bool sent) { if (sent) { @@ -2982,7 +2982,7 @@ namespace RTC sentInfo.sendingAtMs = DepLibUV::GetTimeMs(); auto* cb = new onSendCallback( - [tccClientWeakPtr, &packetInfo, senderBweWeakPtr, &sentInfo](bool sent) + [tccClientWeakPtr, packetInfo, senderBweWeakPtr, sentInfo](bool sent) { if (sent) { @@ -3006,7 +3006,7 @@ namespace RTC SendRtpPacket(nullptr, packet, cb); #else const auto* cb = new onSendCallback( - [tccClientWeakPtr, &packetInfo](bool sent) + [tccClientWeakPtr, packetInfo](bool sent) { if (sent) { diff --git a/worker/src/RTC/TransportCongestionControlClient.cpp b/worker/src/RTC/TransportCongestionControlClient.cpp index 380fb34edb..98ddd17286 100644 --- a/worker/src/RTC/TransportCongestionControlClient.cpp +++ b/worker/src/RTC/TransportCongestionControlClient.cpp @@ -152,7 +152,8 @@ namespace RTC return this->rtpTransportControllerSend->packet_sender()->GetPacingInfo(); } - void TransportCongestionControlClient::PacketSent(webrtc::RtpPacketSendInfo& packetInfo, int64_t nowMs) + void TransportCongestionControlClient::PacketSent( + const webrtc::RtpPacketSendInfo& packetInfo, int64_t nowMs) { MS_TRACE();