@@ -207,14 +207,6 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
207207 lk_models.DataPacket packet,
208208 ) async {
209209 //
210- rtc.RTCDataChannel ? publisherDataChannel (Reliability reliability) =>
211- reliability == Reliability .reliable ? _reliableDCPub : _lossyDCPub;
212-
213- rtc.RTCDataChannelState publisherDataChannelState (
214- Reliability reliability) =>
215- publisherDataChannel (reliability)? .state ??
216- rtc.RTCDataChannelState .RTCDataChannelClosed ;
217-
218210 final reliability = packet.kind.toSDKType ();
219211
220212 // construct the data channel message
@@ -241,7 +233,7 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
241233 }
242234
243235 // wait for data channel to open (if not already)
244- if (publisherDataChannelState (packet.kind.toSDKType ()) !=
236+ if (_publisherDataChannelState (packet.kind.toSDKType ()) !=
245237 rtc.RTCDataChannelState .RTCDataChannelOpen ) {
246238 logger.fine ('Waiting for data channel ${reliability } to open...' );
247239 await events.waitFor <PublisherDataChannelStateUpdatedEvent >(
@@ -252,7 +244,7 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
252244 }
253245
254246 // chose data channel
255- final rtc.RTCDataChannel ? channel = publisherDataChannel (reliability);
247+ final rtc.RTCDataChannel ? channel = _publisherDataChannel (reliability);
256248
257249 if (channel == null ) {
258250 throw UnexpectedStateException (
@@ -679,3 +671,14 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
679671 muted: event.muted,
680672 )));
681673}
674+
675+ extension EnginePrivateMethods on Engine {
676+ // publisher data channel for the reliability
677+ rtc.RTCDataChannel ? _publisherDataChannel (Reliability reliability) =>
678+ reliability == Reliability .reliable ? _reliableDCPub : _lossyDCPub;
679+
680+ // state of the publisher data channel
681+ rtc.RTCDataChannelState _publisherDataChannelState (Reliability reliability) =>
682+ _publisherDataChannel (reliability)? .state ??
683+ rtc.RTCDataChannelState .RTCDataChannelClosed ;
684+ }
0 commit comments