Set FEC enabled properly in connection stats module. (#3098)
* Set FEC enabled properly in connection stats module. With RED, the FEC indication is in primary codec. Also, clean up some bits that were not necessary (TrackInfoAvailable is not needed) TODO: There are still a couple of things to figure out - If codec is RED, Opus is added as second codec synthetically using https://github.com/livekit/livekit/blob/33098337fc17705bbdb3283c7a7034aa6b2f3745/pkg/rtc/mediaengine.go#L31 which hard codecs FEC enabled. Ideally, we should get the primary codec parameters from SDP offer. - The WebRTCReceiver does not have information about primary codec. For now, just setting FEC to true when RED is enabled. It is okay as it just affects when we declare quality drops, but ideally the primary codec should be retrieved from SDP offer. * clean up and comment * full prop check
This commit is contained in:
+27
-25
@@ -2750,31 +2750,6 @@ func (p *ParticipantImpl) SupportsTransceiverReuse() bool {
|
||||
return p.ProtocolVersion().SupportsTransceiverReuse() && !p.SupportsSyncStreamID()
|
||||
}
|
||||
|
||||
func codecsFromMediaDescription(m *sdp.MediaDescription) (out []sdp.Codec, err error) {
|
||||
s := &sdp.SessionDescription{
|
||||
MediaDescriptions: []*sdp.MediaDescription{m},
|
||||
}
|
||||
|
||||
for _, payloadStr := range m.MediaName.Formats {
|
||||
payloadType, err := strconv.ParseUint(payloadStr, 10, 8)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
codec, err := s.GetCodecForPayloadType(uint8(payloadType))
|
||||
if err != nil {
|
||||
if payloadType == 0 {
|
||||
continue
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out = append(out, codec)
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) SendDataPacket(kind livekit.DataPacket_Kind, encoded []byte) error {
|
||||
if p.State() != livekit.ParticipantInfo_ACTIVE {
|
||||
return ErrDataChannelUnavailable
|
||||
@@ -2928,3 +2903,30 @@ func (p *ParticipantImpl) HandleMetrics(senderParticipantID livekit.ParticipantI
|
||||
|
||||
return p.TransportManager.SendDataPacket(livekit.DataPacket_RELIABLE, dpData)
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
|
||||
func codecsFromMediaDescription(m *sdp.MediaDescription) (out []sdp.Codec, err error) {
|
||||
s := &sdp.SessionDescription{
|
||||
MediaDescriptions: []*sdp.MediaDescription{m},
|
||||
}
|
||||
|
||||
for _, payloadStr := range m.MediaName.Formats {
|
||||
payloadType, err := strconv.ParseUint(payloadStr, 10, 8)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
codec, err := s.GetCodecForPayloadType(uint8(payloadType))
|
||||
if err != nil {
|
||||
if payloadType == 0 {
|
||||
continue
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out = append(out, codec)
|
||||
}
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
|
||||
"github.com/pion/webrtc/v3"
|
||||
"go.uber.org/atomic"
|
||||
"golang.org/x/exp/slices"
|
||||
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
@@ -126,9 +127,7 @@ func (r *WrappedReceiver) DetermineReceiver(codec webrtc.RTPCodecCapability) boo
|
||||
}
|
||||
|
||||
func (r *WrappedReceiver) Codecs() []webrtc.RTPCodecParameters {
|
||||
codecs := make([]webrtc.RTPCodecParameters, len(r.codecs))
|
||||
copy(codecs, r.codecs)
|
||||
return codecs
|
||||
return slices.Clone(r.codecs)
|
||||
}
|
||||
|
||||
func (r *WrappedReceiver) DeleteDownTrack(participantID livekit.ParticipantID) {
|
||||
|
||||
Reference in New Issue
Block a user