Commit 51c31ab7 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Improve error handling for negotiation failures.

Now that we constrain tracks in offers properly, there is no need
to manually check that the codecs have been matched correctly.
parent 816b7a54
...@@ -618,15 +618,6 @@ func gotAnswer(c *webClient, id string, sdp string) error { ...@@ -618,15 +618,6 @@ func gotAnswer(c *webClient, id string, sdp string) error {
return err return err
} }
for _, t := range down.tracks {
local := t.track.Codec()
remote := t.remote.Codec()
if local.MimeType != remote.MimeType ||
local.ClockRate != remote.ClockRate {
return errors.New("negotiation failed")
}
}
err = down.flushICECandidates() err = down.flushICECandidates()
if err != nil { if err != nil {
log.Printf("ICE: %v", err) log.Printf("ICE: %v", err)
...@@ -1047,7 +1038,7 @@ func pushDownConn(c *webClient, id string, up conn.Up, tracks []conn.UpTrack, re ...@@ -1047,7 +1038,7 @@ func pushDownConn(c *webClient, id string, up conn.Up, tracks []conn.UpTrack, re
err = negotiate(c, down, false, replace) err = negotiate(c, down, false, replace)
if err != nil { if err != nil {
log.Printf("Negotiation failed: %v", err) log.Printf("Negotiation failed: %v", err)
closeDownConn(c, down.id, "negotiation failed") closeDownConn(c, down.id, err.Error())
return err return err
} }
replace = "" replace = ""
...@@ -1419,7 +1410,7 @@ func handleClientMessage(c *webClient, m clientMessage) error { ...@@ -1419,7 +1410,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
err := gotOffer(c, m.Id, m.Label, m.SDP, m.Replace) err := gotOffer(c, m.Id, m.Label, m.SDP, m.Replace)
if err != nil { if err != nil {
log.Printf("gotOffer: %v", err) log.Printf("gotOffer: %v", err)
return failUpConnection(c, m.Id, "negotiation failed") return failUpConnection(c, m.Id, err.Error())
} }
case "answer": case "answer":
if m.Id == "" { if m.Id == "" {
...@@ -1430,7 +1421,7 @@ func handleClientMessage(c *webClient, m clientMessage) error { ...@@ -1430,7 +1421,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
log.Printf("gotAnswer: %v", err) log.Printf("gotAnswer: %v", err)
message := "" message := ""
if err != ErrUnknownId { if err != ErrUnknownId {
message = "negotiation failed" message = err.Error()
} }
return closeDownConn(c, m.Id, message) return closeDownConn(c, m.Id, message)
} }
...@@ -1445,9 +1436,7 @@ func handleClientMessage(c *webClient, m clientMessage) error { ...@@ -1445,9 +1436,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
"", "",
) )
if err != nil { if err != nil {
return closeDownConn( return closeDownConn(c, m.Id, err.Error())
c, m.Id, "negotiation failed",
)
} }
} }
case "renegotiate": case "renegotiate":
...@@ -1458,9 +1447,7 @@ func handleClientMessage(c *webClient, m clientMessage) error { ...@@ -1458,9 +1447,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
if down != nil { if down != nil {
err := negotiate(c, down, true, "") err := negotiate(c, down, true, "")
if err != nil { if err != nil {
return closeDownConn( return closeDownConn(c, m.Id, err.Error())
c, m.Id, "renegotiation failed",
)
} }
} else { } else {
log.Printf("Trying to renegotiate unknown connection") log.Printf("Trying to renegotiate unknown connection")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment