Fix webrtc close when it starts from ws

This commit is contained in:
Alexey Khit
2022-08-31 23:09:01 +03:00
parent ac49bbef4d
commit 4f92608f33

View File

@@ -84,8 +84,8 @@ func offerHandler(ctx *api.Context, msg *streamer.Message) {
conn.UserAgent = ctx.Request.UserAgent() conn.UserAgent = ctx.Request.UserAgent()
conn.Listen(func(msg interface{}) { conn.Listen(func(msg interface{}) {
switch msg := msg.(type) { switch msg := msg.(type) {
case streamer.EventType: case pion.PeerConnectionState:
if msg == streamer.StateNull { if msg == pion.PeerConnectionStateClosed {
stream.RemoveConsumer(conn) stream.RemoveConsumer(conn)
} }
case *streamer.Message: case *streamer.Message:
@@ -152,7 +152,7 @@ func ExchangeSDP(
conn.Listen(func(msg interface{}) { conn.Listen(func(msg interface{}) {
switch msg := msg.(type) { switch msg := msg.(type) {
case pion.PeerConnectionState: case pion.PeerConnectionState:
if msg == pion.PeerConnectionStateClosed{ if msg == pion.PeerConnectionStateClosed {
stream.RemoveConsumer(conn) stream.RemoveConsumer(conn)
} }
} }