diff --git a/node/src/ActiveSpeakerObserver.ts b/node/src/ActiveSpeakerObserver.ts index 6ff31dcaac..a78d54ed0c 100644 --- a/node/src/ActiveSpeakerObserver.ts +++ b/node/src/ActiveSpeakerObserver.ts @@ -1,13 +1,13 @@ import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import { - ActiveSpeakerObserverInterface, + ActiveSpeakerObserver, ActiveSpeakerObserverDominantSpeaker, ActiveSpeakerObserverEvents, ActiveSpeakerObserverObserver, ActiveSpeakerObserverObserverEvents, } from './ActiveSpeakerObserverTypes'; -import { RtpObserverInterface } from './RtpObserverTypes'; +import { RtpObserver } from './RtpObserverTypes'; import { RtpObserverImpl, RtpObserverConstructorOptions } from './RtpObserver'; import { AppData } from './types'; import { Event, Notification } from './fbs/notification'; @@ -26,7 +26,7 @@ export class ActiveSpeakerObserverImpl< ActiveSpeakerObserverEvents, ActiveSpeakerObserverObserver > - implements RtpObserverInterface, ActiveSpeakerObserverInterface + implements RtpObserver, ActiveSpeakerObserver { /** * @private diff --git a/node/src/ActiveSpeakerObserverTypes.ts b/node/src/ActiveSpeakerObserverTypes.ts index da09eb205a..cd6822053a 100644 --- a/node/src/ActiveSpeakerObserverTypes.ts +++ b/node/src/ActiveSpeakerObserverTypes.ts @@ -1,10 +1,10 @@ import { EnhancedEventEmitter } from './enhancedEvents'; import { - RtpObserverInterface, + RtpObserver, RtpObserverEvents, RtpObserverObserverEvents, } from './RtpObserverTypes'; -import { ProducerInterface } from './ProducerTypes'; +import { Producer } from './ProducerTypes'; import { AppData } from './types'; export type ActiveSpeakerObserverOptions< @@ -22,7 +22,7 @@ export type ActiveSpeakerObserverDominantSpeaker = { /** * The audio Producer instance. */ - producer: ProducerInterface; + producer: Producer; }; export type ActiveSpeakerObserverEvents = RtpObserverEvents & { @@ -36,9 +36,9 @@ export type ActiveSpeakerObserverObserverEvents = RtpObserverObserverEvents & { dominantspeaker: [ActiveSpeakerObserverDominantSpeaker]; }; -export interface ActiveSpeakerObserverInterface< +export interface ActiveSpeakerObserver< ActiveSpeakerObserverAppData extends AppData = AppData, -> extends RtpObserverInterface< +> extends RtpObserver< ActiveSpeakerObserverAppData, ActiveSpeakerObserverEvents, ActiveSpeakerObserverObserver diff --git a/node/src/AudioLevelObserver.ts b/node/src/AudioLevelObserver.ts index a3f09b6133..06e04b8ac2 100644 --- a/node/src/AudioLevelObserver.ts +++ b/node/src/AudioLevelObserver.ts @@ -1,15 +1,15 @@ import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import { - AudioLevelObserverInterface, + AudioLevelObserver, AudioLevelObserverVolume, AudioLevelObserverEvents, AudioLevelObserverObserver, AudioLevelObserverObserverEvents, } from './AudioLevelObserverTypes'; -import { RtpObserverInterface } from './RtpObserverTypes'; +import { RtpObserver } from './RtpObserverTypes'; import { RtpObserverImpl, RtpObserverConstructorOptions } from './RtpObserver'; -import { ProducerInterface } from './ProducerTypes'; +import { Producer } from './ProducerTypes'; import { AppData } from './types'; import * as utils from './utils'; import { Event, Notification } from './fbs/notification'; @@ -28,7 +28,7 @@ export class AudioLevelObserverImpl< AudioLevelObserverEvents, AudioLevelObserverObserver > - implements RtpObserverInterface, AudioLevelObserverInterface + implements RtpObserver, AudioLevelObserver { /** * @private @@ -80,9 +80,7 @@ export class AudioLevelObserverImpl< volume, }) ) - .filter( - ({ producer }: { producer: ProducerInterface }) => producer - ); + .filter(({ producer }: { producer: Producer }) => producer); if (volumes.length > 0) { this.safeEmit('volumes', volumes); diff --git a/node/src/AudioLevelObserverTypes.ts b/node/src/AudioLevelObserverTypes.ts index 92c8f5fac1..ddff9fb985 100644 --- a/node/src/AudioLevelObserverTypes.ts +++ b/node/src/AudioLevelObserverTypes.ts @@ -1,10 +1,10 @@ import { EnhancedEventEmitter } from './enhancedEvents'; import { - RtpObserverInterface, + RtpObserver, RtpObserverEvents, RtpObserverObserverEvents, } from './RtpObserverTypes'; -import { ProducerInterface } from './ProducerTypes'; +import { Producer } from './ProducerTypes'; import { AppData } from './types'; export type AudioLevelObserverOptions< @@ -36,7 +36,7 @@ export type AudioLevelObserverVolume = { /** * The audio Producer instance. */ - producer: ProducerInterface; + producer: Producer; /** * The average volume (in dBvo from -127 to 0) of the audio Producer in the @@ -58,9 +58,9 @@ export type AudioLevelObserverObserverEvents = RtpObserverObserverEvents & { silence: []; }; -export interface AudioLevelObserverInterface< +export interface AudioLevelObserver< AudioLevelObserverAppData extends AppData = AppData, -> extends RtpObserverInterface< +> extends RtpObserver< AudioLevelObserverAppData, AudioLevelObserverEvents, AudioLevelObserverObserver diff --git a/node/src/Consumer.ts b/node/src/Consumer.ts index 5d8422c701..947d477b16 100644 --- a/node/src/Consumer.ts +++ b/node/src/Consumer.ts @@ -1,7 +1,7 @@ import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import { - ConsumerInterface, + Consumer, ConsumerType, ConsumerScore, ConsumerLayers, @@ -60,7 +60,7 @@ const logger = new Logger('Consumer'); export class ConsumerImpl extends EnhancedEventEmitter - implements ConsumerInterface + implements Consumer { // Internal data. readonly #internal: ConsumerInternal; diff --git a/node/src/ConsumerTypes.ts b/node/src/ConsumerTypes.ts index 85a6793309..bc8c1ad0b2 100644 --- a/node/src/ConsumerTypes.ts +++ b/node/src/ConsumerTypes.ts @@ -254,7 +254,7 @@ export type ConsumerObserverEvents = { trace: [ConsumerTraceEventData]; }; -export interface ConsumerInterface +export interface Consumer extends EnhancedEventEmitter { /** * Consumer id. diff --git a/node/src/DataConsumer.ts b/node/src/DataConsumer.ts index f34ae1fe64..dfc5312bed 100644 --- a/node/src/DataConsumer.ts +++ b/node/src/DataConsumer.ts @@ -1,7 +1,7 @@ import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import { - DataConsumerInterface, + DataConsumer, DataConsumerType, DataConsumerDump, DataConsumerStat, @@ -40,7 +40,7 @@ const logger = new Logger('DataConsumer'); export class DataConsumerImpl extends EnhancedEventEmitter - implements DataConsumerInterface + implements DataConsumer { // Internal data. readonly #internal: DataConsumerInternal; diff --git a/node/src/DataConsumerTypes.ts b/node/src/DataConsumerTypes.ts index 2a4c6f6a60..f3f1b175dc 100644 --- a/node/src/DataConsumerTypes.ts +++ b/node/src/DataConsumerTypes.ts @@ -102,9 +102,8 @@ export type DataConsumerObserverEvents = { resume: []; }; -export interface DataConsumerInterface< - DataConsumerAppData extends AppData = AppData, -> extends EnhancedEventEmitter { +export interface DataConsumer + extends EnhancedEventEmitter { /** * DataConsumer id. */ diff --git a/node/src/DataProducer.ts b/node/src/DataProducer.ts index d1f1be3e19..eb068aa0a9 100644 --- a/node/src/DataProducer.ts +++ b/node/src/DataProducer.ts @@ -1,7 +1,7 @@ import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import { - DataProducerInterface, + DataProducer, DataProducerType, DataProducerDump, DataProducerStat, @@ -36,7 +36,7 @@ const logger = new Logger('DataProducer'); export class DataProducerImpl extends EnhancedEventEmitter - implements DataProducerInterface + implements DataProducer { // Internal data. readonly #internal: DataProducerInternal; diff --git a/node/src/DataProducerTypes.ts b/node/src/DataProducerTypes.ts index ab71db3adc..b0dd2eefa8 100644 --- a/node/src/DataProducerTypes.ts +++ b/node/src/DataProducerTypes.ts @@ -75,9 +75,8 @@ export type DataProducerObserverEvents = { resume: []; }; -export interface DataProducerInterface< - DataProducerAppData extends AppData = AppData, -> extends EnhancedEventEmitter { +export interface DataProducer + extends EnhancedEventEmitter { /** * DataProducer id. */ diff --git a/node/src/DirectTransport.ts b/node/src/DirectTransport.ts index 2c005092e3..abc7cd24e3 100644 --- a/node/src/DirectTransport.ts +++ b/node/src/DirectTransport.ts @@ -1,14 +1,14 @@ import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import { - DirectTransportInterface, + DirectTransport, DirectTransportDump, DirectTransportStat, DirectTransportEvents, DirectTransportObserver, DirectTransportObserverEvents, } from './DirectTransportTypes'; -import { TransportInterface, BaseTransportDump } from './TransportTypes'; +import { Transport, BaseTransportDump } from './TransportTypes'; import { TransportImpl, TransportConstructorOptions, @@ -44,7 +44,7 @@ export class DirectTransportImpl< DirectTransportEvents, DirectTransportObserver > - implements TransportInterface, DirectTransportInterface + implements Transport, DirectTransport { // DirectTransport data. // eslint-disable-next-line no-unused-private-class-members diff --git a/node/src/DirectTransportTypes.ts b/node/src/DirectTransportTypes.ts index 4205c0110e..97d7c63b90 100644 --- a/node/src/DirectTransportTypes.ts +++ b/node/src/DirectTransportTypes.ts @@ -1,6 +1,6 @@ import { EnhancedEventEmitter } from './enhancedEvents'; import { - TransportInterface, + Transport, BaseTransportDump, BaseTransportStats, TransportEvents, @@ -40,9 +40,9 @@ export type DirectTransportObserverEvents = TransportObserverEvents & { rtcp: [Buffer]; }; -export interface DirectTransportInterface< +export interface DirectTransport< DirectTransportAppData extends AppData = AppData, -> extends TransportInterface< +> extends Transport< DirectTransportAppData, DirectTransportEvents, DirectTransportObserver diff --git a/node/src/PipeTransport.ts b/node/src/PipeTransport.ts index e92095971e..fc4f0e9ac4 100644 --- a/node/src/PipeTransport.ts +++ b/node/src/PipeTransport.ts @@ -3,7 +3,7 @@ import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import * as ortc from './ortc'; import { - PipeTransportInterface, + PipeTransport, PipeConsumerOptions, PipeTransportDump, PipeTransportStat, @@ -11,11 +11,7 @@ import { PipeTransportObserver, PipeTransportObserverEvents, } from './PipeTransportTypes'; -import { - TransportInterface, - TransportTuple, - SctpState, -} from './TransportTypes'; +import { Transport, TransportTuple, SctpState } from './TransportTypes'; import { TransportImpl, TransportConstructorOptions, @@ -25,8 +21,8 @@ import { parseTuple, parseTransportTraceEventData, } from './Transport'; -import { ProducerInterface } from './ProducerTypes'; -import { ConsumerInterface, ConsumerType } from './ConsumerTypes'; +import { Producer } from './ProducerTypes'; +import { Consumer, ConsumerType } from './ConsumerTypes'; import { ConsumerImpl } from './Consumer'; import { RtpParameters, @@ -63,13 +59,13 @@ export type PipeTransportData = { const logger = new Logger('PipeTransport'); -export class PipeTransport +export class PipeTransportImpl extends TransportImpl< PipeTransportAppData, PipeTransportEvents, PipeTransportObserver > - implements TransportInterface, PipeTransportInterface + implements Transport, PipeTransport { // PipeTransport data. readonly #data: PipeTransportData; @@ -215,9 +211,7 @@ export class PipeTransport async consume({ producerId, appData, - }: PipeConsumerOptions): Promise< - ConsumerInterface - > { + }: PipeConsumerOptions): Promise> { logger.debug('consume()'); if (!producerId || typeof producerId !== 'string') { @@ -268,7 +262,7 @@ export class PipeTransport type: 'pipe' as ConsumerType, }; - const consumer: ConsumerInterface = new ConsumerImpl({ + const consumer: Consumer = new ConsumerImpl({ internal: { ...this.internal, consumerId, @@ -383,7 +377,7 @@ function createConsumeRequest({ }: { builder: flatbuffers.Builder; consumerId: string; - producer: ProducerInterface; + producer: Producer; rtpParameters: RtpParameters; }): number { // Build the request. diff --git a/node/src/PipeTransportTypes.ts b/node/src/PipeTransportTypes.ts index d60ce63ac1..351adaed1f 100644 --- a/node/src/PipeTransportTypes.ts +++ b/node/src/PipeTransportTypes.ts @@ -1,6 +1,6 @@ import { EnhancedEventEmitter } from './enhancedEvents'; import { - TransportInterface, + Transport, TransportListenInfo, TransportListenIp, TransportTuple, @@ -10,7 +10,7 @@ import { TransportEvents, TransportObserverEvents, } from './TransportTypes'; -import { ConsumerInterface } from './ConsumerTypes'; +import { Consumer } from './ConsumerTypes'; import { SrtpParameters } from './SrtpParameters'; import { SctpParameters, NumSctpStreams } from './SctpParameters'; import { Either, AppData } from './types'; @@ -119,9 +119,8 @@ export type PipeTransportObserverEvents = TransportObserverEvents & { sctpstatechange: [SctpState]; }; -export interface PipeTransportInterface< - PipeTransportAppData extends AppData = AppData, -> extends TransportInterface< +export interface PipeTransport + extends Transport< PipeTransportAppData, PipeTransportEvents, PipeTransportObserver @@ -190,7 +189,5 @@ export interface PipeTransportInterface< consume({ producerId, appData, - }: PipeConsumerOptions): Promise< - ConsumerInterface - >; + }: PipeConsumerOptions): Promise>; } diff --git a/node/src/PlainTransport.ts b/node/src/PlainTransport.ts index 9993e79ff8..589cbe7415 100644 --- a/node/src/PlainTransport.ts +++ b/node/src/PlainTransport.ts @@ -2,18 +2,14 @@ import * as flatbuffers from 'flatbuffers'; import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import { - PlainTransportInterface, + PlainTransport, PlainTransportDump, PlainTransportStat, PlainTransportEvents, PlainTransportObserver, PlainTransportObserverEvents, } from './PlainTransportTypes'; -import { - TransportInterface, - TransportTuple, - SctpState, -} from './TransportTypes'; +import { Transport, TransportTuple, SctpState } from './TransportTypes'; import { TransportImpl, TransportConstructorOptions, @@ -58,7 +54,7 @@ export class PlainTransportImpl PlainTransportEvents, PlainTransportObserver > - implements TransportInterface, PlainTransportInterface + implements Transport, PlainTransport { // PlainTransport data. readonly #data: PlainTransportData; diff --git a/node/src/PlainTransportTypes.ts b/node/src/PlainTransportTypes.ts index accc461d26..d4a55833e9 100644 --- a/node/src/PlainTransportTypes.ts +++ b/node/src/PlainTransportTypes.ts @@ -1,6 +1,6 @@ import { EnhancedEventEmitter } from './enhancedEvents'; import { - TransportInterface, + Transport, TransportListenInfo, TransportListenIp, TransportTuple, @@ -131,9 +131,8 @@ export type PlainTransportObserverEvents = TransportObserverEvents & { sctpstatechange: [SctpState]; }; -export interface PlainTransportInterface< - PlainTransportAppData extends AppData = AppData, -> extends TransportInterface< +export interface PlainTransport + extends Transport< PlainTransportAppData, PlainTransportEvents, PlainTransportObserver diff --git a/node/src/Producer.ts b/node/src/Producer.ts index f0f72e9d9e..79ad9a8b34 100644 --- a/node/src/Producer.ts +++ b/node/src/Producer.ts @@ -1,7 +1,7 @@ import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import { - ProducerInterface, + Producer, ProducerType, ProducerScore, ProducerVideoOrientation, @@ -43,7 +43,7 @@ type ProducerData = { export class ProducerImpl extends EnhancedEventEmitter - implements ProducerInterface + implements Producer { // Internal data. readonly #internal: ProducerInternal; diff --git a/node/src/ProducerTypes.ts b/node/src/ProducerTypes.ts index 8eadc1f66d..c6fbd1404e 100644 --- a/node/src/ProducerTypes.ts +++ b/node/src/ProducerTypes.ts @@ -150,7 +150,7 @@ export type ProducerObserverEvents = { trace: [ProducerTraceEventData]; }; -export interface ProducerInterface +export interface Producer extends EnhancedEventEmitter { /** * Producer id. diff --git a/node/src/Router.ts b/node/src/Router.ts index f1aadeed73..8b0f572dea 100644 --- a/node/src/Router.ts +++ b/node/src/Router.ts @@ -4,7 +4,7 @@ import * as ortc from './ortc'; import { InvalidStateError } from './errors'; import { Channel } from './Channel'; import { - RouterInterface, + Router, PipeToRouterOptions, PipeToRouterResult, PipeTransportPair, @@ -14,52 +14,49 @@ import { RouterObserverEvents, } from './RouterTypes'; import { - TransportInterface, + Transport, TransportListenIp, TransportProtocol, } from './TransportTypes'; import { portRangeToFbs, socketFlagsToFbs } from './Transport'; import { - WebRtcTransportInterface, + WebRtcTransport, WebRtcTransportOptions, } from './WebRtcTransportTypes'; import { WebRtcTransportImpl, parseWebRtcTransportDumpResponse, } from './WebRtcTransport'; -import { - PlainTransportInterface, - PlainTransportOptions, -} from './PlainTransportTypes'; +import { PlainTransport, PlainTransportOptions } from './PlainTransportTypes'; import { PlainTransportImpl, parsePlainTransportDumpResponse, } from './PlainTransport'; +import { PipeTransport, PipeTransportOptions } from './PipeTransportTypes'; import { - PipeTransportInterface, - PipeTransportOptions, -} from './PipeTransportTypes'; -import { PipeTransport, parsePipeTransportDumpResponse } from './PipeTransport'; + PipeTransportImpl, + parsePipeTransportDumpResponse, +} from './PipeTransport'; import { - DirectTransportInterface, + DirectTransport, DirectTransportOptions, } from './DirectTransportTypes'; import { DirectTransportImpl, parseDirectTransportDumpResponse, } from './DirectTransport'; -import { ProducerInterface } from './ProducerTypes'; -import { ConsumerInterface } from './ConsumerTypes'; -import { DataProducerInterface } from './DataProducerTypes'; -import { DataConsumerInterface } from './DataConsumerTypes'; -import { RtpObserverInterface } from './RtpObserverTypes'; +import { Producer } from './ProducerTypes'; +import { Consumer } from './ConsumerTypes'; +import { DataProducer } from './DataProducerTypes'; +import { DataConsumer } from './DataConsumerTypes'; +import { RtpObserver } from './RtpObserverTypes'; import { - ActiveSpeakerObserverInterface, + ActiveSpeakerObserver, ActiveSpeakerObserverOptions, } from './ActiveSpeakerObserverTypes'; import { ActiveSpeakerObserverImpl } from './ActiveSpeakerObserver'; import { - AudioLevelObserverInterface, + AudioLevelObserver, AudioLevelObserverOptions, } from './AudioLevelObserverTypes'; import { AudioLevelObserverImpl } from './AudioLevelObserver'; @@ -98,7 +95,7 @@ const logger = new Logger('Router'); export class RouterImpl extends EnhancedEventEmitter - implements RouterInterface + implements Router { // Internal data. readonly #internal: RouterInternal; @@ -116,16 +113,16 @@ export class RouterImpl #appData: RouterAppData; // Transports map. - readonly #transports: Map = new Map(); + readonly #transports: Map = new Map(); // Producers map. - readonly #producers: Map = new Map(); + readonly #producers: Map = new Map(); // RtpObservers map. - readonly #rtpObservers: Map = new Map(); + readonly #rtpObservers: Map = new Map(); // DataProducers map. - readonly #dataProducers: Map = new Map(); + readonly #dataProducers: Map = new Map(); // Map of PipeTransport pair Promises indexed by the id of the Router in // which pipeToRouter() was called. @@ -188,7 +185,7 @@ export class RouterImpl * * @private */ - get transportsForTesting(): Map { + get transportsForTesting(): Map { return this.#transports; } @@ -308,7 +305,7 @@ export class RouterImpl iceConsentTimeout = 30, appData, }: WebRtcTransportOptions): Promise< - WebRtcTransportInterface + WebRtcTransport > { logger.debug('createWebRtcTransport()'); @@ -474,7 +471,7 @@ export class RouterImpl const webRtcTransportData = parseWebRtcTransportDumpResponse(data); - const transport: WebRtcTransportInterface = + const transport: WebRtcTransport = new WebRtcTransportImpl({ internal: { ...this.#internal, @@ -485,12 +482,11 @@ export class RouterImpl appData, getRouterRtpCapabilities: (): RtpCapabilities => this.#data.rtpCapabilities, - getProducerById: (producerId: string): ProducerInterface | undefined => + getProducerById: (producerId: string): Producer | undefined => this.#producers.get(producerId), getDataProducerById: ( dataProducerId: string - ): DataProducerInterface | undefined => - this.#dataProducers.get(dataProducerId), + ): DataProducer | undefined => this.#dataProducers.get(dataProducerId), }); this.#transports.set(transport.id, transport); @@ -498,16 +494,16 @@ export class RouterImpl transport.on('@listenserverclose', () => this.#transports.delete(transport.id) ); - transport.on('@newproducer', (producer: ProducerInterface) => + transport.on('@newproducer', (producer: Producer) => this.#producers.set(producer.id, producer) ); - transport.on('@producerclose', (producer: ProducerInterface) => + transport.on('@producerclose', (producer: Producer) => this.#producers.delete(producer.id) ); - transport.on('@newdataproducer', (dataProducer: DataProducerInterface) => + transport.on('@newdataproducer', (dataProducer: DataProducer) => this.#dataProducers.set(dataProducer.id, dataProducer) ); - transport.on('@dataproducerclose', (dataProducer: DataProducerInterface) => + transport.on('@dataproducerclose', (dataProducer: DataProducer) => this.#dataProducers.delete(dataProducer.id) ); @@ -536,7 +532,7 @@ export class RouterImpl srtpCryptoSuite = 'AES_CM_128_HMAC_SHA1_80', appData, }: PlainTransportOptions): Promise< - PlainTransportInterface + PlainTransport > { logger.debug('createPlainTransport()'); @@ -644,7 +640,7 @@ export class RouterImpl const plainTransportData = parsePlainTransportDumpResponse(data); - const transport: PlainTransportInterface = + const transport: PlainTransport = new PlainTransportImpl({ internal: { ...this.#internal, @@ -655,12 +651,11 @@ export class RouterImpl appData, getRouterRtpCapabilities: (): RtpCapabilities => this.#data.rtpCapabilities, - getProducerById: (producerId: string): ProducerInterface | undefined => + getProducerById: (producerId: string): Producer | undefined => this.#producers.get(producerId), getDataProducerById: ( dataProducerId: string - ): DataProducerInterface | undefined => - this.#dataProducers.get(dataProducerId), + ): DataProducer | undefined => this.#dataProducers.get(dataProducerId), }); this.#transports.set(transport.id, transport); @@ -668,16 +663,16 @@ export class RouterImpl transport.on('@listenserverclose', () => this.#transports.delete(transport.id) ); - transport.on('@newproducer', (producer: ProducerInterface) => + transport.on('@newproducer', (producer: Producer) => this.#producers.set(producer.id, producer) ); - transport.on('@producerclose', (producer: ProducerInterface) => + transport.on('@producerclose', (producer: Producer) => this.#producers.delete(producer.id) ); - transport.on('@newdataproducer', (dataProducer: DataProducerInterface) => + transport.on('@newdataproducer', (dataProducer: DataProducer) => this.#dataProducers.set(dataProducer.id, dataProducer) ); - transport.on('@dataproducerclose', (dataProducer: DataProducerInterface) => + transport.on('@dataproducerclose', (dataProducer: DataProducer) => this.#dataProducers.delete(dataProducer.id) ); @@ -699,7 +694,7 @@ export class RouterImpl enableSrtp = false, appData, }: PipeTransportOptions): Promise< - PipeTransportInterface + PipeTransport > { logger.debug('createPipeTransport()'); @@ -782,8 +777,8 @@ export class RouterImpl const plainTransportData = parsePipeTransportDumpResponse(data); - const transport: PipeTransportInterface = - new PipeTransport({ + const transport: PipeTransport = + new PipeTransportImpl({ internal: { ...this.#internal, transportId, @@ -793,12 +788,11 @@ export class RouterImpl appData, getRouterRtpCapabilities: (): RtpCapabilities => this.#data.rtpCapabilities, - getProducerById: (producerId: string): ProducerInterface | undefined => + getProducerById: (producerId: string): Producer | undefined => this.#producers.get(producerId), getDataProducerById: ( dataProducerId: string - ): DataProducerInterface | undefined => - this.#dataProducers.get(dataProducerId), + ): DataProducer | undefined => this.#dataProducers.get(dataProducerId), }); this.#transports.set(transport.id, transport); @@ -806,16 +800,16 @@ export class RouterImpl transport.on('@listenserverclose', () => this.#transports.delete(transport.id) ); - transport.on('@newproducer', (producer: ProducerInterface) => + transport.on('@newproducer', (producer: Producer) => this.#producers.set(producer.id, producer) ); - transport.on('@producerclose', (producer: ProducerInterface) => + transport.on('@producerclose', (producer: Producer) => this.#producers.delete(producer.id) ); - transport.on('@newdataproducer', (dataProducer: DataProducerInterface) => + transport.on('@newdataproducer', (dataProducer: DataProducer) => this.#dataProducers.set(dataProducer.id, dataProducer) ); - transport.on('@dataproducerclose', (dataProducer: DataProducerInterface) => + transport.on('@dataproducerclose', (dataProducer: DataProducer) => this.#dataProducers.delete(dataProducer.id) ); @@ -832,7 +826,7 @@ export class RouterImpl }: DirectTransportOptions = { maxMessageSize: 262144, } - ): Promise> { + ): Promise> { logger.debug('createDirectTransport()'); if (typeof maxMessageSize !== 'number' || maxMessageSize < 0) { @@ -877,7 +871,7 @@ export class RouterImpl const directTransportData = parseDirectTransportDumpResponse(data); - const transport: DirectTransportInterface = + const transport: DirectTransport = new DirectTransportImpl({ internal: { ...this.#internal, @@ -888,12 +882,11 @@ export class RouterImpl appData, getRouterRtpCapabilities: (): RtpCapabilities => this.#data.rtpCapabilities, - getProducerById: (producerId: string): ProducerInterface | undefined => + getProducerById: (producerId: string): Producer | undefined => this.#producers.get(producerId), getDataProducerById: ( dataProducerId: string - ): DataProducerInterface | undefined => - this.#dataProducers.get(dataProducerId), + ): DataProducer | undefined => this.#dataProducers.get(dataProducerId), }); this.#transports.set(transport.id, transport); @@ -901,16 +894,16 @@ export class RouterImpl transport.on('@listenserverclose', () => this.#transports.delete(transport.id) ); - transport.on('@newproducer', (producer: ProducerInterface) => + transport.on('@newproducer', (producer: Producer) => this.#producers.set(producer.id, producer) ); - transport.on('@producerclose', (producer: ProducerInterface) => + transport.on('@producerclose', (producer: Producer) => this.#producers.delete(producer.id) ); - transport.on('@newdataproducer', (dataProducer: DataProducerInterface) => + transport.on('@newdataproducer', (dataProducer: DataProducer) => this.#dataProducers.set(dataProducer.id, dataProducer) ); - transport.on('@dataproducerclose', (dataProducer: DataProducerInterface) => + transport.on('@dataproducerclose', (dataProducer: DataProducer) => this.#dataProducers.delete(dataProducer.id) ); @@ -966,8 +959,8 @@ export class RouterImpl }; } - let producer: ProducerInterface | undefined; - let dataProducer: DataProducerInterface | undefined; + let producer: Producer | undefined; + let dataProducer: DataProducer | undefined; if (producerId) { producer = this.#producers.get(producerId); @@ -987,8 +980,8 @@ export class RouterImpl let pipeTransportPairPromise = this.#mapRouterPairPipeTransportPairPromise.get(pipeTransportPairKey); let pipeTransportPair: PipeTransportPair; - let localPipeTransport: PipeTransportInterface; - let remotePipeTransport: PipeTransportInterface; + let localPipeTransport: PipeTransport; + let remotePipeTransport: PipeTransport; if (pipeTransportPairPromise) { pipeTransportPair = await pipeTransportPairPromise; @@ -1079,8 +1072,8 @@ export class RouterImpl } if (producer) { - let pipeConsumer: ConsumerInterface | undefined; - let pipeProducer: ProducerInterface | undefined; + let pipeConsumer: Consumer | undefined; + let pipeProducer: Producer | undefined; try { pipeConsumer = await localPipeTransport!.consume({ @@ -1136,8 +1129,8 @@ export class RouterImpl throw error; } } else if (dataProducer) { - let pipeDataConsumer: DataConsumerInterface | undefined; - let pipeDataProducer: DataProducerInterface | undefined; + let pipeDataConsumer: DataConsumer | undefined; + let pipeDataProducer: DataProducer | undefined; try { pipeDataConsumer = await localPipeTransport!.consumeData({ @@ -1220,7 +1213,7 @@ export class RouterImpl interval = 300, appData, }: ActiveSpeakerObserverOptions = {}): Promise< - ActiveSpeakerObserverInterface + ActiveSpeakerObserver > { logger.debug('createActiveSpeakerObserver()'); @@ -1248,7 +1241,7 @@ export class RouterImpl this.#internal.routerId ); - const activeSpeakerObserver: ActiveSpeakerObserverInterface = + const activeSpeakerObserver: ActiveSpeakerObserver = new ActiveSpeakerObserverImpl({ internal: { ...this.#internal, @@ -1256,7 +1249,7 @@ export class RouterImpl }, channel: this.#channel, appData, - getProducerById: (producerId: string): ProducerInterface | undefined => + getProducerById: (producerId: string): Producer | undefined => this.#producers.get(producerId), }); @@ -1279,7 +1272,7 @@ export class RouterImpl interval = 1000, appData, }: AudioLevelObserverOptions = {}): Promise< - AudioLevelObserverInterface + AudioLevelObserver > { logger.debug('createAudioLevelObserver()'); @@ -1321,7 +1314,7 @@ export class RouterImpl this.#internal.routerId ); - const audioLevelObserver: AudioLevelObserverInterface = + const audioLevelObserver: AudioLevelObserver = new AudioLevelObserverImpl({ internal: { ...this.#internal, @@ -1329,7 +1322,7 @@ export class RouterImpl }, channel: this.#channel, appData, - getProducerById: (producerId: string): ProducerInterface | undefined => + getProducerById: (producerId: string): Producer | undefined => this.#producers.get(producerId), }); diff --git a/node/src/RouterTypes.ts b/node/src/RouterTypes.ts index fc0419c7fa..accbd51b11 100644 --- a/node/src/RouterTypes.ts +++ b/node/src/RouterTypes.ts @@ -1,36 +1,30 @@ import { EnhancedEventEmitter } from './enhancedEvents'; import { - TransportInterface, + Transport, TransportListenInfo, TransportListenIp, } from './TransportTypes'; import { - WebRtcTransportInterface, + WebRtcTransport, WebRtcTransportOptions, } from './WebRtcTransportTypes'; +import { PlainTransport, PlainTransportOptions } from './PlainTransportTypes'; +import { PipeTransport, PipeTransportOptions } from './PipeTransportTypes'; import { - PlainTransportInterface, - PlainTransportOptions, -} from './PlainTransportTypes'; -import { - PipeTransportInterface, - PipeTransportOptions, -} from './PipeTransportTypes'; -import { - DirectTransportInterface, + DirectTransport, DirectTransportOptions, } from './DirectTransportTypes'; -import { ProducerInterface } from './ProducerTypes'; -import { ConsumerInterface } from './ConsumerTypes'; -import { DataProducerInterface } from './DataProducerTypes'; -import { DataConsumerInterface } from './DataConsumerTypes'; -import { RtpObserverInterface } from './RtpObserverTypes'; +import { Producer } from './ProducerTypes'; +import { Consumer } from './ConsumerTypes'; +import { DataProducer } from './DataProducerTypes'; +import { DataConsumer } from './DataConsumerTypes'; +import { RtpObserver } from './RtpObserverTypes'; import { - ActiveSpeakerObserverInterface, + ActiveSpeakerObserver, ActiveSpeakerObserverOptions, } from './ActiveSpeakerObserverTypes'; import { - AudioLevelObserverInterface, + AudioLevelObserver, AudioLevelObserverOptions, } from './AudioLevelObserverTypes'; import { RtpCapabilities, RtpCodecCapability } from './RtpParameters'; @@ -63,7 +57,7 @@ export type PipeToRouterOptions = { /** * Target Router instance. */ - router: RouterInterface; + router: Router; /** * Create a SCTP association. Default true. @@ -103,26 +97,26 @@ export type PipeToRouterResult = { /** * The Consumer created in the current Router. */ - pipeConsumer?: ConsumerInterface; + pipeConsumer?: Consumer; /** * The Producer created in the target Router. */ - pipeProducer?: ProducerInterface; + pipeProducer?: Producer; /** * The DataConsumer created in the current Router. */ - pipeDataConsumer?: DataConsumerInterface; + pipeDataConsumer?: DataConsumer; /** * The DataProducer created in the target Router. */ - pipeDataProducer?: DataProducerInterface; + pipeDataProducer?: DataProducer; }; export type PipeTransportPair = { - [key: string]: PipeTransportInterface; + [key: string]: PipeTransport; }; export type RouterDump = { @@ -171,11 +165,11 @@ export type RouterObserver = EnhancedEventEmitter; export type RouterObserverEvents = { close: []; - newtransport: [TransportInterface]; - newrtpobserver: [RtpObserverInterface]; + newtransport: [Transport]; + newrtpobserver: [RtpObserver]; }; -export interface RouterInterface +export interface Router extends EnhancedEventEmitter { /** * Router id. @@ -229,28 +223,28 @@ export interface RouterInterface */ createWebRtcTransport( options: WebRtcTransportOptions - ): Promise>; + ): Promise>; /** * Create a PlainTransport. */ createPlainTransport( options: PlainTransportOptions - ): Promise>; + ): Promise>; /** * Create a PipeTransport. */ createPipeTransport( options: PipeTransportOptions - ): Promise>; + ): Promise>; /** * Create a DirectTransport. */ createDirectTransport( options?: DirectTransportOptions - ): Promise>; + ): Promise>; /** * Pipes the given Producer or DataProducer into another Router in same host. @@ -272,14 +266,14 @@ export interface RouterInterface ActiveSpeakerObserverAppData extends AppData = AppData, >( options?: ActiveSpeakerObserverOptions - ): Promise>; + ): Promise>; /** * Create an AudioLevelObserver. */ createAudioLevelObserver( options?: AudioLevelObserverOptions - ): Promise>; + ): Promise>; /** * Check whether the given RTP capabilities can consume the given Producer. diff --git a/node/src/RtpObserver.ts b/node/src/RtpObserver.ts index e9744be597..9b04126899 100644 --- a/node/src/RtpObserver.ts +++ b/node/src/RtpObserver.ts @@ -3,7 +3,7 @@ import { EnhancedEventEmitter } from './enhancedEvents'; import { RtpObserverEvents, RtpObserverObserver } from './RtpObserverTypes'; import { Channel } from './Channel'; import { RouterInternal } from './Router'; -import { ProducerInterface } from './ProducerTypes'; +import { Producer } from './ProducerTypes'; import { AppData } from './types'; import * as FbsRequest from './fbs/request'; import * as FbsRouter from './fbs/router'; @@ -13,7 +13,7 @@ export type RtpObserverConstructorOptions = { internal: RtpObserverObserverInternal; channel: Channel; appData?: RtpObserverAppData; - getProducerById: (producerId: string) => ProducerInterface | undefined; + getProducerById: (producerId: string) => Producer | undefined; }; type RtpObserverObserverInternal = RouterInternal & { @@ -45,7 +45,7 @@ export abstract class RtpObserverImpl< // Method to retrieve a Producer. protected readonly getProducerById: ( producerId: string - ) => ProducerInterface | undefined; + ) => Producer | undefined; // Observer instance. readonly #observer: Observer; diff --git a/node/src/RtpObserverTypes.ts b/node/src/RtpObserverTypes.ts index d745b57940..15a6bcdad5 100644 --- a/node/src/RtpObserverTypes.ts +++ b/node/src/RtpObserverTypes.ts @@ -1,5 +1,5 @@ import { EnhancedEventEmitter } from './enhancedEvents'; -import { ProducerInterface } from './ProducerTypes'; +import { Producer } from './ProducerTypes'; import { AppData } from './types'; export type RtpObserverEvents = { @@ -16,11 +16,11 @@ export type RtpObserverObserverEvents = { close: []; pause: []; resume: []; - addproducer: [ProducerInterface]; - removeproducer: [ProducerInterface]; + addproducer: [Producer]; + removeproducer: [Producer]; }; -export interface RtpObserverInterface< +export interface RtpObserver< RtpObserverAppData extends AppData = AppData, Events extends RtpObserverEvents = RtpObserverEvents, Observer extends RtpObserverObserver = RtpObserverObserver, diff --git a/node/src/Transport.ts b/node/src/Transport.ts index 4b7a7beae4..8cba700abe 100644 --- a/node/src/Transport.ts +++ b/node/src/Transport.ts @@ -3,7 +3,7 @@ import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import * as ortc from './ortc'; import { - TransportInterface, + Transport, TransportProtocol, TransportPortRange, TransportSocketFlags, @@ -25,21 +25,21 @@ import { WebRtcTransportData } from './WebRtcTransport'; import { PlainTransportData } from './PlainTransport'; import { PipeTransportData } from './PipeTransport'; import { DirectTransportData } from './DirectTransport'; -import { ProducerInterface, ProducerOptions } from './ProducerTypes'; +import { Producer, ProducerOptions } from './ProducerTypes'; import { ProducerImpl, producerTypeFromFbs, producerTypeToFbs, } from './Producer'; import { - ConsumerInterface, + Consumer, ConsumerOptions, ConsumerType, ConsumerLayers, } from './ConsumerTypes'; import { ConsumerImpl } from './Consumer'; import { - DataProducerInterface, + DataProducer, DataProducerOptions, DataProducerType, } from './DataProducerTypes'; @@ -49,7 +49,7 @@ import { parseDataProducerDumpResponse, } from './DataProducer'; import { - DataConsumerInterface, + DataConsumer, DataConsumerOptions, DataConsumerType, } from './DataConsumerTypes'; @@ -90,10 +90,8 @@ export type TransportConstructorOptions = { channel: Channel; appData?: TransportAppData; getRouterRtpCapabilities: () => RtpCapabilities; - getProducerById: (producerId: string) => ProducerInterface | undefined; - getDataProducerById: ( - dataProducerId: string - ) => DataProducerInterface | undefined; + getProducerById: (producerId: string) => Producer | undefined; + getDataProducerById: (dataProducerId: string) => DataProducer | undefined; }; export type TransportInternal = RouterInternal & { @@ -114,7 +112,7 @@ export abstract class TransportImpl< Observer extends TransportObserver = TransportObserver, > extends EnhancedEventEmitter - implements TransportInterface + implements Transport { // Internal data. protected readonly internal: TransportInternal; @@ -137,26 +135,24 @@ export abstract class TransportImpl< // Method to retrieve a Producer. protected readonly getProducerById: ( producerId: string - ) => ProducerInterface | undefined; + ) => Producer | undefined; // Method to retrieve a DataProducer. protected readonly getDataProducerById: ( dataProducerId: string - ) => DataProducerInterface | undefined; + ) => DataProducer | undefined; // Producers map. - readonly #producers: Map = new Map(); + readonly #producers: Map = new Map(); // Consumers map. - protected readonly consumers: Map = new Map(); + protected readonly consumers: Map = new Map(); // DataProducers map. - protected readonly dataProducers: Map = - new Map(); + protected readonly dataProducers: Map = new Map(); // DataConsumers map. - protected readonly dataConsumers: Map = - new Map(); + protected readonly dataConsumers: Map = new Map(); // RTCP CNAME for Producers. #cnameForProducers?: string; @@ -173,10 +169,6 @@ export abstract class TransportImpl< // Observer instance. readonly #observer: Observer; - /** - * @private - * @interface - */ constructor( { internal, @@ -456,9 +448,7 @@ export abstract class TransportImpl< paused = false, keyFrameRequestDelay, appData, - }: ProducerOptions): Promise< - ProducerInterface - > { + }: ProducerOptions): Promise> { logger.debug('produce()'); if (id && this.#producers.has(id)) { @@ -486,7 +476,8 @@ export abstract class TransportImpl< // Don't do this in PipeTransports since there we must keep CNAME value in // each Producer. - if (this.constructor.name !== 'PipeTransport') { + // TODO: This is error prune if we rename the class name. + if (this.constructor.name !== 'PipeTransportImpl') { // If CNAME is given and we don't have yet a CNAME for Producers in this // Transport, take it. if (!this.#cnameForProducers && clonedRtpParameters.rtcp?.cname) { @@ -551,7 +542,7 @@ export abstract class TransportImpl< consumableRtpParameters, }; - const producer: ProducerInterface = new ProducerImpl({ + const producer: Producer = new ProducerImpl({ internal: { ...this.internal, producerId, @@ -586,9 +577,7 @@ export abstract class TransportImpl< enableRtx, pipe = false, appData, - }: ConsumerOptions): Promise< - ConsumerInterface - > { + }: ConsumerOptions): Promise> { logger.debug('consume()'); if (!producerId || typeof producerId !== 'string') { @@ -675,7 +664,7 @@ export abstract class TransportImpl< type: pipe ? 'pipe' : (producer.type as ConsumerType), }; - const consumer: ConsumerInterface = new ConsumerImpl({ + const consumer: Consumer = new ConsumerImpl({ internal: { ...this.internal, consumerId, @@ -712,7 +701,7 @@ export abstract class TransportImpl< paused = false, appData, }: DataProducerOptions = {}): Promise< - DataProducerInterface + DataProducer > { logger.debug('produceData()'); @@ -730,7 +719,8 @@ export abstract class TransportImpl< >(sctpStreamParameters); // If this is not a DirectTransport, sctpStreamParameters are required. - if (this.constructor.name !== 'DirectTransport') { + // TODO: This is error prune if we rename the class name. + if (this.constructor.name !== 'DirectTransportImpl') { type = 'sctp'; // This may throw. @@ -774,7 +764,7 @@ export abstract class TransportImpl< const dump = parseDataProducerDumpResponse(produceDataResponse); - const dataProducer: DataProducerInterface = + const dataProducer: DataProducer = new DataProducerImpl({ internal: { ...this.internal, @@ -814,7 +804,7 @@ export abstract class TransportImpl< subchannels, appData, }: DataConsumerOptions): Promise< - DataConsumerInterface + DataConsumer > { logger.debug('consumeData()'); @@ -836,7 +826,8 @@ export abstract class TransportImpl< // If this is not a DirectTransport, use sctpStreamParameters from the // DataProducer (if type 'sctp') unless they are given in method parameters. - if (this.constructor.name !== 'DirectTransport') { + // TODO: This is error prune if we rename the class name. + if (this.constructor.name !== 'DirectTransportImpl') { type = 'sctp'; sctpStreamParameters = @@ -907,7 +898,7 @@ export abstract class TransportImpl< const dump = parseDataConsumerDumpResponse(consumeDataResponse); - const dataConsumer: DataConsumerInterface = + const dataConsumer: DataConsumer = new DataConsumerImpl({ internal: { ...this.internal, @@ -1333,7 +1324,7 @@ function createConsumeRequest({ pipe, }: { builder: flatbuffers.Builder; - producer: ProducerInterface; + producer: Producer; consumerId: string; rtpParameters: RtpParameters; paused: boolean; diff --git a/node/src/TransportTypes.ts b/node/src/TransportTypes.ts index 0cedbc65fd..dc9ca99c2b 100644 --- a/node/src/TransportTypes.ts +++ b/node/src/TransportTypes.ts @@ -1,14 +1,8 @@ import { EnhancedEventEmitter } from './enhancedEvents'; -import { ProducerInterface, ProducerOptions } from './ProducerTypes'; -import { ConsumerInterface, ConsumerOptions } from './ConsumerTypes'; -import { - DataProducerInterface, - DataProducerOptions, -} from './DataProducerTypes'; -import { - DataConsumerInterface, - DataConsumerOptions, -} from './DataConsumerTypes'; +import { Producer, ProducerOptions } from './ProducerTypes'; +import { Consumer, ConsumerOptions } from './ConsumerTypes'; +import { DataProducer, DataProducerOptions } from './DataProducerTypes'; +import { DataConsumer, DataConsumerOptions } from './DataConsumerTypes'; import { SctpParameters } from './SctpParameters'; import { AppData } from './types'; @@ -231,10 +225,10 @@ export type TransportEvents = { listenererror: [string, Error]; // Private events. '@close': []; - '@newproducer': [ProducerInterface]; - '@producerclose': [ProducerInterface]; - '@newdataproducer': [DataProducerInterface]; - '@dataproducerclose': [DataProducerInterface]; + '@newproducer': [Producer]; + '@producerclose': [Producer]; + '@newdataproducer': [DataProducer]; + '@dataproducerclose': [DataProducer]; '@listenserverclose': []; }; @@ -242,14 +236,14 @@ export type TransportObserver = EnhancedEventEmitter; export type TransportObserverEvents = { close: []; - newproducer: [ProducerInterface]; - newconsumer: [ConsumerInterface]; - newdataproducer: [DataProducerInterface]; - newdataconsumer: [DataConsumerInterface]; + newproducer: [Producer]; + newconsumer: [Consumer]; + newdataproducer: [DataProducer]; + newdataconsumer: [DataConsumer]; trace: [TransportTraceEventData]; }; -export interface TransportInterface< +export interface Transport< TransportAppData extends AppData = AppData, Events extends TransportEvents = TransportEvents, Observer extends TransportObserver = TransportObserver, @@ -358,7 +352,7 @@ export interface TransportInterface< */ produce( options: ProducerOptions - ): Promise>; + ): Promise>; /** * Create a Consumer. @@ -369,21 +363,21 @@ export interface TransportInterface< */ consume( options: ConsumerOptions - ): Promise>; + ): Promise>; /** * Create a DataProducer. */ produceData( options?: DataProducerOptions - ): Promise>; + ): Promise>; /** * Create a DataConsumer. */ consumeData( options: DataConsumerOptions - ): Promise>; + ): Promise>; /** * Enable 'trace' event. diff --git a/node/src/WebRtcServer.ts b/node/src/WebRtcServer.ts index 624f355197..e623c77d8b 100644 --- a/node/src/WebRtcServer.ts +++ b/node/src/WebRtcServer.ts @@ -2,7 +2,7 @@ import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import { Channel } from './Channel'; import { - WebRtcServerInterface, + WebRtcServer, IpPort, IceUserNameFragment, TupleHash, @@ -11,7 +11,7 @@ import { WebRtcServerObserver, WebRtcServerObserverEvents, } from './WebRtcServerTypes'; -import { WebRtcTransportInterface } from './WebRtcTransportTypes'; +import { WebRtcTransport } from './WebRtcTransportTypes'; import { AppData } from './types'; import * as utils from './utils'; import { Body as RequestBody, Method } from './fbs/request'; @@ -26,7 +26,7 @@ const logger = new Logger('WebRtcServer'); export class WebRtcServerImpl extends EnhancedEventEmitter - implements WebRtcServerInterface + implements WebRtcServer { // Internal data. readonly #internal: WebRtcServerInternal; @@ -41,7 +41,7 @@ export class WebRtcServerImpl #appData: WebRtcServerAppData; // Transports map. - readonly #webRtcTransports: Map = new Map(); + readonly #webRtcTransports: Map = new Map(); // Observer instance. readonly #observer: WebRtcServerObserver = @@ -88,7 +88,7 @@ export class WebRtcServerImpl /** * Just for testing purposes. */ - get webRtcTransportsForTesting(): Map { + get webRtcTransportsForTesting(): Map { return this.#webRtcTransports; } @@ -166,7 +166,7 @@ export class WebRtcServerImpl return parseWebRtcServerDump(dump); } - handleWebRtcTransport(webRtcTransport: WebRtcTransportInterface): void { + handleWebRtcTransport(webRtcTransport: WebRtcTransport): void { this.#webRtcTransports.set(webRtcTransport.id, webRtcTransport); // Emit observer event. diff --git a/node/src/WebRtcServerTypes.ts b/node/src/WebRtcServerTypes.ts index 9a8e1e11e3..122c79c404 100644 --- a/node/src/WebRtcServerTypes.ts +++ b/node/src/WebRtcServerTypes.ts @@ -1,6 +1,6 @@ import { EnhancedEventEmitter } from './enhancedEvents'; import { TransportListenInfo } from './TransportTypes'; -import { WebRtcTransportInterface } from './WebRtcTransportTypes'; +import { WebRtcTransport } from './WebRtcTransportTypes'; import { AppData } from './types'; export type WebRtcServerOptions = @@ -57,13 +57,12 @@ export type WebRtcServerObserver = export type WebRtcServerObserverEvents = { close: []; - webrtctransporthandled: [WebRtcTransportInterface]; - webrtctransportunhandled: [WebRtcTransportInterface]; + webrtctransporthandled: [WebRtcTransport]; + webrtctransportunhandled: [WebRtcTransport]; }; -export interface WebRtcServerInterface< - WebRtcServerAppData extends AppData = AppData, -> extends EnhancedEventEmitter { +export interface WebRtcServer + extends EnhancedEventEmitter { /** * WebRtcServer id. */ @@ -109,5 +108,5 @@ export interface WebRtcServerInterface< /** * @private */ - handleWebRtcTransport(webRtcTransport: WebRtcTransportInterface): void; + handleWebRtcTransport(webRtcTransport: WebRtcTransport): void; } diff --git a/node/src/WebRtcTransport.ts b/node/src/WebRtcTransport.ts index 25f1d29854..d216856df8 100644 --- a/node/src/WebRtcTransport.ts +++ b/node/src/WebRtcTransport.ts @@ -2,7 +2,7 @@ import * as flatbuffers from 'flatbuffers'; import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import { - WebRtcTransportInterface, + WebRtcTransport, IceParameters, IceCandidate, DtlsParameters, @@ -20,11 +20,7 @@ import { WebRtcTransportObserver, WebRtcTransportObserverEvents, } from './WebRtcTransportTypes'; -import { - TransportInterface, - TransportTuple, - SctpState, -} from './TransportTypes'; +import { Transport, TransportTuple, SctpState } from './TransportTypes'; import { TransportImpl, TransportConstructorOptions, @@ -78,7 +74,7 @@ export class WebRtcTransportImpl< WebRtcTransportEvents, WebRtcTransportObserver > - implements TransportInterface, WebRtcTransportInterface + implements Transport, WebRtcTransport { // WebRtcTransport data. readonly #data: WebRtcTransportData; diff --git a/node/src/WebRtcTransportTypes.ts b/node/src/WebRtcTransportTypes.ts index b1ef621086..dbb38afd34 100644 --- a/node/src/WebRtcTransportTypes.ts +++ b/node/src/WebRtcTransportTypes.ts @@ -1,6 +1,6 @@ import { EnhancedEventEmitter } from './enhancedEvents'; import { - TransportInterface, + Transport, TransportListenInfo, TransportListenIp, TransportProtocol, @@ -11,7 +11,7 @@ import { TransportEvents, TransportObserverEvents, } from './TransportTypes'; -import { WebRtcServerInterface } from './WebRtcServerTypes'; +import { WebRtcServer } from './WebRtcServerTypes'; import { SctpParameters, NumSctpStreams } from './SctpParameters'; import { Either, AppData } from './types'; @@ -111,7 +111,7 @@ type WebRtcTransportListenServer = { /** * Instance of WebRtcServer. */ - webRtcServer: WebRtcServerInterface; + webRtcServer: WebRtcServer; }; export type IceParameters = { @@ -216,9 +216,9 @@ export type WebRtcTransportObserverEvents = TransportObserverEvents & { sctpstatechange: [SctpState]; }; -export interface WebRtcTransportInterface< +export interface WebRtcTransport< WebRtcTransportAppData extends AppData = AppData, -> extends TransportInterface< +> extends Transport< WebRtcTransportAppData, WebRtcTransportEvents, WebRtcTransportObserver diff --git a/node/src/Worker.ts b/node/src/Worker.ts index 01137e9c21..95d63a0547 100644 --- a/node/src/Worker.ts +++ b/node/src/Worker.ts @@ -6,7 +6,7 @@ import { Logger } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; import * as ortc from './ortc'; import { - WorkerInterface, + Worker, WorkerSettings, WorkerUpdateableSettings, WorkerResourceUsage, @@ -16,12 +16,9 @@ import { WorkerObserverEvents, } from './WorkerTypes'; import { Channel } from './Channel'; -import { - WebRtcServerInterface, - WebRtcServerOptions, -} from './WebRtcServerTypes'; +import { WebRtcServer, WebRtcServerOptions } from './WebRtcServerTypes'; import { WebRtcServerImpl } from './WebRtcServer'; -import { RouterInterface, RouterOptions } from './RouterTypes'; +import { Router, RouterOptions } from './RouterTypes'; import { RouterImpl } from './Router'; import { portRangeToFbs, socketFlagsToFbs } from './Transport'; import { RtpCodecCapability } from './RtpParameters'; @@ -63,7 +60,7 @@ const workerLogger = new Logger('Worker'); export class WorkerImpl extends EnhancedEventEmitter - implements WorkerInterface + implements Worker { // mediasoup-worker child process. #child: ChildProcess; @@ -87,10 +84,10 @@ export class WorkerImpl #appData: WorkerAppData; // WebRtcServers set. - readonly #webRtcServers: Set = new Set(); + readonly #webRtcServers: Set = new Set(); // Routers set. - readonly #routers: Set = new Set(); + readonly #routers: Set = new Set(); // Observer instance. readonly #observer: WorkerObserver = @@ -334,14 +331,14 @@ export class WorkerImpl /** * Just for testing purposes. */ - get webRtcServersForTesting(): Set { + get webRtcServersForTesting(): Set { return this.#webRtcServers; } /** * Just for testing purposes. */ - get routersForTesting(): Set { + get routersForTesting(): Set { return this.#routers; } @@ -447,7 +444,7 @@ export class WorkerImpl listenInfos, appData, }: WebRtcServerOptions): Promise< - WebRtcServerInterface + WebRtcServer > { logger.debug('createWebRtcServer()'); @@ -489,7 +486,7 @@ export class WorkerImpl createWebRtcServerRequestOffset ); - const webRtcServer: WebRtcServerInterface = + const webRtcServer: WebRtcServer = new WebRtcServerImpl({ internal: { webRtcServerId }, channel: this.#channel, @@ -508,9 +505,7 @@ export class WorkerImpl async createRouter({ mediaCodecs, appData, - }: RouterOptions = {}): Promise< - RouterInterface - > { + }: RouterOptions = {}): Promise> { logger.debug('createRouter()'); if (appData && typeof appData !== 'object') { @@ -540,7 +535,7 @@ export class WorkerImpl ); const data = { rtpCapabilities }; - const router: RouterInterface = new RouterImpl({ + const router: Router = new RouterImpl({ internal: { routerId, }, diff --git a/node/src/WorkerTypes.ts b/node/src/WorkerTypes.ts index 5f468c7614..15e7a32b34 100644 --- a/node/src/WorkerTypes.ts +++ b/node/src/WorkerTypes.ts @@ -1,9 +1,6 @@ import { EnhancedEventEmitter } from './enhancedEvents'; -import { - WebRtcServerInterface, - WebRtcServerOptions, -} from './WebRtcServerTypes'; -import { RouterInterface, RouterOptions } from './RouterTypes'; +import { WebRtcServer, WebRtcServerOptions } from './WebRtcServerTypes'; +import { Router, RouterOptions } from './RouterTypes'; import { AppData } from './types'; export type WorkerLogLevel = 'debug' | 'warn' | 'error' | 'none'; @@ -203,11 +200,11 @@ export type WorkerObserver = EnhancedEventEmitter; export type WorkerObserverEvents = { close: []; - newwebrtcserver: [WebRtcServerInterface]; - newrouter: [RouterInterface]; + newwebrtcserver: [WebRtcServer]; + newrouter: [Router]; }; -export interface WorkerInterface +export interface Worker extends EnhancedEventEmitter { /** * Worker process identifier (PID). @@ -271,12 +268,12 @@ export interface WorkerInterface */ createWebRtcServer( options: WebRtcServerOptions - ): Promise>; + ): Promise>; /** * Create a Router. */ createRouter( options?: RouterOptions - ): Promise>; + ): Promise>; } diff --git a/node/src/index.ts b/node/src/index.ts index f5b73483b5..bf3b13137b 100644 --- a/node/src/index.ts +++ b/node/src/index.ts @@ -1,6 +1,6 @@ import { Logger, LoggerEmitter } from './Logger'; import { EnhancedEventEmitter } from './enhancedEvents'; -import { WorkerInterface, WorkerSettings } from './WorkerTypes'; +import { Worker, WorkerSettings } from './WorkerTypes'; import { WorkerImpl, workerBin } from './Worker'; import * as utils from './utils'; import { supportedRtpCapabilities } from './supportedRtpCapabilities'; @@ -27,7 +27,7 @@ export { parse as parseScalabilityMode } from './scalabilityModes'; export type Observer = EnhancedEventEmitter; export type ObserverEvents = { - newworker: [WorkerInterface]; + newworker: [Worker]; }; const observer: Observer = new EnhancedEventEmitter(); @@ -110,16 +110,14 @@ export async function createWorker< libwebrtcFieldTrials, disableLiburing, appData, -}: WorkerSettings = {}): Promise< - WorkerInterface -> { +}: WorkerSettings = {}): Promise> { logger.debug('createWorker()'); if (appData && typeof appData !== 'object') { throw new TypeError('if given, appData must be an object'); } - const worker: WorkerInterface = new WorkerImpl({ + const worker: Worker = new WorkerImpl({ logLevel, logTags, rtcMinPort, diff --git a/node/src/test/test-ActiveSpeakerObserver.ts b/node/src/test/test-ActiveSpeakerObserver.ts index f0d6c04d48..51a8d59190 100644 --- a/node/src/test/test-ActiveSpeakerObserver.ts +++ b/node/src/test/test-ActiveSpeakerObserver.ts @@ -5,8 +5,8 @@ import * as utils from '../utils'; type TestContext = { mediaCodecs: mediasoup.types.RtpCodecCapability[]; - worker?: mediasoup.types.WorkerInterface; - router?: mediasoup.types.RouterInterface; + worker?: mediasoup.types.Worker; + router?: mediasoup.types.Router; }; const ctx: TestContext = { diff --git a/node/src/test/test-AudioLevelObserver.ts b/node/src/test/test-AudioLevelObserver.ts index 4f3f716c0c..f1a1a5fb17 100644 --- a/node/src/test/test-AudioLevelObserver.ts +++ b/node/src/test/test-AudioLevelObserver.ts @@ -5,8 +5,8 @@ import * as utils from '../utils'; type TestContext = { mediaCodecs: mediasoup.types.RtpCodecCapability[]; - worker?: mediasoup.types.WorkerInterface; - router?: mediasoup.types.RouterInterface; + worker?: mediasoup.types.Worker; + router?: mediasoup.types.Router; }; const ctx: TestContext = { diff --git a/node/src/test/test-Consumer.ts b/node/src/test/test-Consumer.ts index e6f90b3492..cc69554cd4 100644 --- a/node/src/test/test-Consumer.ts +++ b/node/src/test/test-Consumer.ts @@ -17,12 +17,12 @@ type TestContext = { audioProducerOptions: mediasoup.types.ProducerOptions; videoProducerOptions: mediasoup.types.ProducerOptions; consumerDeviceCapabilities: mediasoup.types.RtpCapabilities; - worker?: mediasoup.types.WorkerInterface; - router?: mediasoup.types.RouterInterface; - webRtcTransport1?: mediasoup.types.WebRtcTransportInterface; - webRtcTransport2?: mediasoup.types.WebRtcTransportInterface; - audioProducer?: mediasoup.types.ProducerInterface; - videoProducer?: mediasoup.types.ProducerInterface; + worker?: mediasoup.types.Worker; + router?: mediasoup.types.Router; + webRtcTransport1?: mediasoup.types.WebRtcTransport; + webRtcTransport2?: mediasoup.types.WebRtcTransport; + audioProducer?: mediasoup.types.Producer; + videoProducer?: mediasoup.types.Producer; }; const ctx: TestContext = { diff --git a/node/src/test/test-DataConsumer.ts b/node/src/test/test-DataConsumer.ts index 7b3c91a2d0..f61bb8291c 100644 --- a/node/src/test/test-DataConsumer.ts +++ b/node/src/test/test-DataConsumer.ts @@ -5,12 +5,12 @@ import * as utils from '../utils'; type TestContext = { dataProducerOptions: mediasoup.types.DataProducerOptions; - worker?: mediasoup.types.WorkerInterface; - router?: mediasoup.types.RouterInterface; - webRtcTransport1?: mediasoup.types.WebRtcTransportInterface; - webRtcTransport2?: mediasoup.types.WebRtcTransportInterface; - directTransport?: mediasoup.types.DirectTransportInterface; - dataProducer?: mediasoup.types.DataProducerInterface; + worker?: mediasoup.types.Worker; + router?: mediasoup.types.Router; + webRtcTransport1?: mediasoup.types.WebRtcTransport; + webRtcTransport2?: mediasoup.types.WebRtcTransport; + directTransport?: mediasoup.types.DirectTransport; + dataProducer?: mediasoup.types.DataProducer; }; const ctx: TestContext = { diff --git a/node/src/test/test-DataProducer.ts b/node/src/test/test-DataProducer.ts index 61d6394768..4f490792ce 100644 --- a/node/src/test/test-DataProducer.ts +++ b/node/src/test/test-DataProducer.ts @@ -6,10 +6,10 @@ import * as utils from '../utils'; type TestContext = { dataProducerOptions1: mediasoup.types.DataProducerOptions; dataProducerOptions2: mediasoup.types.DataProducerOptions; - worker?: mediasoup.types.WorkerInterface; - router?: mediasoup.types.RouterInterface; - webRtcTransport1?: mediasoup.types.WebRtcTransportInterface; - webRtcTransport2?: mediasoup.types.WebRtcTransportInterface; + worker?: mediasoup.types.Worker; + router?: mediasoup.types.Router; + webRtcTransport1?: mediasoup.types.WebRtcTransport; + webRtcTransport2?: mediasoup.types.WebRtcTransport; }; const ctx: TestContext = { diff --git a/node/src/test/test-DirectTransport.ts b/node/src/test/test-DirectTransport.ts index 2380d96e18..a9f773220d 100644 --- a/node/src/test/test-DirectTransport.ts +++ b/node/src/test/test-DirectTransport.ts @@ -4,8 +4,8 @@ import { DirectTransportEvents } from '../DirectTransportTypes'; import { WorkerEvents } from '../types'; type TestContext = { - worker?: mediasoup.types.WorkerInterface; - router?: mediasoup.types.RouterInterface; + worker?: mediasoup.types.Worker; + router?: mediasoup.types.Router; }; const ctx: TestContext = {}; diff --git a/node/src/test/test-PipeTransport.ts b/node/src/test/test-PipeTransport.ts index 86603da30f..1d7534ac04 100644 --- a/node/src/test/test-PipeTransport.ts +++ b/node/src/test/test-PipeTransport.ts @@ -15,17 +15,17 @@ type TestContext = { videoProducerOptions: mediasoup.types.ProducerOptions; dataProducerOptions: mediasoup.types.DataProducerOptions; consumerDeviceCapabilities: mediasoup.types.RtpCapabilities; - worker1?: mediasoup.types.WorkerInterface; - worker2?: mediasoup.types.WorkerInterface; - router1?: mediasoup.types.RouterInterface; - router2?: mediasoup.types.RouterInterface; - webRtcTransport1?: mediasoup.types.WebRtcTransportInterface; - webRtcTransport2?: mediasoup.types.WebRtcTransportInterface; - audioProducer?: mediasoup.types.ProducerInterface; - videoProducer?: mediasoup.types.ProducerInterface; - videoConsumer?: mediasoup.types.ConsumerInterface; - dataProducer?: mediasoup.types.DataProducerInterface; - dataConsumer?: mediasoup.types.DataConsumerInterface; + worker1?: mediasoup.types.Worker; + worker2?: mediasoup.types.Worker; + router1?: mediasoup.types.Router; + router2?: mediasoup.types.Router; + webRtcTransport1?: mediasoup.types.WebRtcTransport; + webRtcTransport2?: mediasoup.types.WebRtcTransport; + audioProducer?: mediasoup.types.Producer; + videoProducer?: mediasoup.types.Producer; + videoConsumer?: mediasoup.types.Consumer; + dataProducer?: mediasoup.types.DataProducer; + dataConsumer?: mediasoup.types.DataConsumer; }; const ctx: TestContext = { @@ -221,8 +221,8 @@ test('router.pipeToRouter() succeeds with audio', async () => { producerId: ctx.audioProducer!.id, router: ctx.router2!, })) as { - pipeConsumer: mediasoup.types.ConsumerInterface; - pipeProducer: mediasoup.types.ProducerInterface; + pipeConsumer: mediasoup.types.Consumer; + pipeProducer: mediasoup.types.Producer; }; const dump1 = await ctx.router1!.dump(); @@ -336,8 +336,8 @@ test('router.pipeToRouter() succeeds with video', async () => { producerId: ctx.videoProducer!.id, router: ctx.router2!, })) as { - pipeConsumer: mediasoup.types.ConsumerInterface; - pipeProducer: mediasoup.types.ProducerInterface; + pipeConsumer: mediasoup.types.Consumer; + pipeProducer: mediasoup.types.Producer; }; const dump1 = await ctx.router1!.dump(); @@ -937,8 +937,8 @@ test('router.pipeToRouter() succeeds with data', async () => { dataProducerId: ctx.dataProducer!.id, router: ctx.router2!, })) as { - pipeDataConsumer: mediasoup.types.DataConsumerInterface; - pipeDataProducer: mediasoup.types.DataProducerInterface; + pipeDataConsumer: mediasoup.types.DataConsumer; + pipeDataProducer: mediasoup.types.DataProducer; }; const dump1 = await ctx.router1!.dump(); @@ -1081,7 +1081,7 @@ test('router.pipeToRouter() called in two Routers passing one to each other as a const pipeTransportsB = new Map(); routerA.observer.on('newtransport', transport => { - if (transport.constructor.name !== 'PipeTransport') { + if (transport.constructor.name !== 'PipeTransportImpl') { return; } @@ -1090,7 +1090,7 @@ test('router.pipeToRouter() called in two Routers passing one to each other as a }); routerB.observer.on('newtransport', transport => { - if (transport.constructor.name !== 'PipeTransport') { + if (transport.constructor.name !== 'PipeTransportImpl') { return; } diff --git a/node/src/test/test-PlainTransport.ts b/node/src/test/test-PlainTransport.ts index c3c91b3b57..abd7c326b9 100644 --- a/node/src/test/test-PlainTransport.ts +++ b/node/src/test/test-PlainTransport.ts @@ -9,8 +9,8 @@ const IS_WINDOWS = os.platform() === 'win32'; type TestContext = { mediaCodecs: mediasoup.types.RtpCodecCapability[]; - worker?: mediasoup.types.WorkerInterface; - router?: mediasoup.types.RouterInterface; + worker?: mediasoup.types.Worker; + router?: mediasoup.types.Router; }; const ctx: TestContext = { diff --git a/node/src/test/test-Producer.ts b/node/src/test/test-Producer.ts index 0402ce0f6b..3cdeae6ffb 100644 --- a/node/src/test/test-Producer.ts +++ b/node/src/test/test-Producer.ts @@ -16,10 +16,10 @@ type TestContext = { mediaCodecs: mediasoup.types.RtpCodecCapability[]; audioProducerOptions: mediasoup.types.ProducerOptions; videoProducerOptions: mediasoup.types.ProducerOptions; - worker?: mediasoup.types.WorkerInterface; - router?: mediasoup.types.RouterInterface; - webRtcTransport1?: mediasoup.types.WebRtcTransportInterface; - webRtcTransport2?: mediasoup.types.WebRtcTransportInterface; + worker?: mediasoup.types.Worker; + router?: mediasoup.types.Router; + webRtcTransport1?: mediasoup.types.WebRtcTransport; + webRtcTransport2?: mediasoup.types.WebRtcTransport; }; const ctx: TestContext = { diff --git a/node/src/test/test-Router.ts b/node/src/test/test-Router.ts index f584e1dacb..bc79574d9b 100644 --- a/node/src/test/test-Router.ts +++ b/node/src/test/test-Router.ts @@ -7,7 +7,7 @@ import * as utils from '../utils'; type TestContext = { mediaCodecs: mediasoup.types.RtpCodecCapability[]; - worker?: mediasoup.types.WorkerInterface; + worker?: mediasoup.types.Worker; }; const ctx: TestContext = { diff --git a/node/src/test/test-WebRtcServer.ts b/node/src/test/test-WebRtcServer.ts index 10f695af21..2376e6569d 100644 --- a/node/src/test/test-WebRtcServer.ts +++ b/node/src/test/test-WebRtcServer.ts @@ -8,7 +8,7 @@ import { RouterImpl } from '../Router'; import { InvalidStateError } from '../errors'; type TestContext = { - worker?: mediasoup.types.WorkerInterface; + worker?: mediasoup.types.Worker; }; const ctx: TestContext = {}; diff --git a/node/src/test/test-WebRtcTransport.ts b/node/src/test/test-WebRtcTransport.ts index bba38bd7c2..8fad39909e 100644 --- a/node/src/test/test-WebRtcTransport.ts +++ b/node/src/test/test-WebRtcTransport.ts @@ -17,8 +17,8 @@ import * as FbsWebRtcTransport from '../fbs/web-rtc-transport'; type TestContext = { mediaCodecs: mediasoup.types.RtpCodecCapability[]; - worker?: mediasoup.types.WorkerInterface; - router?: mediasoup.types.RouterInterface; + worker?: mediasoup.types.Worker; + router?: mediasoup.types.Router; }; const ctx: TestContext = { diff --git a/node/src/test/test-Worker.ts b/node/src/test/test-Worker.ts index b9e9a1ec16..a00ba79fb0 100644 --- a/node/src/test/test-Worker.ts +++ b/node/src/test/test-Worker.ts @@ -43,7 +43,7 @@ test('createWorker() succeeds', async () => { expect(onObserverNewWorker).toHaveBeenCalledTimes(1); expect(onObserverNewWorker).toHaveBeenCalledWith(worker1); - expect(worker1.constructor.name).toBe('Worker'); + expect(worker1.constructor.name).toBe('WorkerImpl'); expect(typeof worker1.pid).toBe('number'); expect(worker1.closed).toBe(false); expect(worker1.died).toBe(false); @@ -67,7 +67,7 @@ test('createWorker() succeeds', async () => { appData: { foo: 456 }, }); - expect(worker2.constructor.name).toBe('Worker'); + expect(worker2.constructor.name).toBe('WorkerImpl'); expect(typeof worker2.pid).toBe('number'); expect(worker2.closed).toBe(false); expect(worker2.died).toBe(false); diff --git a/node/src/test/test-multiopus.ts b/node/src/test/test-multiopus.ts index 22b9484cc0..4b8ab50450 100644 --- a/node/src/test/test-multiopus.ts +++ b/node/src/test/test-multiopus.ts @@ -8,9 +8,9 @@ type TestContext = { mediaCodecs: mediasoup.types.RtpCodecCapability[]; audioProducerOptions: mediasoup.types.ProducerOptions; consumerDeviceCapabilities: mediasoup.types.RtpCapabilities; - worker?: mediasoup.types.WorkerInterface; - router?: mediasoup.types.RouterInterface; - webRtcTransport?: mediasoup.types.WebRtcTransportInterface; + worker?: mediasoup.types.Worker; + router?: mediasoup.types.Router; + webRtcTransport?: mediasoup.types.WebRtcTransport; }; const ctx: TestContext = { diff --git a/node/src/test/test-node-sctp.ts b/node/src/test/test-node-sctp.ts index cb4fb14f64..e344c1a484 100644 --- a/node/src/test/test-node-sctp.ts +++ b/node/src/test/test-node-sctp.ts @@ -6,11 +6,11 @@ import { enhancedOnce } from '../enhancedEvents'; import { WorkerEvents } from '../types'; type TestContext = { - worker?: mediasoup.types.WorkerInterface; - router?: mediasoup.types.RouterInterface; - plainTransport?: mediasoup.types.PlainTransportInterface; - dataProducer?: mediasoup.types.DataProducerInterface; - dataConsumer?: mediasoup.types.DataConsumerInterface; + worker?: mediasoup.types.Worker; + router?: mediasoup.types.Router; + plainTransport?: mediasoup.types.PlainTransport; + dataProducer?: mediasoup.types.DataProducer; + dataConsumer?: mediasoup.types.DataConsumer; udpSocket?: dgram.Socket; sctpSocket?: any; sctpSendStreamId?: number;