Fix Roborock support

This commit is contained in:
Alexey Khit
2023-03-21 14:05:10 +03:00
parent cca4f0500e
commit 3002d5f4f1

View File

@@ -111,6 +111,9 @@ func (c *Client) Connect() error {
_ = c.SendICEtoRobot(msg.ToJSON().Candidate, "0")
}
case pion.PeerConnectionState:
if msg == pion.PeerConnectionStateConnecting {
return
}
// unblocking write to channel
select {
case connected <- msg == pion.PeerConnectionStateConnected:
@@ -131,8 +134,9 @@ func (c *Client) Connect() error {
return err
}
log.Printf("[roborock] offer\n%s", pc.LocalDescription().SDP)
if err = c.SendSDPtoRobot(pc.LocalDescription()); err != nil {
offer := pc.LocalDescription()
log.Printf("[roborock] offer\n%s", offer.SDP)
if err = c.SendSDPtoRobot(offer); err != nil {
return err
}