Handle no codecs in track info. (#3859)
* Handle no codecs in track info. Not sure how it happens, but seeing a panic caused by no codecs in track info. Avoiding that and logging information when it happens. * log request
This commit is contained in:
@@ -2741,6 +2741,12 @@ func (p *ParticipantImpl) addPendingTrackLocked(req *livekit.AddTrackRequest) *l
|
|||||||
seenCodecs := make(map[string]struct{})
|
seenCodecs := make(map[string]struct{})
|
||||||
for _, codec := range req.SimulcastCodecs {
|
for _, codec := range req.SimulcastCodecs {
|
||||||
if codec.Codec == "" {
|
if codec.Codec == "" {
|
||||||
|
p.pubLogger.Warnw(
|
||||||
|
"simulcast codec without mime type", nil,
|
||||||
|
"trackID", ti.Sid,
|
||||||
|
"track", logger.Proto(ti),
|
||||||
|
"addTrackRequest", logger.Proto(req),
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,17 @@ func (p *ParticipantImpl) populateSdpCid(parsedOffer *sdp.SessionDescription) ([
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(info.Codecs) == 0 {
|
||||||
|
p.pubLogger.Warnw(
|
||||||
|
"track without codecs", nil,
|
||||||
|
"trackID", info.Sid,
|
||||||
|
"pendingTrack", p.pendingTracks[signalCid],
|
||||||
|
"media", unmatch,
|
||||||
|
"parsedOffer", parsedOffer,
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
found := false
|
found := false
|
||||||
updated := false
|
updated := false
|
||||||
for _, sdpCodec := range sdpCodecs {
|
for _, sdpCodec := range sdpCodecs {
|
||||||
@@ -125,6 +136,12 @@ func (p *ParticipantImpl) populateSdpCid(parsedOffer *sdp.SessionDescription) ([
|
|||||||
|
|
||||||
if updated {
|
if updated {
|
||||||
p.pendingTracks[signalCid].trackInfos[0] = utils.CloneProto(info)
|
p.pendingTracks[signalCid].trackInfos[0] = utils.CloneProto(info)
|
||||||
|
p.pubLogger.Debugw(
|
||||||
|
"pending track SDP cid updated",
|
||||||
|
"signalCid", signalCid,
|
||||||
|
"trackID", info.Sid,
|
||||||
|
"pendingTrack", p.pendingTracks[signalCid],
|
||||||
|
)
|
||||||
}
|
}
|
||||||
p.pendingTracksLock.Unlock()
|
p.pendingTracksLock.Unlock()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user