Restrict negotiation of downstream codecs, allow multiple profiles.
We now restrict the allowable codecs in the downstream direction, which leads to a clean failure instead of a silent track. We also allow multiple profiles for a single codec.
This commit is contained in:
@@ -389,6 +389,26 @@ func addDownTrackUnlocked(conn *rtpDownConnection, remoteTrack *rtpUpTrack, remo
|
||||
return err
|
||||
}
|
||||
|
||||
codec := local.Codec()
|
||||
ptype, err := group.CodecPayloadType(local.Codec())
|
||||
if err != nil {
|
||||
log.Printf("Couldn't determine ptype for codec %v: %v",
|
||||
codec.MimeType, err)
|
||||
} else {
|
||||
err := transceiver.SetCodecPreferences(
|
||||
[]webrtc.RTPCodecParameters{
|
||||
{
|
||||
RTPCodecCapability: codec,
|
||||
PayloadType: ptype,
|
||||
},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
log.Printf("Couldn't set ptype for codec %v: %v",
|
||||
codec.MimeType, err)
|
||||
}
|
||||
}
|
||||
|
||||
parms := transceiver.Sender().GetParameters()
|
||||
if len(parms.Encodings) != 1 {
|
||||
return errors.New("got multiple encodings")
|
||||
|
||||
Reference in New Issue
Block a user