add missing strings.EqualFold for some mimeType comparisons (#2701)

This commit is contained in:
Antti Tapaninen
2024-05-03 23:17:29 -07:00
committed by GitHub
parent 26c2f7cd9a
commit 45ed030ce6
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -469,7 +469,7 @@ func (t *MediaTrackReceiver) AddSubscriber(sub types.LocalParticipant) (types.Su
codec := receiver.Codec()
var found bool
for _, pc := range potentialCodecs {
if codec.MimeType == pc.MimeType {
if strings.EqualFold(codec.MimeType, pc.MimeType) {
found = true
break
}
+3 -2
View File
@@ -16,6 +16,7 @@ package rtc
import (
"errors"
"strings"
"sync"
"github.com/pion/rtcp"
@@ -258,7 +259,7 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
Stereo: info.Stereo,
Red: !info.DisableRed,
}
if addTrackParams.Red && (len(codecs) == 1 && codecs[0].MimeType == webrtc.MimeTypeOpus) {
if addTrackParams.Red && (len(codecs) == 1 && strings.EqualFold(codecs[0].MimeType, webrtc.MimeTypeOpus)) {
addTrackParams.Red = false
}
@@ -354,7 +355,7 @@ func (t *MediaTrackSubscriptions) GetAllSubscribersForMime(mime string) []liveki
subs := make([]livekit.ParticipantID, 0, len(t.subscribedTracks))
for id, subTrack := range t.subscribedTracks {
if subTrack.DownTrack().Codec().MimeType != mime {
if !strings.EqualFold(subTrack.DownTrack().Codec().MimeType, mime) {
continue
}
+1 -1
View File
@@ -90,7 +90,7 @@ func (r *WrappedReceiver) StreamID() string {
func (r *WrappedReceiver) DetermineReceiver(codec webrtc.RTPCodecCapability) {
r.determinedCodec = codec
for _, receiver := range r.receivers {
if c := receiver.Codec(); c.MimeType == codec.MimeType {
if c := receiver.Codec(); strings.EqualFold(c.MimeType, codec.MimeType) {
r.TrackReceiver = receiver
break
} else if strings.EqualFold(c.MimeType, sfu.MimeTypeAudioRed) && strings.EqualFold(codec.MimeType, webrtc.MimeTypeOpus) {