1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 16:45:58 +01:00

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.
This commit is contained in:
Juliusz Chroboczek 2021-08-02 20:00:23 +02:00
parent 816b7a54df
commit 51c31ab729

View file

@ -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
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 {
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 {
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 {
"", "",
) )
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 {
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")