@@ -1550,8 +1550,11 @@ class RTCSession extends EventManager implements Owner {
1550
1550
}
1551
1551
1552
1552
void _iceRestart () async {
1553
- Map <String , dynamic > offerConstraints =
1554
- _rtcOfferConstraints ?? < String , dynamic > {};
1553
+ Map <String , dynamic > offerConstraints = _rtcOfferConstraints ??
1554
+ < String , dynamic > {
1555
+ 'mandatory' : < String , dynamic > {},
1556
+ 'optional' : < dynamic > [],
1557
+ };
1555
1558
offerConstraints['mandatory' ]['IceRestart' ] = true ;
1556
1559
renegotiate (offerConstraints);
1557
1560
}
@@ -1608,11 +1611,17 @@ class RTCSession extends EventManager implements Owner {
1608
1611
Completer <RTCSessionDescription > completer =
1609
1612
Completer <RTCSessionDescription >();
1610
1613
1614
+ constraints = constraints ??
1615
+ < String , dynamic > {
1616
+ 'mandatory' : < String , dynamic > {},
1617
+ 'optional' : < dynamic > [],
1618
+ };
1619
+
1611
1620
List <Future <RTCSessionDescription > Function (RTCSessionDescription )>
1612
- _modifiers = constraints? ['offerModifiers' ] ??
1621
+ _modifiers = constraints['offerModifiers' ] ??
1613
1622
< Future <RTCSessionDescription > Function (RTCSessionDescription )> [];
1614
1623
1615
- constraints? ['offerModifiers' ] = null ;
1624
+ constraints['offerModifiers' ] = null ;
1616
1625
1617
1626
if (type != 'offer' && type != 'answer' ) {
1618
1627
completer.completeError (Exceptions .TypeError (
@@ -1623,7 +1632,7 @@ class RTCSession extends EventManager implements Owner {
1623
1632
late RTCSessionDescription desc;
1624
1633
if (type == 'offer' ) {
1625
1634
try {
1626
- desc = await _connection! .createOffer (constraints! );
1635
+ desc = await _connection! .createOffer (constraints);
1627
1636
} catch (error) {
1628
1637
logger.e (
1629
1638
'emit "peerconnection:createofferfailed" [error:${error .toString ()}]' );
@@ -1632,7 +1641,7 @@ class RTCSession extends EventManager implements Owner {
1632
1641
}
1633
1642
} else {
1634
1643
try {
1635
- desc = await _connection! .createAnswer (constraints! );
1644
+ desc = await _connection! .createAnswer (constraints);
1636
1645
} catch (error) {
1637
1646
logger.e (
1638
1647
'emit "peerconnection:createanswerfailed" [error:${error .toString ()}]' );
0 commit comments