mediasoup-client 3.6.49 → 3.6.52
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/lib/Consumer.d.ts +6 -6
- package/lib/Consumer.d.ts.map +1 -1
- package/lib/Consumer.js +2 -1
- package/lib/DataConsumer.d.ts +4 -4
- package/lib/DataConsumer.d.ts.map +1 -1
- package/lib/DataConsumer.js +2 -1
- package/lib/DataProducer.d.ts +4 -4
- package/lib/DataProducer.d.ts.map +1 -1
- package/lib/DataProducer.js +2 -1
- package/lib/Device.d.ts.map +1 -1
- package/lib/Device.js +8 -4
- package/lib/Producer.d.ts +6 -6
- package/lib/Producer.d.ts.map +1 -1
- package/lib/Producer.js +2 -1
- package/lib/Transport.d.ts +9 -3
- package/lib/Transport.d.ts.map +1 -1
- package/lib/Transport.js +83 -6
- package/lib/handlers/Chrome55.d.ts +2 -2
- package/lib/handlers/Chrome55.d.ts.map +1 -1
- package/lib/handlers/Chrome55.js +7 -3
- package/lib/handlers/Chrome67.d.ts +2 -2
- package/lib/handlers/Chrome67.d.ts.map +1 -1
- package/lib/handlers/Chrome67.js +7 -3
- package/lib/handlers/Chrome70.d.ts +2 -2
- package/lib/handlers/Chrome70.d.ts.map +1 -1
- package/lib/handlers/Chrome70.js +13 -7
- package/lib/handlers/Chrome74.d.ts +2 -2
- package/lib/handlers/Chrome74.d.ts.map +1 -1
- package/lib/handlers/Chrome74.js +27 -17
- package/lib/handlers/Edge11.d.ts +2 -2
- package/lib/handlers/Edge11.d.ts.map +1 -1
- package/lib/handlers/Edge11.js +7 -3
- package/lib/handlers/FakeHandler.d.ts +2 -2
- package/lib/handlers/FakeHandler.d.ts.map +1 -1
- package/lib/handlers/FakeHandler.js +7 -3
- package/lib/handlers/Firefox60.d.ts +2 -2
- package/lib/handlers/Firefox60.d.ts.map +1 -1
- package/lib/handlers/Firefox60.js +27 -17
- package/lib/handlers/HandlerInterface.d.ts +2 -2
- package/lib/handlers/HandlerInterface.d.ts.map +1 -1
- package/lib/handlers/ReactNative.d.ts +2 -2
- package/lib/handlers/ReactNative.d.ts.map +1 -1
- package/lib/handlers/ReactNative.js +7 -3
- package/lib/handlers/Safari11.d.ts +2 -2
- package/lib/handlers/Safari11.d.ts.map +1 -1
- package/lib/handlers/Safari11.js +7 -3
- package/lib/handlers/Safari12.d.ts +2 -2
- package/lib/handlers/Safari12.d.ts.map +1 -1
- package/lib/handlers/Safari12.js +27 -17
- package/lib/handlers/ortc/edgeUtils.js +5 -1
- package/lib/handlers/sdp/MediaSection.js +5 -1
- package/lib/handlers/sdp/RemoteSdp.js +5 -1
- package/lib/handlers/sdp/commonUtils.js +5 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +6 -2
- package/lib/ortc.js +5 -1
- package/lib/types.js +5 -1
- package/package.json +11 -11
- package/src/Consumer.ts +10 -9
- package/src/DataConsumer.ts +7 -6
- package/src/DataProducer.ts +7 -6
- package/src/Device.ts +3 -3
- package/src/Producer.ts +8 -7
- package/src/Transport.ts +120 -13
- package/src/handlers/Chrome55.ts +3 -3
- package/src/handlers/Chrome67.ts +2 -2
- package/src/handlers/Chrome70.ts +9 -6
- package/src/handlers/Chrome74.ts +27 -18
- package/src/handlers/Edge11.ts +2 -2
- package/src/handlers/FakeHandler.ts +2 -2
- package/src/handlers/Firefox60.ts +27 -18
- package/src/handlers/HandlerInterface.ts +2 -2
- package/src/handlers/ReactNative.ts +2 -2
- package/src/handlers/Safari11.ts +2 -2
- package/src/handlers/Safari12.ts +27 -18
- package/.vimrc +0 -21
- package/NO_GIT/Notes.txt +0 -18
package/src/Transport.ts
CHANGED
|
@@ -48,7 +48,7 @@ export type TransportOptions =
|
|
|
48
48
|
iceTransportPolicy?: RTCIceTransportPolicy;
|
|
49
49
|
additionalSettings?: any;
|
|
50
50
|
proprietaryConstraints?: any;
|
|
51
|
-
appData?:
|
|
51
|
+
appData?: Record<string, unknown>;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export type CanProduceByKind =
|
|
@@ -170,7 +170,7 @@ export class Transport extends EnhancedEventEmitter
|
|
|
170
170
|
// Transport connection state.
|
|
171
171
|
private _connectionState: ConnectionState = 'new';
|
|
172
172
|
// App custom data.
|
|
173
|
-
private readonly _appData:
|
|
173
|
+
private readonly _appData: Record<string, unknown>;
|
|
174
174
|
// Map of Producers indexed by id.
|
|
175
175
|
private readonly _producers: Map<string, Producer> = new Map();
|
|
176
176
|
// Map of Consumers indexed by id.
|
|
@@ -187,6 +187,14 @@ export class Transport extends EnhancedEventEmitter
|
|
|
187
187
|
private _pendingConsumerTasks: ConsumerCreationTask[] = [];
|
|
188
188
|
// Consumer creation in progress flag.
|
|
189
189
|
private _consumerCreationInProgress = false;
|
|
190
|
+
// Consumers pending to be paused.
|
|
191
|
+
private _pendingPauseConsumers: Map<string, Consumer> = new Map();
|
|
192
|
+
// Consumer pause in progress flag.
|
|
193
|
+
private _consumerPauseInProgress = false;
|
|
194
|
+
// Consumers pending to be resumed.
|
|
195
|
+
private _pendingResumeConsumers: Map<string, Consumer> = new Map();
|
|
196
|
+
// Consumer resume in progress flag.
|
|
197
|
+
private _consumerResumeInProgress = false;
|
|
190
198
|
// Observer instance.
|
|
191
199
|
protected readonly _observer = new EnhancedEventEmitter();
|
|
192
200
|
|
|
@@ -251,7 +259,7 @@ export class Transport extends EnhancedEventEmitter
|
|
|
251
259
|
extendedRtpCapabilities
|
|
252
260
|
});
|
|
253
261
|
|
|
254
|
-
this._appData = appData;
|
|
262
|
+
this._appData = appData || {};
|
|
255
263
|
|
|
256
264
|
this._handleHandler();
|
|
257
265
|
}
|
|
@@ -299,7 +307,7 @@ export class Transport extends EnhancedEventEmitter
|
|
|
299
307
|
/**
|
|
300
308
|
* App custom data.
|
|
301
309
|
*/
|
|
302
|
-
get appData():
|
|
310
|
+
get appData(): Record<string, unknown>
|
|
303
311
|
{
|
|
304
312
|
return this._appData;
|
|
305
313
|
}
|
|
@@ -307,7 +315,8 @@ export class Transport extends EnhancedEventEmitter
|
|
|
307
315
|
/**
|
|
308
316
|
* Invalid setter.
|
|
309
317
|
*/
|
|
310
|
-
|
|
318
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
319
|
+
set appData(appData: Record<string, unknown>)
|
|
311
320
|
{
|
|
312
321
|
throw new Error('cannot override appData object');
|
|
313
322
|
}
|
|
@@ -892,6 +901,82 @@ export class Transport extends EnhancedEventEmitter
|
|
|
892
901
|
.catch(() => {});
|
|
893
902
|
}
|
|
894
903
|
|
|
904
|
+
_pausePendingConsumers()
|
|
905
|
+
{
|
|
906
|
+
this._awaitQueue.push(
|
|
907
|
+
async () =>
|
|
908
|
+
{
|
|
909
|
+
this._consumerPauseInProgress = true;
|
|
910
|
+
|
|
911
|
+
const pendingPauseConsumers = Array.from(this._pendingPauseConsumers.values());
|
|
912
|
+
|
|
913
|
+
// Clear pending pause Consumer map.
|
|
914
|
+
this._pendingPauseConsumers.clear();
|
|
915
|
+
|
|
916
|
+
try
|
|
917
|
+
{
|
|
918
|
+
await this._handler.pauseReceiving(
|
|
919
|
+
pendingPauseConsumers.map((consumer) => consumer.localId)
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
catch (error)
|
|
923
|
+
{
|
|
924
|
+
logger.error('_pausePendingConsumers() | failed to pause Consumers:', error);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
this._consumerPauseInProgress = false;
|
|
928
|
+
},
|
|
929
|
+
'consumer @pause event')
|
|
930
|
+
.then(() =>
|
|
931
|
+
{
|
|
932
|
+
// There are pending Consumers to be paused, do it.
|
|
933
|
+
if (this._pendingPauseConsumers.size > 0)
|
|
934
|
+
{
|
|
935
|
+
this._pausePendingConsumers();
|
|
936
|
+
}
|
|
937
|
+
})
|
|
938
|
+
// NOTE: We only get here when the await queue is closed.
|
|
939
|
+
.catch(() => { });
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
_resumePendingConsumers()
|
|
943
|
+
{
|
|
944
|
+
this._awaitQueue.push(
|
|
945
|
+
async () =>
|
|
946
|
+
{
|
|
947
|
+
this._consumerResumeInProgress = true;
|
|
948
|
+
|
|
949
|
+
const pendingResumeConsumers = Array.from(this._pendingResumeConsumers.values());
|
|
950
|
+
|
|
951
|
+
// Clear pending resume Consumer map.
|
|
952
|
+
this._pendingResumeConsumers.clear();
|
|
953
|
+
|
|
954
|
+
try
|
|
955
|
+
{
|
|
956
|
+
await this._handler.resumeReceiving(
|
|
957
|
+
pendingResumeConsumers.map((consumer) => consumer.localId)
|
|
958
|
+
);
|
|
959
|
+
}
|
|
960
|
+
catch (error)
|
|
961
|
+
{
|
|
962
|
+
logger.error('_resumePendingConsumers() | failed to resume Consumers:', error);
|
|
963
|
+
}
|
|
964
|
+
},
|
|
965
|
+
'consumer @resume event')
|
|
966
|
+
.then(() =>
|
|
967
|
+
{
|
|
968
|
+
this._consumerResumeInProgress = false;
|
|
969
|
+
|
|
970
|
+
// There are pending Consumer to be resumed, do it.
|
|
971
|
+
if (this._pendingResumeConsumers.size > 0)
|
|
972
|
+
{
|
|
973
|
+
this._resumePendingConsumers();
|
|
974
|
+
}
|
|
975
|
+
})
|
|
976
|
+
// NOTE: We only get here when the await queue is closed.
|
|
977
|
+
.catch(() => { });
|
|
978
|
+
}
|
|
979
|
+
|
|
895
980
|
_handleHandler(): void
|
|
896
981
|
{
|
|
897
982
|
const handler = this._handler;
|
|
@@ -986,6 +1071,8 @@ export class Transport extends EnhancedEventEmitter
|
|
|
986
1071
|
consumer.on('@close', () =>
|
|
987
1072
|
{
|
|
988
1073
|
this._consumers.delete(consumer.id);
|
|
1074
|
+
this._pendingPauseConsumers.delete(consumer.id);
|
|
1075
|
+
this._pendingResumeConsumers.delete(consumer.id);
|
|
989
1076
|
|
|
990
1077
|
if (this._closed)
|
|
991
1078
|
return;
|
|
@@ -998,18 +1085,38 @@ export class Transport extends EnhancedEventEmitter
|
|
|
998
1085
|
|
|
999
1086
|
consumer.on('@pause', () =>
|
|
1000
1087
|
{
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
.
|
|
1088
|
+
// If Consumer is pending to be resumed, remove from pending resume list.
|
|
1089
|
+
if (this._pendingResumeConsumers.has(consumer.id))
|
|
1090
|
+
{
|
|
1091
|
+
this._pendingResumeConsumers.delete(consumer.id);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
// Store the Consumer into the pending list.
|
|
1095
|
+
this._pendingPauseConsumers.set(consumer.id, consumer);
|
|
1096
|
+
|
|
1097
|
+
// There is no Consumer pause in progress, do it now.
|
|
1098
|
+
if (this._consumerPauseInProgress === false)
|
|
1099
|
+
{
|
|
1100
|
+
this._pausePendingConsumers();
|
|
1101
|
+
}
|
|
1005
1102
|
});
|
|
1006
1103
|
|
|
1007
1104
|
consumer.on('@resume', () =>
|
|
1008
1105
|
{
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
.
|
|
1106
|
+
// If Consumer is pending to be paused, remove from pending pause list.
|
|
1107
|
+
if (this._pendingPauseConsumers.has(consumer.id))
|
|
1108
|
+
{
|
|
1109
|
+
this._pendingPauseConsumers.delete(consumer.id);
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
// Store the Consumer into the pending list.
|
|
1113
|
+
this._pendingResumeConsumers.set(consumer.id, consumer);
|
|
1114
|
+
|
|
1115
|
+
// There is no Consumer resume in progress, do it now.
|
|
1116
|
+
if (this._consumerResumeInProgress === false)
|
|
1117
|
+
{
|
|
1118
|
+
this._resumePendingConsumers();
|
|
1119
|
+
}
|
|
1013
1120
|
});
|
|
1014
1121
|
|
|
1015
1122
|
consumer.on('@getstats', (callback, errback) =>
|
package/src/handlers/Chrome55.ts
CHANGED
|
@@ -702,17 +702,17 @@ export class Chrome55 extends HandlerInterface
|
|
|
702
702
|
|
|
703
703
|
await this._pc.setLocalDescription(answer);
|
|
704
704
|
}
|
|
705
|
-
|
|
705
|
+
|
|
706
706
|
async pauseReceiving(
|
|
707
707
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
708
|
-
|
|
708
|
+
localIds: string[]): Promise<void>
|
|
709
709
|
{
|
|
710
710
|
// Unimplemented.
|
|
711
711
|
}
|
|
712
712
|
|
|
713
713
|
async resumeReceiving(
|
|
714
714
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
715
|
-
|
|
715
|
+
localIds: string[]): Promise<void>
|
|
716
716
|
{
|
|
717
717
|
// Unimplemented.
|
|
718
718
|
}
|
package/src/handlers/Chrome67.ts
CHANGED
|
@@ -784,14 +784,14 @@ export class Chrome67 extends HandlerInterface
|
|
|
784
784
|
|
|
785
785
|
async pauseReceiving(
|
|
786
786
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
787
|
-
|
|
787
|
+
localIds: string[]): Promise<void>
|
|
788
788
|
{
|
|
789
789
|
// Unimplemented.
|
|
790
790
|
}
|
|
791
791
|
|
|
792
792
|
async resumeReceiving(
|
|
793
793
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
794
|
-
|
|
794
|
+
localIds: string[]): Promise<void>
|
|
795
795
|
{
|
|
796
796
|
// Unimplemented.
|
|
797
797
|
}
|
package/src/handlers/Chrome70.ts
CHANGED
|
@@ -669,6 +669,7 @@ export class Chrome70 extends HandlerInterface
|
|
|
669
669
|
this._assertRecvDirection();
|
|
670
670
|
|
|
671
671
|
const results: HandlerReceiveResult[] = [];
|
|
672
|
+
const mapLocalId: Map<string, string> = new Map();
|
|
672
673
|
|
|
673
674
|
for (const options of optionsList)
|
|
674
675
|
{
|
|
@@ -678,6 +679,8 @@ export class Chrome70 extends HandlerInterface
|
|
|
678
679
|
|
|
679
680
|
const localId = rtpParameters.mid || String(this._mapMidTransceiver.size);
|
|
680
681
|
|
|
682
|
+
mapLocalId.set(trackId, localId);
|
|
683
|
+
|
|
681
684
|
this._remoteSdp!.receive(
|
|
682
685
|
{
|
|
683
686
|
mid : localId,
|
|
@@ -701,8 +704,8 @@ export class Chrome70 extends HandlerInterface
|
|
|
701
704
|
|
|
702
705
|
for (const options of optionsList)
|
|
703
706
|
{
|
|
704
|
-
const { rtpParameters } = options;
|
|
705
|
-
const localId =
|
|
707
|
+
const { trackId, rtpParameters } = options;
|
|
708
|
+
const localId = mapLocalId.get(trackId);
|
|
706
709
|
const answerMediaObject = localSdpObject.media
|
|
707
710
|
.find((m: any) => String(m.mid) === localId);
|
|
708
711
|
|
|
@@ -734,8 +737,8 @@ export class Chrome70 extends HandlerInterface
|
|
|
734
737
|
|
|
735
738
|
for (const options of optionsList)
|
|
736
739
|
{
|
|
737
|
-
const {
|
|
738
|
-
const localId =
|
|
740
|
+
const { trackId } = options;
|
|
741
|
+
const localId = mapLocalId.get(trackId)!;
|
|
739
742
|
const transceiver = this._pc.getTransceivers()
|
|
740
743
|
.find((t: RTCRtpTransceiver) => t.mid === localId);
|
|
741
744
|
|
|
@@ -789,14 +792,14 @@ export class Chrome70 extends HandlerInterface
|
|
|
789
792
|
|
|
790
793
|
async pauseReceiving(
|
|
791
794
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
792
|
-
|
|
795
|
+
localIds: string[]): Promise<void>
|
|
793
796
|
{
|
|
794
797
|
// Unimplemented.
|
|
795
798
|
}
|
|
796
799
|
|
|
797
800
|
async resumeReceiving(
|
|
798
801
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
799
|
-
|
|
802
|
+
localIds: string[]): Promise<void>
|
|
800
803
|
{
|
|
801
804
|
// Unimplemented.
|
|
802
805
|
}
|
package/src/handlers/Chrome74.ts
CHANGED
|
@@ -655,6 +655,7 @@ export class Chrome74 extends HandlerInterface
|
|
|
655
655
|
this._assertRecvDirection();
|
|
656
656
|
|
|
657
657
|
const results: HandlerReceiveResult[] = [];
|
|
658
|
+
const mapLocalId: Map<string, string> = new Map();
|
|
658
659
|
|
|
659
660
|
for (const options of optionsList)
|
|
660
661
|
{
|
|
@@ -664,6 +665,8 @@ export class Chrome74 extends HandlerInterface
|
|
|
664
665
|
|
|
665
666
|
const localId = rtpParameters.mid || String(this._mapMidTransceiver.size);
|
|
666
667
|
|
|
668
|
+
mapLocalId.set(trackId, localId);
|
|
669
|
+
|
|
667
670
|
this._remoteSdp!.receive(
|
|
668
671
|
{
|
|
669
672
|
mid : localId,
|
|
@@ -687,8 +690,8 @@ export class Chrome74 extends HandlerInterface
|
|
|
687
690
|
|
|
688
691
|
for (const options of optionsList)
|
|
689
692
|
{
|
|
690
|
-
const { rtpParameters } = options;
|
|
691
|
-
const localId =
|
|
693
|
+
const { trackId, rtpParameters } = options;
|
|
694
|
+
const localId = mapLocalId.get(trackId);
|
|
692
695
|
const answerMediaObject = localSdpObject.media
|
|
693
696
|
.find((m: any) => String(m.mid) === localId);
|
|
694
697
|
|
|
@@ -720,8 +723,8 @@ export class Chrome74 extends HandlerInterface
|
|
|
720
723
|
|
|
721
724
|
for (const options of optionsList)
|
|
722
725
|
{
|
|
723
|
-
const {
|
|
724
|
-
const localId =
|
|
726
|
+
const { trackId } = options;
|
|
727
|
+
const localId = mapLocalId.get(trackId)!;
|
|
725
728
|
const transceiver = this._pc.getTransceivers()
|
|
726
729
|
.find((t: RTCRtpTransceiver) => t.mid === localId);
|
|
727
730
|
|
|
@@ -777,19 +780,22 @@ export class Chrome74 extends HandlerInterface
|
|
|
777
780
|
this._mapMidTransceiver.delete(localId);
|
|
778
781
|
}
|
|
779
782
|
|
|
780
|
-
async pauseReceiving(
|
|
783
|
+
async pauseReceiving(localIds: string[]): Promise<void>
|
|
781
784
|
{
|
|
782
785
|
this._assertRecvDirection();
|
|
783
786
|
|
|
784
|
-
|
|
787
|
+
for (const localId of localIds)
|
|
788
|
+
{
|
|
789
|
+
logger.debug('pauseReceiving() [localId:%s]', localId);
|
|
785
790
|
|
|
786
|
-
|
|
791
|
+
const transceiver = this._mapMidTransceiver.get(localId);
|
|
787
792
|
|
|
788
|
-
|
|
789
|
-
|
|
793
|
+
if (!transceiver)
|
|
794
|
+
throw new Error('associated RTCRtpTransceiver not found');
|
|
795
|
+
|
|
796
|
+
transceiver.direction = 'inactive';
|
|
797
|
+
}
|
|
790
798
|
|
|
791
|
-
transceiver.direction = 'inactive';
|
|
792
|
-
|
|
793
799
|
const offer = { type: 'offer', sdp: this._remoteSdp!.getSdp() };
|
|
794
800
|
|
|
795
801
|
logger.debug(
|
|
@@ -807,19 +813,22 @@ export class Chrome74 extends HandlerInterface
|
|
|
807
813
|
await this._pc.setLocalDescription(answer);
|
|
808
814
|
}
|
|
809
815
|
|
|
810
|
-
async resumeReceiving(
|
|
816
|
+
async resumeReceiving(localIds: string[]): Promise<void>
|
|
811
817
|
{
|
|
812
818
|
this._assertRecvDirection();
|
|
813
819
|
|
|
814
|
-
|
|
820
|
+
for (const localId of localIds)
|
|
821
|
+
{
|
|
822
|
+
logger.debug('resumeReceiving() [localId:%s]', localId);
|
|
815
823
|
|
|
816
|
-
|
|
824
|
+
const transceiver = this._mapMidTransceiver.get(localId);
|
|
817
825
|
|
|
818
|
-
|
|
819
|
-
|
|
826
|
+
if (!transceiver)
|
|
827
|
+
throw new Error('associated RTCRtpTransceiver not found');
|
|
828
|
+
|
|
829
|
+
transceiver.direction = 'recvonly';
|
|
830
|
+
}
|
|
820
831
|
|
|
821
|
-
transceiver.direction = 'recvonly';
|
|
822
|
-
|
|
823
832
|
const offer = { type: 'offer', sdp: this._remoteSdp!.getSdp() };
|
|
824
833
|
|
|
825
834
|
logger.debug(
|
package/src/handlers/Edge11.ts
CHANGED
|
@@ -440,14 +440,14 @@ export class Edge11 extends HandlerInterface
|
|
|
440
440
|
|
|
441
441
|
async pauseReceiving(
|
|
442
442
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
443
|
-
|
|
443
|
+
localIds: string[]): Promise<void>
|
|
444
444
|
{
|
|
445
445
|
// Unimplemented.
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
async resumeReceiving(
|
|
449
449
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
450
|
-
|
|
450
|
+
localIds: string[]): Promise<void>
|
|
451
451
|
{
|
|
452
452
|
// Unimplemented.
|
|
453
453
|
}
|
|
@@ -358,14 +358,14 @@ export class FakeHandler extends HandlerInterface
|
|
|
358
358
|
|
|
359
359
|
async pauseReceiving(
|
|
360
360
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
361
|
-
|
|
361
|
+
localIds: string[]): Promise<void>
|
|
362
362
|
{
|
|
363
363
|
// Unimplemented.
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
async resumeReceiving(
|
|
367
367
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
368
|
-
|
|
368
|
+
localIds: string[]): Promise<void>
|
|
369
369
|
{
|
|
370
370
|
// Unimplemented.
|
|
371
371
|
}
|
|
@@ -650,6 +650,7 @@ export class Firefox60 extends HandlerInterface
|
|
|
650
650
|
this._assertRecvDirection();
|
|
651
651
|
|
|
652
652
|
const results: HandlerReceiveResult[] = [];
|
|
653
|
+
const mapLocalId: Map<string, string> = new Map();
|
|
653
654
|
|
|
654
655
|
for (const options of optionsList)
|
|
655
656
|
{
|
|
@@ -659,6 +660,8 @@ export class Firefox60 extends HandlerInterface
|
|
|
659
660
|
|
|
660
661
|
const localId = rtpParameters.mid || String(this._mapMidTransceiver.size);
|
|
661
662
|
|
|
663
|
+
mapLocalId.set(trackId, localId);
|
|
664
|
+
|
|
662
665
|
this._remoteSdp!.receive(
|
|
663
666
|
{
|
|
664
667
|
mid : localId,
|
|
@@ -682,8 +685,8 @@ export class Firefox60 extends HandlerInterface
|
|
|
682
685
|
|
|
683
686
|
for (const options of optionsList)
|
|
684
687
|
{
|
|
685
|
-
const { rtpParameters } = options;
|
|
686
|
-
const localId =
|
|
688
|
+
const { trackId, rtpParameters } = options;
|
|
689
|
+
const localId = mapLocalId.get(trackId);
|
|
687
690
|
const answerMediaObject = localSdpObject.media
|
|
688
691
|
.find((m: any) => String(m.mid) === localId);
|
|
689
692
|
|
|
@@ -709,8 +712,8 @@ export class Firefox60 extends HandlerInterface
|
|
|
709
712
|
|
|
710
713
|
for (const options of optionsList)
|
|
711
714
|
{
|
|
712
|
-
const {
|
|
713
|
-
const localId =
|
|
715
|
+
const { trackId } = options;
|
|
716
|
+
const localId = mapLocalId.get(trackId)!;
|
|
714
717
|
const transceiver = this._pc.getTransceivers()
|
|
715
718
|
.find((t: RTCRtpTransceiver) => t.mid === localId);
|
|
716
719
|
|
|
@@ -762,19 +765,22 @@ export class Firefox60 extends HandlerInterface
|
|
|
762
765
|
this._mapMidTransceiver.delete(localId);
|
|
763
766
|
}
|
|
764
767
|
|
|
765
|
-
async pauseReceiving(
|
|
768
|
+
async pauseReceiving(localIds: string[]): Promise<void>
|
|
766
769
|
{
|
|
767
770
|
this._assertRecvDirection();
|
|
768
771
|
|
|
769
|
-
|
|
772
|
+
for (const localId of localIds)
|
|
773
|
+
{
|
|
774
|
+
logger.debug('pauseReceiving() [localId:%s]', localId);
|
|
770
775
|
|
|
771
|
-
|
|
776
|
+
const transceiver = this._mapMidTransceiver.get(localId);
|
|
772
777
|
|
|
773
|
-
|
|
774
|
-
|
|
778
|
+
if (!transceiver)
|
|
779
|
+
throw new Error('associated RTCRtpTransceiver not found');
|
|
780
|
+
|
|
781
|
+
transceiver.direction = 'inactive';
|
|
782
|
+
}
|
|
775
783
|
|
|
776
|
-
transceiver.direction = 'inactive';
|
|
777
|
-
|
|
778
784
|
const offer = { type: 'offer', sdp: this._remoteSdp!.getSdp() };
|
|
779
785
|
|
|
780
786
|
logger.debug(
|
|
@@ -792,19 +798,22 @@ export class Firefox60 extends HandlerInterface
|
|
|
792
798
|
await this._pc.setLocalDescription(answer);
|
|
793
799
|
}
|
|
794
800
|
|
|
795
|
-
async resumeReceiving(
|
|
801
|
+
async resumeReceiving(localIds: string[]): Promise<void>
|
|
796
802
|
{
|
|
797
803
|
this._assertRecvDirection();
|
|
798
804
|
|
|
799
|
-
|
|
805
|
+
for (const localId of localIds)
|
|
806
|
+
{
|
|
807
|
+
logger.debug('resumeReceiving() [localId:%s]', localId);
|
|
800
808
|
|
|
801
|
-
|
|
809
|
+
const transceiver = this._mapMidTransceiver.get(localId);
|
|
802
810
|
|
|
803
|
-
|
|
804
|
-
|
|
811
|
+
if (!transceiver)
|
|
812
|
+
throw new Error('associated RTCRtpTransceiver not found');
|
|
813
|
+
|
|
814
|
+
transceiver.direction = 'recvonly';
|
|
815
|
+
}
|
|
805
816
|
|
|
806
|
-
transceiver.direction = 'recvonly';
|
|
807
|
-
|
|
808
817
|
const offer = { type: 'offer', sdp: this._remoteSdp!.getSdp() };
|
|
809
818
|
|
|
810
819
|
logger.debug(
|
|
@@ -141,9 +141,9 @@ export abstract class HandlerInterface extends EnhancedEventEmitter
|
|
|
141
141
|
|
|
142
142
|
abstract stopReceiving(localId: string): Promise<void>;
|
|
143
143
|
|
|
144
|
-
abstract pauseReceiving(
|
|
144
|
+
abstract pauseReceiving(localIds: string[]): Promise<void>;
|
|
145
145
|
|
|
146
|
-
abstract resumeReceiving(
|
|
146
|
+
abstract resumeReceiving(localIds: string[]): Promise<void>;
|
|
147
147
|
|
|
148
148
|
abstract getReceiverStats(localId: string): Promise<RTCStatsReport>;
|
|
149
149
|
|
|
@@ -725,14 +725,14 @@ export class ReactNative extends HandlerInterface
|
|
|
725
725
|
|
|
726
726
|
async pauseReceiving(
|
|
727
727
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
728
|
-
|
|
728
|
+
localIds: string[]): Promise<void>
|
|
729
729
|
{
|
|
730
730
|
// Unimplemented.
|
|
731
731
|
}
|
|
732
732
|
|
|
733
733
|
async resumeReceiving(
|
|
734
734
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
735
|
-
|
|
735
|
+
localIds: string[]): Promise<void>
|
|
736
736
|
{
|
|
737
737
|
// Unimplemented.
|
|
738
738
|
}
|
package/src/handlers/Safari11.ts
CHANGED
|
@@ -790,14 +790,14 @@ export class Safari11 extends HandlerInterface
|
|
|
790
790
|
|
|
791
791
|
async pauseReceiving(
|
|
792
792
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
793
|
-
|
|
793
|
+
localIds: string[]): Promise<void>
|
|
794
794
|
{
|
|
795
795
|
// Unimplemented.
|
|
796
796
|
}
|
|
797
797
|
|
|
798
798
|
async resumeReceiving(
|
|
799
799
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
800
|
-
|
|
800
|
+
localIds: string[]): Promise<void>
|
|
801
801
|
{
|
|
802
802
|
// Unimplemented.
|
|
803
803
|
}
|
package/src/handlers/Safari12.ts
CHANGED
|
@@ -609,6 +609,7 @@ export class Safari12 extends HandlerInterface
|
|
|
609
609
|
this._assertRecvDirection();
|
|
610
610
|
|
|
611
611
|
const results: HandlerReceiveResult[] = [];
|
|
612
|
+
const mapLocalId: Map<string, string> = new Map();
|
|
612
613
|
|
|
613
614
|
for (const options of optionsList)
|
|
614
615
|
{
|
|
@@ -618,6 +619,8 @@ export class Safari12 extends HandlerInterface
|
|
|
618
619
|
|
|
619
620
|
const localId = rtpParameters.mid || String(this._mapMidTransceiver.size);
|
|
620
621
|
|
|
622
|
+
mapLocalId.set(trackId, localId);
|
|
623
|
+
|
|
621
624
|
this._remoteSdp!.receive(
|
|
622
625
|
{
|
|
623
626
|
mid : localId,
|
|
@@ -641,8 +644,8 @@ export class Safari12 extends HandlerInterface
|
|
|
641
644
|
|
|
642
645
|
for (const options of optionsList)
|
|
643
646
|
{
|
|
644
|
-
const { rtpParameters } = options;
|
|
645
|
-
const localId =
|
|
647
|
+
const { trackId, rtpParameters } = options;
|
|
648
|
+
const localId = mapLocalId.get(trackId);
|
|
646
649
|
const answerMediaObject = localSdpObject.media
|
|
647
650
|
.find((m: any) => String(m.mid) === localId);
|
|
648
651
|
|
|
@@ -674,8 +677,8 @@ export class Safari12 extends HandlerInterface
|
|
|
674
677
|
|
|
675
678
|
for (const options of optionsList)
|
|
676
679
|
{
|
|
677
|
-
const {
|
|
678
|
-
const localId =
|
|
680
|
+
const { trackId } = options;
|
|
681
|
+
const localId = mapLocalId.get(trackId)!;
|
|
679
682
|
const transceiver = this._pc.getTransceivers()
|
|
680
683
|
.find((t: RTCRtpTransceiver) => t.mid === localId);
|
|
681
684
|
|
|
@@ -727,19 +730,22 @@ export class Safari12 extends HandlerInterface
|
|
|
727
730
|
this._mapMidTransceiver.delete(localId);
|
|
728
731
|
}
|
|
729
732
|
|
|
730
|
-
async pauseReceiving(
|
|
733
|
+
async pauseReceiving(localIds: string[]): Promise<void>
|
|
731
734
|
{
|
|
732
735
|
this._assertRecvDirection();
|
|
733
736
|
|
|
734
|
-
|
|
737
|
+
for (const localId of localIds)
|
|
738
|
+
{
|
|
739
|
+
logger.debug('pauseReceiving() [localId:%s]', localId);
|
|
735
740
|
|
|
736
|
-
|
|
741
|
+
const transceiver = this._mapMidTransceiver.get(localId);
|
|
737
742
|
|
|
738
|
-
|
|
739
|
-
|
|
743
|
+
if (!transceiver)
|
|
744
|
+
throw new Error('associated RTCRtpTransceiver not found');
|
|
745
|
+
|
|
746
|
+
transceiver.direction = 'inactive';
|
|
747
|
+
}
|
|
740
748
|
|
|
741
|
-
transceiver.direction = 'inactive';
|
|
742
|
-
|
|
743
749
|
const offer = { type: 'offer', sdp: this._remoteSdp!.getSdp() };
|
|
744
750
|
|
|
745
751
|
logger.debug(
|
|
@@ -757,19 +763,22 @@ export class Safari12 extends HandlerInterface
|
|
|
757
763
|
await this._pc.setLocalDescription(answer);
|
|
758
764
|
}
|
|
759
765
|
|
|
760
|
-
async resumeReceiving(
|
|
766
|
+
async resumeReceiving(localIds: string[]): Promise<void>
|
|
761
767
|
{
|
|
762
768
|
this._assertRecvDirection();
|
|
763
769
|
|
|
764
|
-
|
|
770
|
+
for (const localId of localIds)
|
|
771
|
+
{
|
|
772
|
+
logger.debug('resumeReceiving() [localId:%s]', localId);
|
|
765
773
|
|
|
766
|
-
|
|
774
|
+
const transceiver = this._mapMidTransceiver.get(localId);
|
|
767
775
|
|
|
768
|
-
|
|
769
|
-
|
|
776
|
+
if (!transceiver)
|
|
777
|
+
throw new Error('associated RTCRtpTransceiver not found');
|
|
778
|
+
|
|
779
|
+
transceiver.direction = 'recvonly';
|
|
780
|
+
}
|
|
770
781
|
|
|
771
|
-
transceiver.direction = 'recvonly';
|
|
772
|
-
|
|
773
782
|
const offer = { type: 'offer', sdp: this._remoteSdp!.getSdp() };
|
|
774
783
|
|
|
775
784
|
logger.debug(
|