Send DC info for syncState (#88)
* dc private methods * impl * pub * id * fix test
This commit is contained in:
+17
-10
@@ -529,6 +529,7 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
|
||||
answer: answer,
|
||||
subscription: subscription,
|
||||
publishTracks: publishTracks,
|
||||
dataChannelInfo: dataChannelInfo(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -643,7 +644,16 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
|
||||
)));
|
||||
}
|
||||
|
||||
extension EngineInternalMethods on Engine {
|
||||
extension EnginePrivateMethods on Engine {
|
||||
// publisher data channel for the reliability
|
||||
rtc.RTCDataChannel? _publisherDataChannel(Reliability reliability) =>
|
||||
reliability == Reliability.reliable ? _reliableDCPub : _lossyDCPub;
|
||||
|
||||
// state of the publisher data channel
|
||||
rtc.RTCDataChannelState _publisherDataChannelState(Reliability reliability) =>
|
||||
_publisherDataChannel(reliability)?.state ??
|
||||
rtc.RTCDataChannelState.RTCDataChannelClosed;
|
||||
|
||||
void _updateConnectionState(ConnectionState newValue) {
|
||||
if (_connectionState == newValue) return;
|
||||
|
||||
@@ -664,13 +674,10 @@ extension EngineInternalMethods on Engine {
|
||||
}
|
||||
}
|
||||
|
||||
extension EnginePrivateMethods on Engine {
|
||||
// publisher data channel for the reliability
|
||||
rtc.RTCDataChannel? _publisherDataChannel(Reliability reliability) =>
|
||||
reliability == Reliability.reliable ? _reliableDCPub : _lossyDCPub;
|
||||
|
||||
// state of the publisher data channel
|
||||
rtc.RTCDataChannelState _publisherDataChannelState(Reliability reliability) =>
|
||||
_publisherDataChannel(reliability)?.state ??
|
||||
rtc.RTCDataChannelState.RTCDataChannelClosed;
|
||||
extension EngineInternalMethods on Engine {
|
||||
@internal
|
||||
List<lk_rtc.DataChannelInfo> dataChannelInfo() => [
|
||||
_reliableDCPub,
|
||||
_lossyDCPub
|
||||
].whereNotNull().map((e) => e.toLKInfoType()).toList();
|
||||
}
|
||||
|
||||
@@ -352,12 +352,14 @@ extension SignalClientRequests on SignalClient {
|
||||
required lk_rtc.SessionDescription? answer,
|
||||
required lk_rtc.UpdateSubscription subscription,
|
||||
required Iterable<lk_rtc.TrackPublishedResponse>? publishTracks,
|
||||
required Iterable<lk_rtc.DataChannelInfo>? dataChannelInfo,
|
||||
}) =>
|
||||
_sendRequest(lk_rtc.SignalRequest(
|
||||
syncState: lk_rtc.SyncState(
|
||||
answer: answer,
|
||||
subscription: subscription,
|
||||
publishTracks: publishTracks,
|
||||
dataChannels: dataChannelInfo,
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
@@ -53,6 +53,13 @@ extension ReliabilityExt on Reliability {
|
||||
}[this]!;
|
||||
}
|
||||
|
||||
extension RTCDataChannelExt on rtc.RTCDataChannel {
|
||||
lk_rtc.DataChannelInfo toLKInfoType() => lk_rtc.DataChannelInfo(
|
||||
id: id,
|
||||
label: label,
|
||||
);
|
||||
}
|
||||
|
||||
extension RTCIceCandidateExt on rtc.RTCIceCandidate {
|
||||
static rtc.RTCIceCandidate fromJson(String jsonString) {
|
||||
final map = json.decode(jsonString) as Map<String, dynamic>;
|
||||
|
||||
Reference in New Issue
Block a user