livekit-client 1.11.2 → 1.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/livekit-client.esm.mjs +4100 -4010
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/room/PCTransport.d.ts +4 -3
- package/dist/src/room/PCTransport.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
- package/dist/src/room/track/options.d.ts +1 -1
- package/dist/src/room/track/utils.d.ts +39 -0
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/dist/ts4.2/src/room/PCTransport.d.ts +4 -3
- package/dist/ts4.2/src/room/track/options.d.ts +1 -1
- package/dist/ts4.2/src/room/track/utils.d.ts +39 -0
- package/package.json +1 -1
- package/src/room/PCTransport.ts +116 -48
- package/src/room/participant/LocalParticipant.ts +32 -8
- package/src/room/participant/publishUtils.ts +4 -2
- package/src/room/track/options.ts +1 -1
- package/src/room/track/utils.test.ts +30 -1
- package/src/room/track/utils.ts +102 -0
@@ -1,7 +1,8 @@
|
|
1
1
|
import EventEmitter from 'eventemitter3';
|
2
2
|
/** @internal */
|
3
3
|
interface TrackBitrateInfo {
|
4
|
-
|
4
|
+
cid?: string;
|
5
|
+
transceiver?: RTCRtpTransceiver;
|
5
6
|
codec: string;
|
6
7
|
maxbr: number;
|
7
8
|
}
|
@@ -29,9 +30,9 @@ export default class PCTransport extends EventEmitter {
|
|
29
30
|
};
|
30
31
|
createAndSendOffer(options?: RTCOfferOptions): Promise<void>;
|
31
32
|
createAndSetAnswer(): Promise<RTCSessionDescriptionInit>;
|
32
|
-
setTrackCodecBitrate(
|
33
|
+
setTrackCodecBitrate(info: TrackBitrateInfo): void;
|
33
34
|
close(): void;
|
34
|
-
private
|
35
|
+
private setMungedSDP;
|
35
36
|
}
|
36
37
|
export {};
|
37
38
|
//# sourceMappingURL=PCTransport.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PCTransport.d.ts","sourceRoot":"","sources":["../../../src/room/PCTransport.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AAQzC,gBAAgB;AAChB,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"PCTransport.d.ts","sourceRoot":"","sources":["../../../src/room/PCTransport.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AAQzC,gBAAgB;AAChB,UAAU,gBAAgB;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAUD,eAAO,MAAM,QAAQ;;;CAGX,CAAC;AAEX,gBAAgB;AAChB,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,YAAY;IACnD,EAAE,EAAE,iBAAiB,CAAC;IAEtB,iBAAiB,EAAE,mBAAmB,EAAE,CAAM;IAE9C,aAAa,EAAE,OAAO,CAAS;IAE/B,WAAW,EAAE,OAAO,CAAS;IAE7B,aAAa,EAAE,gBAAgB,EAAE,CAAM;IAEvC,gBAAgB,EAAE,MAAM,EAAE,CAAM;IAEhC,cAAc,EAAE,MAAM,EAAE,CAAM;IAE9B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAC;gBAEzC,MAAM,CAAC,EAAE,gBAAgB,EAAE,gBAAgB,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAQrF,IAAI,cAAc,IAAI,OAAO,CAE5B;IAEK,eAAe,CAAC,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9D,oBAAoB,CAAC,EAAE,EAAE,yBAAyB,GAAG,OAAO,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AE,OAAO,EAChB,OAAO,CAAC,EAAE,mBAAmB,EAC7B,cAAc,CAAC,EAAE,mBAAmB,GACnC,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IAI7C;;;OAGG;IACH,qBAAqB,CACnB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,yBAAyB,EACnC,cAAc,CAAC,EAAE,mBAAmB,GACnC,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IAI7C;;;;OAIG;YACW,eAAe;IA2F7B;;;OAGG;IACG,yBAAyB;IAwB/B;;;;OAIG;IACG,YAAY,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAqD7E;;;;OAIG;IACG,kBAAkB,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAsDzF;;;;OAIG;IACG,YAAY,CAChB,KAAK,EAAE,UAAU,GAAG,gBAAgB,EACpC,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;YAgFnB,OAAO;
|
1
|
+
{"version":3,"file":"LocalParticipant.d.ts","sourceRoot":"","sources":["../../../../src/room/participant/LocalParticipant.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAc,eAAe,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EAEL,eAAe,EAGf,sBAAsB,EAEvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAI1C,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,qBAAqB,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,yBAAyB,EACz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gBAAgB,IAAI,eAAe,EAAE;CAoBtC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"publishUtils.d.ts","sourceRoot":"","sources":["../../../../src/room/participant/publishUtils.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,MAAM,0BAA0B,CAAC;AACvD,OAAO,eAAe,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAsB,WAAW,EAAgC,MAAM,kBAAkB,CAAC;AACjG,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,aAAa,EACd,MAAM,kBAAkB,CAAC;AAG1B,gBAAgB;AAChB,wBAAgB,sBAAsB,CACpC,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,CAAC,EAAE,qBAAqB,GAClC,eAAe,GAAG,eAAe,CASnC;AAGD,eAAO,MAAM,UAAU,eAA8B,CAAC;AAGtD,eAAO,MAAM,SAAS,eAAgC,CAAC;AAGvD,eAAO,MAAM,kBAAkB,eAAoC,CAAC;AAGpE,eAAO,MAAM,0BAA0B,eAAyC,CAAC;AAGjF,eAAO,MAAM,yBAAyB,eAA6C,CAAC;AAGpF,eAAO,MAAM,yCAAyC,eAAgB,WAAW,kBAkBhF,CAAC;AAwBF,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,OAAO,EACtB,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,mBAAmB,GAC5B,wBAAwB,EAAE,
|
1
|
+
{"version":3,"file":"publishUtils.d.ts","sourceRoot":"","sources":["../../../../src/room/participant/publishUtils.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,MAAM,0BAA0B,CAAC;AACvD,OAAO,eAAe,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAsB,WAAW,EAAgC,MAAM,kBAAkB,CAAC;AACjG,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,aAAa,EACd,MAAM,kBAAkB,CAAC;A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AS,GAAG,GAAG,GAAG,MAAM,GAAG,YAAY,CAAC;gBAEpC,eAAe,EAAE,MAAM;IAkBnC,QAAQ,IAAI,MAAM;CAGnB"}
|
@@ -39,7 +39,7 @@ export interface TrackPublishDefaults {
|
|
39
39
|
*/
|
40
40
|
red?: boolean;
|
41
41
|
/**
|
42
|
-
* stereo
|
42
|
+
* publish track in stereo mode (or set to false to disable). defaults determined by capture channel count.
|
43
43
|
*/
|
44
44
|
forceStereo?: boolean;
|
45
45
|
/**
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import LocalTrack from './LocalTrack';
|
1
2
|
import type { AudioCaptureOptions, CreateLocalTracksOptions, VideoCaptureOptions } from './options';
|
2
3
|
import type { AudioTrack } from './types';
|
3
4
|
export declare function mergeDefaultOptions(options?: CreateLocalTracksOptions, audioDefaults?: AudioCaptureOptions, videoDefaults?: VideoCaptureOptions): CreateLocalTracksOptions;
|
@@ -11,4 +12,42 @@ export declare function detectSilence(track: AudioTrack, timeOffset?: number): P
|
|
11
12
|
* @internal
|
12
13
|
*/
|
13
14
|
export declare function getNewAudioContext(): AudioContext | void;
|
15
|
+
type FacingMode = NonNullable<VideoCaptureOptions['facingMode']>;
|
16
|
+
type FacingModeFromLocalTrackOptions = {
|
17
|
+
/**
|
18
|
+
* If no facing mode can be determined, this value will be used.
|
19
|
+
* @defaultValue 'user'
|
20
|
+
*/
|
21
|
+
defaultFacingMode?: FacingMode;
|
22
|
+
};
|
23
|
+
type FacingModeFromLocalTrackReturnValue = {
|
24
|
+
/**
|
25
|
+
* The (probable) facingMode of the track.
|
26
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/facingMode | MDN docs on facingMode}
|
27
|
+
*/
|
28
|
+
facingMode: FacingMode;
|
29
|
+
/**
|
30
|
+
* The confidence that the returned facingMode is correct.
|
31
|
+
*/
|
32
|
+
confidence: 'high' | 'medium' | 'low';
|
33
|
+
};
|
34
|
+
/**
|
35
|
+
* Try to analyze the local track to determine the facing mode of a track.
|
36
|
+
*
|
37
|
+
* @remarks
|
38
|
+
* There is no property supported by all browsers to detect whether a video track originated from a user- or environment-facing camera device.
|
39
|
+
* For this reason, we use the `facingMode` property when available, but will fall back on a string-based analysis of the device label to determine the facing mode.
|
40
|
+
* If both methods fail, the default facing mode will be used.
|
41
|
+
*
|
42
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/facingMode | MDN docs on facingMode}
|
43
|
+
* @experimental
|
44
|
+
*/
|
45
|
+
export declare function facingModeFromLocalTrack(localTrack: LocalTrack | MediaStreamTrack, options?: FacingModeFromLocalTrackOptions): FacingModeFromLocalTrackReturnValue;
|
46
|
+
/**
|
47
|
+
* Attempt to analyze the device label to determine the facing mode.
|
48
|
+
*
|
49
|
+
* @experimental
|
50
|
+
*/
|
51
|
+
export declare function facingModeFromDeviceLabel(deviceLabel: string): FacingModeFromLocalTrackReturnValue | undefined;
|
52
|
+
export {};
|
14
53
|
//# sourceMappingURL=utils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/room/track/utils.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/room/track/utils.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,mBAAmB,CACjC,OAAO,CAAC,EAAE,wBAAwB,EAClC,aAAa,CAAC,EAAE,mBAAmB,EACnC,aAAa,CAAC,EAAE,mBAAmB,GAClC,wBAAwB,CAqB1B;AAYD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,wBAAwB,GAAG,sBAAsB,CAqC/F;AACD;;;GAGG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,SAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBzF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,GAAG,IAAI,CAOxD;AAED,KAAK,UAAU,GAAG,WAAW,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC;AACjE,KAAK,+BAA+B,GAAG;IACrC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC,CAAC;AACF,KAAK,mCAAmC,GAAG;IACzC;;;OAGG;IACH,UAAU,EAAE,UAAU,CAAC;IACvB;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;CACvC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,UAAU,GAAG,gBAAgB,EACzC,OAAO,GAAE,+BAAoC,GAC5C,mCAAmC,CA2BrC;AASD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,GAClB,mCAAmC,GAAG,SAAS,CAgBjD"}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import EventEmitter from 'eventemitter3';
|
2
2
|
/** @internal */
|
3
3
|
interface TrackBitrateInfo {
|
4
|
-
|
4
|
+
cid?: string;
|
5
|
+
transceiver?: RTCRtpTransceiver;
|
5
6
|
codec: string;
|
6
7
|
maxbr: number;
|
7
8
|
}
|
@@ -31,9 +32,9 @@ export default class PCTransport extends EventEmitter {
|
|
31
32
|
};
|
32
33
|
createAndSendOffer(options?: RTCOfferOptions): Promise<void>;
|
33
34
|
createAndSetAnswer(): Promise<RTCSessionDescriptionInit>;
|
34
|
-
setTrackCodecBitrate(
|
35
|
+
setTrackCodecBitrate(info: TrackBitrateInfo): void;
|
35
36
|
close(): void;
|
36
|
-
private
|
37
|
+
private setMungedSDP;
|
37
38
|
}
|
38
39
|
export {};
|
39
40
|
//# sourceMappingURL=PCTransport.d.ts.map
|
@@ -39,7 +39,7 @@ export interface TrackPublishDefaults {
|
|
39
39
|
*/
|
40
40
|
red?: boolean;
|
41
41
|
/**
|
42
|
-
* stereo
|
42
|
+
* publish track in stereo mode (or set to false to disable). defaults determined by capture channel count.
|
43
43
|
*/
|
44
44
|
forceStereo?: boolean;
|
45
45
|
/**
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import LocalTrack from './LocalTrack';
|
1
2
|
import type { AudioCaptureOptions, CreateLocalTracksOptions, VideoCaptureOptions } from './options';
|
2
3
|
import type { AudioTrack } from './types';
|
3
4
|
export declare function mergeDefaultOptions(options?: CreateLocalTracksOptions, audioDefaults?: AudioCaptureOptions, videoDefaults?: VideoCaptureOptions): CreateLocalTracksOptions;
|
@@ -11,4 +12,42 @@ export declare function detectSilence(track: AudioTrack, timeOffset?: number): P
|
|
11
12
|
* @internal
|
12
13
|
*/
|
13
14
|
export declare function getNewAudioContext(): AudioContext | void;
|
15
|
+
type FacingMode = NonNullable<VideoCaptureOptions['facingMode']>;
|
16
|
+
type FacingModeFromLocalTrackOptions = {
|
17
|
+
/**
|
18
|
+
* If no facing mode can be determined, this value will be used.
|
19
|
+
* @defaultValue 'user'
|
20
|
+
*/
|
21
|
+
defaultFacingMode?: FacingMode;
|
22
|
+
};
|
23
|
+
type FacingModeFromLocalTrackReturnValue = {
|
24
|
+
/**
|
25
|
+
* The (probable) facingMode of the track.
|
26
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/facingMode | MDN docs on facingMode}
|
27
|
+
*/
|
28
|
+
facingMode: FacingMode;
|
29
|
+
/**
|
30
|
+
* The confidence that the returned facingMode is correct.
|
31
|
+
*/
|
32
|
+
confidence: 'high' | 'medium' | 'low';
|
33
|
+
};
|
34
|
+
/**
|
35
|
+
* Try to analyze the local track to determine the facing mode of a track.
|
36
|
+
*
|
37
|
+
* @remarks
|
38
|
+
* There is no property supported by all browsers to detect whether a video track originated from a user- or environment-facing camera device.
|
39
|
+
* For this reason, we use the `facingMode` property when available, but will fall back on a string-based analysis of the device label to determine the facing mode.
|
40
|
+
* If both methods fail, the default facing mode will be used.
|
41
|
+
*
|
42
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints/facingMode | MDN docs on facingMode}
|
43
|
+
* @experimental
|
44
|
+
*/
|
45
|
+
export declare function facingModeFromLocalTrack(localTrack: LocalTrack | MediaStreamTrack, options?: FacingModeFromLocalTrackOptions): FacingModeFromLocalTrackReturnValue;
|
46
|
+
/**
|
47
|
+
* Attempt to analyze the device label to determine the facing mode.
|
48
|
+
*
|
49
|
+
* @experimental
|
50
|
+
*/
|
51
|
+
export declare function facingModeFromDeviceLabel(deviceLabel: string): FacingModeFromLocalTrackReturnValue | undefined;
|
52
|
+
export {};
|
14
53
|
//# sourceMappingURL=utils.d.ts.map
|
package/package.json
CHANGED
package/src/room/PCTransport.ts
CHANGED
@@ -8,11 +8,20 @@ import { ddExtensionURI, isChromiumBased, isSVCCodec } from './utils';
|
|
8
8
|
|
9
9
|
/** @internal */
|
10
10
|
interface TrackBitrateInfo {
|
11
|
-
|
11
|
+
cid?: string;
|
12
|
+
transceiver?: RTCRtpTransceiver;
|
12
13
|
codec: string;
|
13
14
|
maxbr: number;
|
14
15
|
}
|
15
16
|
|
17
|
+
/* The svc codec (av1/vp9) would use a very low bitrate at the begining and
|
18
|
+
increase slowly by the bandwidth estimator until it reach the target bitrate. The
|
19
|
+
process commonly cost more than 10 seconds cause subscriber will get blur video at
|
20
|
+
the first few seconds. So we use a 70% of target bitrate here as the start bitrate to
|
21
|
+
eliminate this issue.
|
22
|
+
*/
|
23
|
+
const startBitrateForSVC = 0.7;
|
24
|
+
|
16
25
|
export const PCEvents = {
|
17
26
|
NegotiationStarted: 'negotiationStarted',
|
18
27
|
NegotiationComplete: 'negotiationComplete',
|
@@ -56,12 +65,65 @@ export default class PCTransport extends EventEmitter {
|
|
56
65
|
}
|
57
66
|
|
58
67
|
async setRemoteDescription(sd: RTCSessionDescriptionInit): Promise<void> {
|
68
|
+
let mungedSDP: string | undefined = undefined;
|
59
69
|
if (sd.type === 'offer') {
|
60
70
|
let { stereoMids, nackMids } = extractStereoAndNackAudioFromOffer(sd);
|
61
71
|
this.remoteStereoMids = stereoMids;
|
62
72
|
this.remoteNackMids = nackMids;
|
73
|
+
} else if (sd.type === 'answer') {
|
74
|
+
const sdpParsed = parse(sd.sdp ?? '');
|
75
|
+
sdpParsed.media.forEach((media) => {
|
76
|
+
if (media.type === 'audio') {
|
77
|
+
// mung sdp for opus bitrate settings
|
78
|
+
this.trackBitrates.some((trackbr): boolean => {
|
79
|
+
if (!trackbr.transceiver || media.mid != trackbr.transceiver.mid) {
|
80
|
+
return false;
|
81
|
+
}
|
82
|
+
|
83
|
+
let codecPayload = 0;
|
84
|
+
media.rtp.some((rtp): boolean => {
|
85
|
+
if (rtp.codec.toUpperCase() === trackbr.codec.toUpperCase()) {
|
86
|
+
codecPayload = rtp.payload;
|
87
|
+
return true;
|
88
|
+
}
|
89
|
+
return false;
|
90
|
+
});
|
91
|
+
|
92
|
+
if (codecPayload === 0) {
|
93
|
+
return true;
|
94
|
+
}
|
95
|
+
|
96
|
+
let fmtpFound = false;
|
97
|
+
for (const fmtp of media.fmtp) {
|
98
|
+
if (fmtp.payload === codecPayload) {
|
99
|
+
fmtp.config = fmtp.config
|
100
|
+
.split(';')
|
101
|
+
.filter((attr) => !attr.includes('maxaveragebitrate'))
|
102
|
+
.join(';');
|
103
|
+
if (trackbr.maxbr > 0) {
|
104
|
+
fmtp.config += `;maxaveragebitrate=${trackbr.maxbr * 1000}`;
|
105
|
+
}
|
106
|
+
fmtpFound = true;
|
107
|
+
break;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
if (!fmtpFound) {
|
112
|
+
if (trackbr.maxbr > 0) {
|
113
|
+
media.fmtp.push({
|
114
|
+
payload: codecPayload,
|
115
|
+
config: `maxaveragebitrate=${trackbr.maxbr * 1000}`,
|
116
|
+
});
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
return true;
|
121
|
+
});
|
122
|
+
}
|
123
|
+
});
|
124
|
+
mungedSDP = write(sdpParsed);
|
63
125
|
}
|
64
|
-
await this.
|
126
|
+
await this.setMungedSDP(sd, mungedSDP, true);
|
65
127
|
|
66
128
|
this.pendingCandidates.forEach((candidate) => {
|
67
129
|
this.pc.addIceCandidate(candidate);
|
@@ -130,7 +192,7 @@ export default class PCTransport extends EventEmitter {
|
|
130
192
|
ensureVideoDDExtensionForSVC(media);
|
131
193
|
// mung sdp for codec bitrate setting that can't apply by sendEncoding
|
132
194
|
this.trackBitrates.some((trackbr): boolean => {
|
133
|
-
if (!media.msid || !media.msid.includes(trackbr.
|
195
|
+
if (!media.msid || !trackbr.cid || !media.msid.includes(trackbr.cid)) {
|
134
196
|
return false;
|
135
197
|
}
|
136
198
|
|
@@ -143,39 +205,39 @@ export default class PCTransport extends EventEmitter {
|
|
143
205
|
return false;
|
144
206
|
});
|
145
207
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
) {
|
162
|
-
media.fmtp.push({
|
163
|
-
payload: codecPayload,
|
164
|
-
config: `x-google-start-bitrate=${trackbr.maxbr * 0.7};x-google-max-bitrate=${
|
165
|
-
trackbr.maxbr
|
166
|
-
}`,
|
167
|
-
});
|
208
|
+
if (codecPayload === 0) {
|
209
|
+
return true;
|
210
|
+
}
|
211
|
+
|
212
|
+
let fmtpFound = false;
|
213
|
+
for (const fmtp of media.fmtp) {
|
214
|
+
if (fmtp.payload === codecPayload) {
|
215
|
+
if (!fmtp.config.includes('x-google-start-bitrate')) {
|
216
|
+
fmtp.config += `;x-google-start-bitrate=${trackbr.maxbr * startBitrateForSVC}`;
|
217
|
+
}
|
218
|
+
if (!fmtp.config.includes('x-google-max-bitrate')) {
|
219
|
+
fmtp.config += `;x-google-max-bitrate=${trackbr.maxbr}`;
|
220
|
+
}
|
221
|
+
fmtpFound = true;
|
222
|
+
break;
|
168
223
|
}
|
169
224
|
}
|
170
225
|
|
226
|
+
if (!fmtpFound) {
|
227
|
+
media.fmtp.push({
|
228
|
+
payload: codecPayload,
|
229
|
+
config: `x-google-start-bitrate=${
|
230
|
+
trackbr.maxbr * startBitrateForSVC
|
231
|
+
};x-google-max-bitrate=${trackbr.maxbr}`,
|
232
|
+
});
|
233
|
+
}
|
234
|
+
|
171
235
|
return true;
|
172
236
|
});
|
173
237
|
}
|
174
238
|
});
|
175
239
|
|
176
|
-
this.
|
177
|
-
|
178
|
-
await this.setMungedLocalDescription(offer, write(sdpParsed));
|
240
|
+
await this.setMungedSDP(offer, write(sdpParsed));
|
179
241
|
this.onOffer(offer);
|
180
242
|
}
|
181
243
|
|
@@ -187,16 +249,12 @@ export default class PCTransport extends EventEmitter {
|
|
187
249
|
ensureAudioNackAndStereo(media, this.remoteStereoMids, this.remoteNackMids);
|
188
250
|
}
|
189
251
|
});
|
190
|
-
await this.
|
252
|
+
await this.setMungedSDP(answer, write(sdpParsed));
|
191
253
|
return answer;
|
192
254
|
}
|
193
255
|
|
194
|
-
setTrackCodecBitrate(
|
195
|
-
this.trackBitrates.push(
|
196
|
-
sid,
|
197
|
-
codec,
|
198
|
-
maxbr,
|
199
|
-
});
|
256
|
+
setTrackCodecBitrate(info: TrackBitrateInfo) {
|
257
|
+
this.trackBitrates.push(info);
|
200
258
|
}
|
201
259
|
|
202
260
|
close() {
|
@@ -205,22 +263,32 @@ export default class PCTransport extends EventEmitter {
|
|
205
263
|
this.pc.close();
|
206
264
|
}
|
207
265
|
|
208
|
-
private async
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
266
|
+
private async setMungedSDP(sd: RTCSessionDescriptionInit, munged?: string, remote?: boolean) {
|
267
|
+
if (munged) {
|
268
|
+
const originalSdp = sd.sdp;
|
269
|
+
sd.sdp = munged;
|
270
|
+
try {
|
271
|
+
log.debug(`setting munged ${remote ? 'remote' : 'local'} description`);
|
272
|
+
if (remote) {
|
273
|
+
await this.pc.setRemoteDescription(sd);
|
274
|
+
} else {
|
275
|
+
await this.pc.setLocalDescription(sd);
|
276
|
+
}
|
277
|
+
return;
|
278
|
+
} catch (e) {
|
279
|
+
log.warn(`not able to set ${sd.type}, falling back to unmodified sdp`, {
|
280
|
+
error: e,
|
281
|
+
});
|
282
|
+
sd.sdp = originalSdp;
|
283
|
+
}
|
220
284
|
}
|
221
285
|
|
222
286
|
try {
|
223
|
-
|
287
|
+
if (remote) {
|
288
|
+
await this.pc.setRemoteDescription(sd);
|
289
|
+
} else {
|
290
|
+
await this.pc.setLocalDescription(sd);
|
291
|
+
}
|
224
292
|
} catch (e) {
|
225
293
|
// this error cannot always be caught.
|
226
294
|
// If the local description has a setCodecPreferences error, this error will be uncaught
|
@@ -494,12 +494,12 @@ export default class LocalParticipant extends Participant {
|
|
494
494
|
return existingPublication;
|
495
495
|
}
|
496
496
|
|
497
|
-
const
|
498
|
-
options?.forceStereo ||
|
497
|
+
const isStereoInput =
|
499
498
|
('channelCount' in track.mediaStreamTrack.getSettings() &&
|
500
499
|
// @ts-ignore `channelCount` on getSettings() is currently only available for Safari, but is generally the best way to determine a stereo track https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings/channelCount
|
501
500
|
track.mediaStreamTrack.getSettings().channelCount === 2) ||
|
502
501
|
track.mediaStreamTrack.getConstraints().channelCount === 2;
|
502
|
+
const isStereo = options?.forceStereo ?? isStereoInput;
|
503
503
|
|
504
504
|
// disable dtx for stereo track if not enabled explicitly
|
505
505
|
if (isStereo) {
|
@@ -730,12 +730,36 @@ export default class LocalParticipant extends Participant {
|
|
730
730
|
// store RTPSender
|
731
731
|
track.sender = await this.engine.createSender(track, opts, encodings);
|
732
732
|
|
733
|
-
if (
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
733
|
+
if (encodings) {
|
734
|
+
if (isFireFox() && track.kind === Track.Kind.Audio) {
|
735
|
+
/* Refer to RFC https://datatracker.ietf.org/doc/html/rfc7587#section-6.1,
|
736
|
+
livekit-server uses maxaveragebitrate=510000in the answer sdp to permit client to
|
737
|
+
publish high quality audio track. But firefox always uses this value as the actual
|
738
|
+
bitrates, causing the audio bitrates to rise to 510Kbps in any stereo case unexpectedly.
|
739
|
+
So the client need to modify maxaverragebitrates in answer sdp to user provided value to
|
740
|
+
fix the issue.
|
741
|
+
*/
|
742
|
+
let trackTransceiver: RTCRtpTransceiver | undefined = undefined;
|
743
|
+
for (const transceiver of this.engine.publisher.pc.getTransceivers()) {
|
744
|
+
if (transceiver.sender === track.sender) {
|
745
|
+
trackTransceiver = transceiver;
|
746
|
+
break;
|
747
|
+
}
|
748
|
+
}
|
749
|
+
if (trackTransceiver) {
|
750
|
+
this.engine.publisher.setTrackCodecBitrate({
|
751
|
+
transceiver: trackTransceiver,
|
752
|
+
codec: 'opus',
|
753
|
+
maxbr: encodings[0]?.maxBitrate ? encodings[0].maxBitrate / 1000 : 0,
|
754
|
+
});
|
755
|
+
}
|
756
|
+
} else if (track.codec && isSVCCodec(track.codec) && encodings[0]?.maxBitrate) {
|
757
|
+
this.engine.publisher.setTrackCodecBitrate({
|
758
|
+
cid: req.cid,
|
759
|
+
codec: track.codec,
|
760
|
+
maxbr: encodings[0].maxBitrate / 1000,
|
761
|
+
});
|
762
|
+
}
|
739
763
|
}
|
740
764
|
|
741
765
|
this.engine.negotiate();
|
@@ -10,7 +10,7 @@ import type {
|
|
10
10
|
VideoCodec,
|
11
11
|
VideoEncoding,
|
12
12
|
} from '../track/options';
|
13
|
-
import { getReactNativeOs, isReactNative, isSVCCodec } from '../utils';
|
13
|
+
import { getReactNativeOs, isFireFox, isReactNative, isSVCCodec } from '../utils';
|
14
14
|
|
15
15
|
/** @internal */
|
16
16
|
export function mediaTrackToLocalTrack(
|
@@ -118,6 +118,7 @@ export function computeVideoEncodings(
|
|
118
118
|
height,
|
119
119
|
videoEncoding.maxBitrate,
|
120
120
|
videoEncoding.maxFramerate,
|
121
|
+
videoEncoding.priority,
|
121
122
|
);
|
122
123
|
|
123
124
|
if (scalabilityMode && isSVCCodec(videoCodec)) {
|
@@ -311,7 +312,8 @@ function encodingsFromPresets(
|
|
311
312
|
if (preset.encoding.maxFramerate) {
|
312
313
|
encoding.maxFramerate = preset.encoding.maxFramerate;
|
313
314
|
}
|
314
|
-
|
315
|
+
const canSetPriority = isFireFox() || idx === 0;
|
316
|
+
if (preset.encoding.priority && canSetPriority) {
|
315
317
|
encoding.priority = preset.encoding.priority;
|
316
318
|
encoding.networkPriority = preset.encoding.priority;
|
317
319
|
}
|
@@ -45,7 +45,7 @@ export interface TrackPublishDefaults {
|
|
45
45
|
red?: boolean;
|
46
46
|
|
47
47
|
/**
|
48
|
-
* stereo
|
48
|
+
* publish track in stereo mode (or set to false to disable). defaults determined by capture channel count.
|
49
49
|
*/
|
50
50
|
forceStereo?: boolean;
|
51
51
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { AudioCaptureOptions, VideoCaptureOptions, VideoPresets } from './options';
|
2
|
-
import { constraintsForOptions, mergeDefaultOptions } from './utils';
|
2
|
+
import { constraintsForOptions, facingModeFromDeviceLabel, mergeDefaultOptions } from './utils';
|
3
3
|
|
4
4
|
describe('mergeDefaultOptions', () => {
|
5
5
|
const audioDefaults: AudioCaptureOptions = {
|
@@ -108,3 +108,32 @@ describe('constraintsForOptions', () => {
|
|
108
108
|
expect(videoOpts.aspectRatio).toEqual(VideoPresets.h720.resolution.aspectRatio);
|
109
109
|
});
|
110
110
|
});
|
111
|
+
|
112
|
+
describe('Test facingMode detection', () => {
|
113
|
+
test('OBS virtual camera should be detected.', () => {
|
114
|
+
const result = facingModeFromDeviceLabel('OBS Virtual Camera');
|
115
|
+
expect(result?.facingMode).toEqual('environment');
|
116
|
+
expect(result?.confidence).toEqual('medium');
|
117
|
+
});
|
118
|
+
|
119
|
+
test.each([
|
120
|
+
['Peter’s iPhone Camera', { facingMode: 'environment', confidence: 'medium' }],
|
121
|
+
['iPhone de Théo Camera', { facingMode: 'environment', confidence: 'medium' }],
|
122
|
+
])(
|
123
|
+
'Device labels that contain "iphone" should return facingMode "environment".',
|
124
|
+
(label, expected) => {
|
125
|
+
const result = facingModeFromDeviceLabel(label);
|
126
|
+
expect(result?.facingMode).toEqual(expected.facingMode);
|
127
|
+
expect(result?.confidence).toEqual(expected.confidence);
|
128
|
+
},
|
129
|
+
);
|
130
|
+
|
131
|
+
test.each([
|
132
|
+
['Peter’s iPad Camera', { facingMode: 'environment', confidence: 'medium' }],
|
133
|
+
['iPad de Théo Camera', { facingMode: 'environment', confidence: 'medium' }],
|
134
|
+
])('Device label that contain "ipad" should detect.', (label, expected) => {
|
135
|
+
const result = facingModeFromDeviceLabel(label);
|
136
|
+
expect(result?.facingMode).toEqual(expected.facingMode);
|
137
|
+
expect(result?.confidence).toEqual(expected.confidence);
|
138
|
+
});
|
139
|
+
});
|