@vkontakte/calls-sdk 2.8.13-dev.ab19d582.0 → 2.8.13-dev.b0dfcfc5.0
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/CallsSDK.d.ts +5 -0
- package/abstract/BaseApi.d.ts +20 -18
- package/calls-sdk.cjs.js +7 -7
- package/calls-sdk.esm.js +3473 -2476
- package/classes/AudioFix.d.ts +2 -2
- package/classes/AudioOutput.d.ts +3 -3
- package/classes/ExternalIdCache.d.ts +9 -13
- package/classes/MediaSource.d.ts +6 -2
- package/classes/SpecListener.d.ts +2 -2
- package/classes/VolumesDetector.d.ts +0 -1
- package/classes/codec/LibVPxDecoder.d.ts +2 -2
- package/classes/codec/LibVPxEncoder.d.ts +2 -2
- package/classes/codec/WebCodecsDecoder.d.ts +2 -2
- package/classes/codec/WebCodecsEncoder.d.ts +2 -2
- package/classes/codec/WorkerBase.d.ts +3 -3
- package/classes/conversation/Conversation.d.ts +12 -4
- package/classes/conversation/Conversation.testUtils.d.ts +2 -0
- package/classes/conversation/DisplayLayoutRequester.d.ts +3 -1
- package/classes/screenshare/ScreenCaptureReceiver.d.ts +2 -2
- package/classes/screenshare/ScreenCaptureSender.d.ts +2 -2
- package/classes/screenshare/StreamBuilder.d.ts +3 -2
- package/classes/stat/ApiCallStats.d.ts +12 -0
- package/classes/stat/CallLifecycleStats.d.ts +2 -2
- package/classes/stat/CodecStatsAggregator.d.ts +2 -2
- package/classes/stat/ConversationStats.d.ts +14 -2
- package/classes/stat/PeerConnectionStats.d.ts +19 -0
- package/classes/stat/SdpStats.d.ts +38 -0
- package/classes/stat/StatAggregator.d.ts +10 -3
- package/classes/stat/StatClock.d.ts +28 -0
- package/classes/stat/StatDrainScheduler.d.ts +92 -0
- package/classes/stat/StatEventCollector.d.ts +50 -0
- package/classes/stat/StatPings.d.ts +2 -2
- package/classes/stat/StatQueue.d.ts +79 -0
- package/classes/stat/StatSignalingCommands.d.ts +2 -2
- package/classes/stat/StatUnloadJournal.d.ts +27 -0
- package/classes/transport/DirectTransport.d.ts +8 -2
- package/classes/transport/PerfStatReporter.d.ts +2 -0
- package/classes/transport/ServerTransport.d.ts +4 -2
- package/classes/transport/SimulcastSender.d.ts +2 -2
- package/classes/transport/Transport.d.ts +2 -2
- package/default/Api.d.ts +18 -11
- package/default/Signaling.d.ts +11 -3
- package/enums/SessionError.d.ts +10 -0
- package/enums/Stat.d.ts +20 -0
- package/package.json +1 -1
- package/static/ApiTransport.d.ts +4 -0
- package/static/External.d.ts +10 -0
- package/static/Params.d.ts +57 -1
- package/static/SessionStore.d.ts +29 -0
- package/static/SimulcastInfo.d.ts +1 -0
- package/static/WebRTCUtils.d.ts +5 -5
- package/types/IEventualStatLog.d.ts +1 -1
package/classes/AudioFix.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DebugLogger } from '../static/Debug';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from './stat/StatEventCollector';
|
|
3
3
|
import { MediaSource } from './MediaSource';
|
|
4
4
|
export default class AudioFix {
|
|
5
5
|
private _fixNoPacketsApplied;
|
|
@@ -15,7 +15,7 @@ export default class AudioFix {
|
|
|
15
15
|
private _lastPacketsSentTime;
|
|
16
16
|
private _toggleAudioPromise;
|
|
17
17
|
private _fixNoPacketsAppliedVideo;
|
|
18
|
-
constructor(mediaSource: MediaSource, debug?: DebugLogger, logger?:
|
|
18
|
+
constructor(mediaSource: MediaSource, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
19
19
|
private _fixAudioDeviceNoPackets;
|
|
20
20
|
private _fixAudioDeviceTooManyPackets;
|
|
21
21
|
fix(rtps: any[]): void;
|
package/classes/AudioOutput.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DebugLogger } from '../static/Debug';
|
|
2
2
|
import { ParticipantId } from '../types/Participant';
|
|
3
|
-
import
|
|
3
|
+
import StatEventCollector from './stat/StatEventCollector';
|
|
4
4
|
import { StatFirstMediaReceived } from './stat/StatFirstMediaReceived';
|
|
5
5
|
/**
|
|
6
6
|
* Единый AudioOutput поддерживающий p2p, audioMix и transparent-audio
|
|
@@ -8,14 +8,14 @@ import { StatFirstMediaReceived } from './stat/StatFirstMediaReceived';
|
|
|
8
8
|
export default class AudioOutput {
|
|
9
9
|
protected _audioElement: HTMLAudioElement | null;
|
|
10
10
|
protected readonly _debug: DebugLogger;
|
|
11
|
-
private
|
|
11
|
+
private _preparedAudioElement;
|
|
12
12
|
private _audioTracks;
|
|
13
13
|
private readonly _allowMultipleTracks;
|
|
14
14
|
private _volume;
|
|
15
15
|
private readonly _features;
|
|
16
16
|
private readonly _statFirstMediaReceived;
|
|
17
17
|
private readonly _logger;
|
|
18
|
-
constructor(statFirstMediaReceived: StatFirstMediaReceived, allowMultipleTracks?: boolean, debug?: DebugLogger, logger?:
|
|
18
|
+
constructor(statFirstMediaReceived: StatFirstMediaReceived, allowMultipleTracks?: boolean, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
19
19
|
add(participantId: ParticipantId, track: MediaStreamTrack): void;
|
|
20
20
|
remove(participantId: ParticipantId, track: MediaStreamTrack): void;
|
|
21
21
|
get volume(): number;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { ExternalId, ExternalParticipantId } from '../types/ExternalId';
|
|
2
|
-
import {
|
|
2
|
+
import { ParticipantId } from '../types/Participant';
|
|
3
3
|
export declare class ExternalIdCache {
|
|
4
4
|
private static _normalizeType;
|
|
5
|
-
private
|
|
6
|
-
private
|
|
5
|
+
private _participantIdToExternalId;
|
|
6
|
+
private _externalIdToParticipantId;
|
|
7
7
|
private _decorativeIdToInitialId;
|
|
8
8
|
private _initialIdToDecorativeId;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
unmapDecorativeId(initialId: OkUserId | CompositeUserId | ParticipantId): void;
|
|
16
|
-
getDecorativeIdByInitialId(initialId: OkUserId | CompositeUserId | ParticipantId): OkUserId | undefined;
|
|
17
|
-
replaceByInitialIdIdIfExists(id: OkUserId | CompositeUserId | ParticipantId): OkUserId;
|
|
18
|
-
getParticipantIdByExternalId(externalId: ExternalId): ParticipantId | null;
|
|
9
|
+
getExternalId(participantId: ParticipantId): ExternalParticipantId | null;
|
|
10
|
+
getParticipantId(externalId: ExternalId): ParticipantId | null;
|
|
11
|
+
cache(participantId: ParticipantId, externalId: ExternalParticipantId): void;
|
|
12
|
+
mapDecorativeId(decorativeId: ParticipantId, initialId: ParticipantId): void;
|
|
13
|
+
unmapDecorativeId(initialId: ParticipantId): void;
|
|
14
|
+
getDecorativeIdByInitialId(initialId: ParticipantId): ParticipantId | undefined;
|
|
19
15
|
clear(): void;
|
|
20
16
|
}
|
package/classes/MediaSource.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import MediaOption from '../enums/MediaOption';
|
|
|
4
4
|
import { type DebugLogger } from '../static/Debug';
|
|
5
5
|
import MediaSettings, { IVideoDimentions } from '../types/MediaSettings';
|
|
6
6
|
import { ScreenCaptureSettings } from '../types/ScreenCaptureSettings';
|
|
7
|
-
import
|
|
7
|
+
import StatEventCollector from './stat/StatEventCollector';
|
|
8
8
|
export declare const enum MediaSourceEvent {
|
|
9
9
|
SOURCE_CHANGED = "SOURCE_CHANGED",
|
|
10
10
|
SOURCE_READY = "SOURCE_READY",
|
|
@@ -60,7 +60,9 @@ export declare class MediaSource extends EventEmitter {
|
|
|
60
60
|
private readonly _logger;
|
|
61
61
|
private _cameraTrackSetAt;
|
|
62
62
|
private _cameraMuteRecoveredAt;
|
|
63
|
-
|
|
63
|
+
private _micTrackSetAt;
|
|
64
|
+
private _micMuteRecoveredAt;
|
|
65
|
+
constructor(debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
64
66
|
get cameraVideoTrack(): MediaStreamTrack | null;
|
|
65
67
|
set cameraVideoTrack(track: MediaStreamTrack | null);
|
|
66
68
|
request(mediaOptions?: MediaOption[], needEmptyTracks?: boolean): Promise<void>;
|
|
@@ -83,6 +85,7 @@ export declare class MediaSource extends EventEmitter {
|
|
|
83
85
|
* @hidden
|
|
84
86
|
*/
|
|
85
87
|
setVideoStream(stream: MediaStream, isScreen: boolean): Promise<void>;
|
|
88
|
+
private _setMicAudioTrack;
|
|
86
89
|
private _initDeviceChangeListener;
|
|
87
90
|
private _destroyDeviceChangeListener;
|
|
88
91
|
private _changeVideoInput;
|
|
@@ -109,6 +112,7 @@ export declare class MediaSource extends EventEmitter {
|
|
|
109
112
|
toggleScreenCapturing(settings: ScreenCaptureSettings): Promise<void>;
|
|
110
113
|
disableScreenCapturing(): Promise<void>;
|
|
111
114
|
private videoTrackMuteHandler;
|
|
115
|
+
private micTrackMuteHandler;
|
|
112
116
|
toggleVideo(enabled: boolean): Promise<void>;
|
|
113
117
|
toggleAudio(enabled: boolean): Promise<void>;
|
|
114
118
|
toggleAnimojiCapturing(enabled: boolean): void;
|
|
@@ -2,7 +2,7 @@ import { type DebugLogger } from '../static/Debug';
|
|
|
2
2
|
import MediaSettings from '../types/MediaSettings';
|
|
3
3
|
import { Participant, ParticipantId } from '../types/Participant';
|
|
4
4
|
import EventEmitter from './EventEmitter';
|
|
5
|
-
import
|
|
5
|
+
import StatEventCollector from './stat/StatEventCollector';
|
|
6
6
|
import { Transport } from './transport/Transport';
|
|
7
7
|
import { VolumesDetector } from './VolumesDetector';
|
|
8
8
|
export default class SpecListener extends EventEmitter {
|
|
@@ -14,7 +14,7 @@ export default class SpecListener extends EventEmitter {
|
|
|
14
14
|
private _connectionTimeout;
|
|
15
15
|
private _connectionTimeoutSuppressed;
|
|
16
16
|
private _volumeTimeout;
|
|
17
|
-
constructor(transport: Transport, volumesDetector: VolumesDetector, participants: Record<ParticipantId, Participant>, debug?: DebugLogger, logger?:
|
|
17
|
+
constructor(transport: Transport, volumesDetector: VolumesDetector, participants: Record<ParticipantId, Participant>, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
18
18
|
destroy(): void;
|
|
19
19
|
onChangeRemoteMediaSettings(participantId: ParticipantId, mediaSettings: MediaSettings): void;
|
|
20
20
|
onParticipantHoldChanged(): void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
3
3
|
import IDecoder from './IDecoder';
|
|
4
4
|
import WorkerBase from './WorkerBase';
|
|
5
5
|
export default class LibVPxDecoder extends WorkerBase implements IDecoder {
|
|
6
|
-
constructor(debug?: DebugLogger, logger?:
|
|
6
|
+
constructor(debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
7
7
|
init(onFrameImage: (image: ImageData) => void, onFrameError: (error: unknown) => void, onKeyFrameRequested: () => void): Promise<void>;
|
|
8
8
|
decodeFrame(timestamp: number, data: Uint8Array, isVP9: boolean, keyFrame?: boolean): void;
|
|
9
9
|
destroy(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
3
3
|
import IEncoder from './IEncoder';
|
|
4
4
|
import { OnFrameCallback } from './Types';
|
|
5
5
|
import WorkerBase from './WorkerBase';
|
|
@@ -15,7 +15,7 @@ export default class LibVPxEncoder extends WorkerBase implements IEncoder {
|
|
|
15
15
|
private _canvasCtx;
|
|
16
16
|
private _frameReadTimeout;
|
|
17
17
|
private _lastFrame;
|
|
18
|
-
constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number, debug?: DebugLogger, logger?:
|
|
18
|
+
constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
19
19
|
private _createDom;
|
|
20
20
|
private _removeDom;
|
|
21
21
|
private _createStream;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
3
3
|
import IDecoder from './IDecoder';
|
|
4
4
|
import WorkerBase from './WorkerBase';
|
|
5
5
|
export default class WebCodecsDecoder extends WorkerBase implements IDecoder {
|
|
6
|
-
constructor(debug?: DebugLogger, logger?:
|
|
6
|
+
constructor(debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
7
7
|
init(onFrameImage: (frame: VideoFrame) => void, onFrameError: (error: unknown) => void, onKeyFrameRequested: () => void): Promise<void>;
|
|
8
8
|
decodeFrame(timestamp: number, data: Uint8Array, isVP9: boolean, keyFrame?: boolean): void;
|
|
9
9
|
destroy(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
3
3
|
import IEncoder from './IEncoder';
|
|
4
4
|
import { OnFrameCallback } from './Types';
|
|
5
5
|
import WorkerBase from './WorkerBase';
|
|
@@ -11,7 +11,7 @@ export default class WebCodecsEncoder extends WorkerBase implements IEncoder {
|
|
|
11
11
|
private readonly _maxBitrate;
|
|
12
12
|
private readonly _useCbr;
|
|
13
13
|
private readonly _frameRate;
|
|
14
|
-
constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number, useCbr: boolean, frameRate: number, debug?: DebugLogger, logger?:
|
|
14
|
+
constructor(sourceTrack: MediaStreamTrack, onFrame: OnFrameCallback, useCongestionControl: boolean, maxBitrate: number, useCbr: boolean, frameRate: number, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
15
15
|
init(): Promise<void>;
|
|
16
16
|
requestFrame(keyFrame?: boolean): void;
|
|
17
17
|
setBitrate(bitrate: number, useCbr: boolean, fps: number): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
3
3
|
export default abstract class WorkerBase {
|
|
4
4
|
protected _worker: Worker | null;
|
|
5
5
|
protected readonly _debug: DebugLogger;
|
|
6
|
-
protected readonly _logger:
|
|
7
|
-
protected constructor(debug?: DebugLogger, logger?:
|
|
6
|
+
protected readonly _logger: StatEventCollector | null;
|
|
7
|
+
protected constructor(debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
8
8
|
protected _createWorker(workerFunctionData: string, onFrame: (data: any) => void, workerArgs?: any[], initArgs?: {
|
|
9
9
|
[key: string]: any;
|
|
10
10
|
}, transfer?: any[]): Promise<void>;
|
|
@@ -20,7 +20,7 @@ import MediaModifiers from '../../types/MediaModifiers';
|
|
|
20
20
|
import MediaSettings, { IVideoDimentions } from '../../types/MediaSettings';
|
|
21
21
|
import { IAddMovieParams, IUpdateMovieData } from '../../types/MovieShare';
|
|
22
22
|
import MuteStates from '../../types/MuteStates';
|
|
23
|
-
import { CompositeUserId, IGetParticipantsParameters,
|
|
23
|
+
import { CompositeUserId, IGetParticipantsParameters, ParticipantId, ParticipantStateData } from '../../types/Participant';
|
|
24
24
|
import { DisplayLayoutRequest, ParticipantLayout } from '../../types/ParticipantLayout';
|
|
25
25
|
import { ParticipantListChunkParameters } from '../../types/ParticipantListChunk';
|
|
26
26
|
import ParticipantPriority from '../../types/ParticipantPriority';
|
|
@@ -65,6 +65,7 @@ export default class Conversation extends EventEmitter {
|
|
|
65
65
|
private _calleeUnavailableTimer;
|
|
66
66
|
private _reservedId;
|
|
67
67
|
private readonly _onUnload;
|
|
68
|
+
private readonly _onRestore;
|
|
68
69
|
private readonly _audioOutput;
|
|
69
70
|
private readonly _stats;
|
|
70
71
|
private _lastStalled;
|
|
@@ -85,12 +86,18 @@ export default class Conversation extends EventEmitter {
|
|
|
85
86
|
get externalId(): ExternalParticipantId | undefined;
|
|
86
87
|
get mediaSettings(): MediaSettings | undefined;
|
|
87
88
|
get isCallHeld(): boolean;
|
|
89
|
+
get isIncomingRinging(): boolean;
|
|
88
90
|
static debugSessionId(): string | null;
|
|
89
91
|
static debugMessage(type: DebugMessageType, ...args: any[]): boolean;
|
|
90
92
|
static debugMessageWithContext(type: DebugMessageType, conversationId: string, ...args: any[]): boolean;
|
|
91
93
|
static getSyncedTime(): number;
|
|
92
94
|
get debugSessionId(): string | null;
|
|
93
|
-
|
|
95
|
+
getCachedParticipantIdByExternalId(externalId: ExternalId): ParticipantId | null;
|
|
96
|
+
private _onNonFatalError;
|
|
97
|
+
/**
|
|
98
|
+
* Внешний id звонящего во входящем звонке, либо null, если звонящий не найден.
|
|
99
|
+
*/
|
|
100
|
+
getIncomingCallerExternalId(): ExternalParticipantId | null;
|
|
94
101
|
private _buildInternalParams;
|
|
95
102
|
onStart({ opponentIds, opponentType, mediaOptions, payload, joiningAllowed, requireAuthToJoin, onlyAdminCanShareMovie, externalIds, onFastStart, conversationId, }: ConversationOnStartParams): Promise<ConversationData>;
|
|
96
103
|
onJoin(joinArgs: ConversationOnJoinParams): Promise<ConversationData>;
|
|
@@ -164,8 +171,9 @@ export default class Conversation extends EventEmitter {
|
|
|
164
171
|
private _registerParticipantInCache;
|
|
165
172
|
private _getExistedParticipantByIdOrCreate;
|
|
166
173
|
private _getExternalIdByParticipantId;
|
|
167
|
-
private
|
|
168
|
-
private
|
|
174
|
+
private _getExternalIdsByParticipantIds;
|
|
175
|
+
private _reportMissingExternalIds;
|
|
176
|
+
private _reportMissingExternalIdsById;
|
|
169
177
|
private _registerParticipantAndSetMarkersIfChunkEnabled;
|
|
170
178
|
private _warnParticipantNotInConversation;
|
|
171
179
|
private _denormalizeMarkers;
|
|
@@ -35,6 +35,8 @@ declare function createParams(): {
|
|
|
35
35
|
onChatRoomUpdated: Mock<import("@vitest/spy").Procedure>;
|
|
36
36
|
onRemoteStatus: Mock<import("@vitest/spy").Procedure>;
|
|
37
37
|
onSpeakerChanged: Mock<import("@vitest/spy").Procedure>;
|
|
38
|
+
onAcceptedCall: Mock<import("@vitest/spy").Procedure>;
|
|
39
|
+
onNonFatalError: Mock<import("@vitest/spy").Procedure>;
|
|
38
40
|
};
|
|
39
41
|
export type ConversationTestParams = ReturnType<typeof createParams>;
|
|
40
42
|
export type ConversationTestTools = {
|
|
@@ -8,6 +8,7 @@ type DisplayLayoutRequesterParams = {
|
|
|
8
8
|
getParticipants: () => Record<ParticipantId, Participant>;
|
|
9
9
|
isMe: (participantId: ParticipantId) => boolean;
|
|
10
10
|
updateDisplayLayout: (layouts: ParticipantLayout[]) => Promise<void>;
|
|
11
|
+
onNonFatalError: (message: string) => void;
|
|
11
12
|
};
|
|
12
13
|
export default class DisplayLayoutRequester {
|
|
13
14
|
private readonly _api;
|
|
@@ -15,6 +16,7 @@ export default class DisplayLayoutRequester {
|
|
|
15
16
|
private readonly _getParticipants;
|
|
16
17
|
private readonly _isMe;
|
|
17
18
|
private readonly _updateDisplayLayout;
|
|
19
|
+
private readonly _onNonFatalError;
|
|
18
20
|
private _requestedLayouts;
|
|
19
21
|
private _uncertainLayouts;
|
|
20
22
|
private _pendingRequests;
|
|
@@ -25,7 +27,7 @@ export default class DisplayLayoutRequester {
|
|
|
25
27
|
private _lastFlushAt;
|
|
26
28
|
private _generation;
|
|
27
29
|
private _forceNextFlush;
|
|
28
|
-
constructor({ api, debug, getParticipants, isMe, updateDisplayLayout }: DisplayLayoutRequesterParams);
|
|
30
|
+
constructor({ api, debug, getParticipants, isMe, updateDisplayLayout, onNonFatalError }: DisplayLayoutRequesterParams);
|
|
29
31
|
request(requests: DisplayLayoutRequest[]): Promise<void>;
|
|
30
32
|
resend(): void;
|
|
31
33
|
cleanupParticipant(participantId: ParticipantId): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
2
|
import { ParticipantId } from '../../types/Participant';
|
|
3
|
-
import
|
|
3
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
4
4
|
import { ParticipantIdRegistry } from '../ParticipantIdRegistry';
|
|
5
5
|
import { StatAggregator } from '../stat/StatAggregator';
|
|
6
6
|
import { IOnStat } from './BaseStreamBuilder';
|
|
@@ -14,7 +14,7 @@ export default class ScreenCaptureReceiver {
|
|
|
14
14
|
private readonly _debug;
|
|
15
15
|
private readonly _logger;
|
|
16
16
|
private readonly _statAggregator;
|
|
17
|
-
constructor(datachannel: RTCDataChannel, participantIdRegistry: ParticipantIdRegistry, onStream: (streamId: string, stream: MediaStream) => void, onEos: (streamId: string) => void, onStat: IOnStat, statAggregator?: StatAggregator | null, debug?: DebugLogger, logger?:
|
|
17
|
+
constructor(datachannel: RTCDataChannel, participantIdRegistry: ParticipantIdRegistry, onStream: (streamId: string, stream: MediaStream) => void, onEos: (streamId: string) => void, onStat: IOnStat, statAggregator?: StatAggregator | null, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
18
18
|
private _onDataChannelMessage;
|
|
19
19
|
/**
|
|
20
20
|
* Отправить запрос ключевого кадра в datachannel.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseSignaling from '../../abstract/BaseSignaling';
|
|
2
2
|
import { type DebugLogger } from '../../static/Debug';
|
|
3
|
-
import
|
|
3
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
4
4
|
export default class ScreenCaptureSender {
|
|
5
5
|
private readonly _encoder;
|
|
6
6
|
private readonly _datachannel;
|
|
@@ -25,7 +25,7 @@ export default class ScreenCaptureSender {
|
|
|
25
25
|
private readonly _maxFrameDelay;
|
|
26
26
|
private readonly _debug;
|
|
27
27
|
private readonly _logger;
|
|
28
|
-
constructor(track: MediaStreamTrack, datachannel: RTCDataChannel, signaling: BaseSignaling, fastSharing: boolean, debug?: DebugLogger, logger?:
|
|
28
|
+
constructor(track: MediaStreamTrack, datachannel: RTCDataChannel, signaling: BaseSignaling, fastSharing: boolean, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
29
29
|
private _handleQueue;
|
|
30
30
|
/**
|
|
31
31
|
* Очищает очередь до опорного кадра
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DebugLogger } from '../../static/Debug';
|
|
2
2
|
import { ParticipantId } from '../../types/Participant';
|
|
3
|
-
import
|
|
3
|
+
import StatEventCollector from '../stat/StatEventCollector';
|
|
4
4
|
import { StatAggregator } from '../stat/StatAggregator';
|
|
5
5
|
import { BaseStreamBuilder, FrameData, IOnStat, IOnStream } from './BaseStreamBuilder';
|
|
6
6
|
export default class StreamBuilder extends BaseStreamBuilder {
|
|
@@ -9,9 +9,10 @@ export default class StreamBuilder extends BaseStreamBuilder {
|
|
|
9
9
|
private _decoderReady;
|
|
10
10
|
private _decoderBusy;
|
|
11
11
|
private _decoderQueue;
|
|
12
|
+
private _webCodecsRetryAttempted;
|
|
12
13
|
private _fpsMeter;
|
|
13
14
|
private readonly _logger;
|
|
14
|
-
constructor(participantId: ParticipantId, onStream: IOnStream, onStat: IOnStat, statAggregator: StatAggregator | null, onKeyFrameRequested: VoidFunction, debug?: DebugLogger, logger?:
|
|
15
|
+
constructor(participantId: ParticipantId, onStream: IOnStream, onStat: IOnStat, statAggregator: StatAggregator | null, onKeyFrameRequested: VoidFunction, debug?: DebugLogger, logger?: StatEventCollector | null);
|
|
15
16
|
protected _processFrame(frame: FrameData): void;
|
|
16
17
|
private _initFpsMeter;
|
|
17
18
|
/**
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StatAggregator } from './StatAggregator';
|
|
2
|
+
/** Отправляет в стату время выполнения запросов к API */
|
|
3
|
+
export declare class ApiCallStats {
|
|
4
|
+
private readonly _statAggregator;
|
|
5
|
+
constructor(statAggregator: StatAggregator | null);
|
|
6
|
+
/**
|
|
7
|
+
* @param method название метода API, например `vchat.getConversationParams`
|
|
8
|
+
* @param duration время от запроса до ответа, мс
|
|
9
|
+
* @param error описание ошибки, если запрос не удался
|
|
10
|
+
*/
|
|
11
|
+
log(method: string, duration: number, error?: string): void;
|
|
12
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import StatEventCollector from './StatEventCollector';
|
|
2
2
|
export type CallLifecycleSource = 'outgoing' | 'incoming' | 'join' | 'anonym_join';
|
|
3
3
|
export interface CallLifecycleInitializationParams {
|
|
4
4
|
source: CallLifecycleSource;
|
|
@@ -20,7 +20,7 @@ export declare class CallLifecycleStats {
|
|
|
20
20
|
private _firstMediaSent;
|
|
21
21
|
private _finished;
|
|
22
22
|
private _destroyed;
|
|
23
|
-
constructor(logger:
|
|
23
|
+
constructor(logger: StatEventCollector, clock?: CallLifecycleClock);
|
|
24
24
|
get firstMediaSentReported(): boolean;
|
|
25
25
|
get terminated(): boolean;
|
|
26
26
|
markInitializationStarted({ source, conversationId }: CallLifecycleInitializationParams): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StatItem } from '../../types/Statistics';
|
|
2
|
-
import
|
|
2
|
+
import StatEventCollector from './StatEventCollector';
|
|
3
3
|
import TransportTopology from '../../enums/TransportTopology';
|
|
4
4
|
export type CodecKind = 'audio' | 'video';
|
|
5
5
|
/**
|
|
@@ -11,7 +11,7 @@ export declare class CodecStatsAggregator {
|
|
|
11
11
|
private readonly _logger;
|
|
12
12
|
private readonly _codecUsages;
|
|
13
13
|
private readonly getCurrentTransportTopology;
|
|
14
|
-
constructor(logger:
|
|
14
|
+
constructor(logger: StatEventCollector, getCurrentTransportTopology: () => TransportTopology | undefined);
|
|
15
15
|
reportUsage(stat: StatItem): void;
|
|
16
16
|
private saveUsage;
|
|
17
17
|
private report;
|
|
@@ -2,20 +2,32 @@ import BaseApi from '../../abstract/BaseApi';
|
|
|
2
2
|
import BaseLogger from '../../abstract/BaseLogger';
|
|
3
3
|
import TransportTopology from '../../enums/TransportTopology';
|
|
4
4
|
import HangupReason from '../HangupReason';
|
|
5
|
-
import
|
|
5
|
+
import StatEventCollector from './StatEventCollector';
|
|
6
|
+
import { ApiCallStats } from './ApiCallStats';
|
|
6
7
|
import { CallLifecycleStats } from './CallLifecycleStats';
|
|
7
8
|
import { CodecStatsAggregator } from './CodecStatsAggregator';
|
|
8
9
|
import { StatAggregator } from './StatAggregator';
|
|
9
10
|
import { StatPings } from './StatPings';
|
|
10
11
|
import { StatSignalingCommands } from './StatSignalingCommands';
|
|
11
12
|
export declare class ConversationStats {
|
|
12
|
-
readonly logger:
|
|
13
|
+
readonly logger: StatEventCollector;
|
|
13
14
|
readonly lifecycle: CallLifecycleStats;
|
|
14
15
|
readonly statAggregator: StatAggregator;
|
|
15
16
|
readonly codecStatsAggregator: CodecStatsAggregator;
|
|
16
17
|
readonly pings: StatPings;
|
|
17
18
|
readonly signalingCommands: StatSignalingCommands;
|
|
19
|
+
readonly apiCalls: ApiCallStats;
|
|
20
|
+
private readonly _api;
|
|
21
|
+
private _unloading;
|
|
18
22
|
constructor(api: BaseApi, externalLogger: BaseLogger | null, getConversationId: () => string | null, getTopology: () => TransportTopology | undefined);
|
|
23
|
+
/**
|
|
24
|
+
* Вызывается из pagehide-обработчика: события финиша должны пережить смерть
|
|
25
|
+
* вкладки. Сводки пингов и команд сбрасываем здесь же — destroy() их только
|
|
26
|
+
* очищает.
|
|
27
|
+
*/
|
|
28
|
+
prepareForUnload(): void;
|
|
29
|
+
/** Вкладка пережила pagehide: возвращаем запись в очередь. */
|
|
30
|
+
restoreAfterUnload(): void;
|
|
19
31
|
logHangup(reason: HangupReason): void;
|
|
20
32
|
flushCallMetrics(): void;
|
|
21
33
|
destroy(): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StatAggregator } from './StatAggregator';
|
|
2
|
+
/** Стата жизненного цикла RTCPeerConnection */
|
|
3
|
+
export declare class PeerConnectionStats {
|
|
4
|
+
private readonly _statAggregator;
|
|
5
|
+
private _pc;
|
|
6
|
+
private _lastSignalingStateChange;
|
|
7
|
+
private _lastGatheringStateChange;
|
|
8
|
+
private readonly _handleConnectionStateChange;
|
|
9
|
+
private readonly _handleSignalingStateChange;
|
|
10
|
+
private readonly _handleGatheringStateChange;
|
|
11
|
+
private readonly _handleIceCandidateError;
|
|
12
|
+
constructor(statAggregator: StatAggregator | null);
|
|
13
|
+
observe(pc: RTCPeerConnection): void;
|
|
14
|
+
stop(): void;
|
|
15
|
+
logIceRestart(): void;
|
|
16
|
+
logIceCandidateAddFailed(candidate: RTCIceCandidateInit, error: unknown): void;
|
|
17
|
+
private _sinceLastChange;
|
|
18
|
+
private _log;
|
|
19
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { StatAggregator } from './StatAggregator';
|
|
2
|
+
type SdpDescription = {
|
|
3
|
+
type: RTCSdpType;
|
|
4
|
+
sdp?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Отправляет в стату согласование SDP: что сгенерировали, что получили от собеседника
|
|
8
|
+
* и на какой операции сломались.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SdpStats {
|
|
11
|
+
private readonly _statAggregator;
|
|
12
|
+
private _pc;
|
|
13
|
+
private _gatheringStartedAt;
|
|
14
|
+
private _remoteSdpReceivedAt;
|
|
15
|
+
private readonly _handleGatheringStateChange;
|
|
16
|
+
constructor(statAggregator: StatAggregator | null);
|
|
17
|
+
/** Начинает следить за сбором кандидатов, предыдущее соединение перестает слушать */
|
|
18
|
+
observe(pc: RTCPeerConnection): void;
|
|
19
|
+
stop(): void;
|
|
20
|
+
/** Сгенерировали свой SDP */
|
|
21
|
+
logSdpGenerated(type: RTCSdpType): void;
|
|
22
|
+
/** Собрали свой ICE-кандидат */
|
|
23
|
+
logCandidateGenerated(candidate: RTCIceCandidate): void;
|
|
24
|
+
/** Получили SDP от собеседника */
|
|
25
|
+
logSdpReceived(type: RTCSdpType): void;
|
|
26
|
+
/** Получили ICE-кандидата от собеседника */
|
|
27
|
+
logCandidateReceived(candidate: RTCIceCandidateInit): void;
|
|
28
|
+
/** Не смогли сгенерировать SDP */
|
|
29
|
+
logCreateFailed(type: RTCSdpType, error: unknown): void;
|
|
30
|
+
/** Не смогли применить свой SDP */
|
|
31
|
+
logSetLocalFailed(sdp: SdpDescription, error: unknown): void;
|
|
32
|
+
/** Не смогли применить SDP собеседника */
|
|
33
|
+
logSetRemoteFailed(sdp: SdpDescription, error: unknown): void;
|
|
34
|
+
destroy(): void;
|
|
35
|
+
private _logFailure;
|
|
36
|
+
private _log;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { ICallStatLog } from '../../types/PerfStatReporter';
|
|
2
2
|
import { IEventualStatLog } from '../../types/IEventualStatLog';
|
|
3
|
-
import
|
|
3
|
+
import StatEventCollector from './StatEventCollector';
|
|
4
4
|
export declare class StatAggregator {
|
|
5
5
|
private readonly _logger;
|
|
6
6
|
private readonly _eventualLogs;
|
|
7
7
|
private _lastCallStatContext;
|
|
8
|
-
constructor(logger:
|
|
8
|
+
constructor(logger: StatEventCollector);
|
|
9
9
|
logCallStat(params: ICallStatLog): void;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Событие уходит с теми полями, что переданы. Без value — уходит без value.
|
|
12
|
+
* @link https://wiki.odkl.ru/pages/viewpage.action?pageId=100892588
|
|
13
|
+
*/
|
|
11
14
|
logEventualStat(params: IEventualStatLog): void;
|
|
15
|
+
/** value — время от метки с тем же именем, что у события. Метки нет — событие не отправляем. */
|
|
16
|
+
logEventualStatSinceMark(params: IEventualStatLog & {
|
|
17
|
+
value?: never;
|
|
18
|
+
}): void;
|
|
12
19
|
destroy(): void;
|
|
13
20
|
private _getCallStatContext;
|
|
14
21
|
private _flushEventualStats;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import BaseApi from '../../abstract/BaseApi';
|
|
2
|
+
/**
|
|
3
|
+
* Поправка часов устройства к серверному времени: delta = Date.now() -
|
|
4
|
+
* serverTime, меряется раз за сессию. Свои записи, сделанные до измерения,
|
|
5
|
+
* получают поправку задним числом.
|
|
6
|
+
*/
|
|
7
|
+
export default abstract class StatClock {
|
|
8
|
+
private static _api;
|
|
9
|
+
private static _delta;
|
|
10
|
+
private static _pending;
|
|
11
|
+
/** Ключи своих записей, ушедших в очередь до измерения. */
|
|
12
|
+
private static _idsAwaitingDelta;
|
|
13
|
+
private static _lastFailureAt;
|
|
14
|
+
static setApi(value: BaseApi): void;
|
|
15
|
+
/** Дельта из кэша, без запроса. null — ещё не измерена. */
|
|
16
|
+
static delta(): number | null;
|
|
17
|
+
/** Запускает измерение, если его ещё нет. Результата не ждёт. */
|
|
18
|
+
static ensure(): void;
|
|
19
|
+
/** Дельта для отправки: измеренная, иначе 0 — время устройства. */
|
|
20
|
+
static get(): Promise<number>;
|
|
21
|
+
/**
|
|
22
|
+
* Вызывается коллектором после записи события без дельты. Ключ приходит
|
|
23
|
+
* после append, поэтому измерение могло закончиться раньше.
|
|
24
|
+
*/
|
|
25
|
+
static noteAppended(id: number): void;
|
|
26
|
+
private static _hasCredentials;
|
|
27
|
+
private static _measure;
|
|
28
|
+
}
|