minor internal refactor
This commit is contained in:
@@ -10,22 +10,22 @@ import '../support/disposable.dart';
|
||||
import '../types/other.dart';
|
||||
import '../utils.dart';
|
||||
|
||||
typedef PCTransportOnOffer = void Function(rtc.RTCSessionDescription offer);
|
||||
typedef TransportOnOffer = void Function(rtc.RTCSessionDescription offer);
|
||||
typedef PeerConnectionCreate = Future<rtc.RTCPeerConnection> Function(
|
||||
Map<String, dynamic> configuration,
|
||||
[Map<String, dynamic> constraints]);
|
||||
|
||||
/// a wrapper around PeerConnection
|
||||
class PCTransport extends Disposable {
|
||||
class Transport extends Disposable {
|
||||
final rtc.RTCPeerConnection pc;
|
||||
final List<rtc.RTCIceCandidate> _pendingCandidates = [];
|
||||
bool restartingIce = false;
|
||||
bool renegotiate = false;
|
||||
PCTransportOnOffer? onOffer;
|
||||
TransportOnOffer? onOffer;
|
||||
Function? _cancelDebounce;
|
||||
|
||||
// private constructor
|
||||
PCTransport._(this.pc) {
|
||||
Transport._(this.pc) {
|
||||
//
|
||||
onDispose(() async {
|
||||
_cancelDebounce?.call();
|
||||
@@ -58,12 +58,12 @@ class PCTransport extends Disposable {
|
||||
});
|
||||
}
|
||||
|
||||
static Future<PCTransport> create(PeerConnectionCreate peerConnectionCreate,
|
||||
static Future<Transport> create(PeerConnectionCreate peerConnectionCreate,
|
||||
[RTCConfiguration? rtcConfig]) async {
|
||||
rtcConfig ??= const RTCConfiguration();
|
||||
logger.fine('[PCTransport] creating ${rtcConfig.toMap()}');
|
||||
final _ = await peerConnectionCreate(rtcConfig.toMap());
|
||||
return PCTransport._(_);
|
||||
return Transport._(_);
|
||||
}
|
||||
|
||||
late final negotiate = Utils.createDebounceFunc(
|
||||
|
||||
Reference in New Issue
Block a user