mirror of
https://github.com/livekit/livekit.git
synced 2026-05-15 18:15:31 +00:00
test
This commit is contained in:
@@ -2146,43 +2146,6 @@ func (p *ParticipantImpl) setIsPublisher(isPublisher bool) {
|
||||
|
||||
// when the server has an offer for participant
|
||||
func (p *ParticipantImpl) onSubscriberOffer(offer webrtc.SessionDescription, offerId uint32) error {
|
||||
if p.ProtocolVersion().SupportsSinglePeerConnection() {
|
||||
parsedOffer, err := offer.Unmarshal()
|
||||
if err != nil {
|
||||
p.pubLogger.Warnw(
|
||||
"could not parse offer", err,
|
||||
"transport", livekit.SignalTarget_PUBLISHER,
|
||||
"offer", offer,
|
||||
"offerId", offerId,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
unmatchAudios, err := p.TransportManager.GetUnmatchMediaForOffer(parsedOffer, "audio")
|
||||
if err != nil {
|
||||
p.subLogger.Warnw("could not get unmatch audios", err)
|
||||
return err
|
||||
}
|
||||
unmatchVideos, _ := p.TransportManager.GetUnmatchMediaForOffer(parsedOffer, "video")
|
||||
if err != nil {
|
||||
p.subLogger.Warnw("could not get unmatch videos", err)
|
||||
return err
|
||||
}
|
||||
parsedOffer = p.setCodecPreferencesForPublisher(parsedOffer, unmatchAudios, unmatchVideos, false)
|
||||
|
||||
// put together munged offer after setting codec preferences
|
||||
bytes, err := parsedOffer.Marshal()
|
||||
if err != nil {
|
||||
p.pubLogger.Errorw("failed to marshal offer", err)
|
||||
return err
|
||||
}
|
||||
|
||||
offer = webrtc.SessionDescription{
|
||||
Type: offer.Type,
|
||||
SDP: string(bytes),
|
||||
}
|
||||
}
|
||||
|
||||
p.subLogger.Debugw(
|
||||
"sending offer",
|
||||
"transport", livekit.SignalTarget_SUBSCRIBER,
|
||||
|
||||
@@ -151,7 +151,7 @@ func (p *ParticipantImpl) setCodecPreferencesForPublisher(
|
||||
parsedOffer *sdp.SessionDescription,
|
||||
unmatchAudios []*sdp.MediaDescription,
|
||||
unmatchVideos []*sdp.MediaDescription,
|
||||
useSdpCid bool,
|
||||
useSdpCid bool, // SINGLE-PEER-CONNECTION-TODO: remove this arg
|
||||
) *sdp.SessionDescription {
|
||||
parsedOffer, unprocessedUnmatchAudios := p.setCodecPreferencesForPublisherMedia(
|
||||
parsedOffer,
|
||||
|
||||
+25
-1
@@ -1058,8 +1058,32 @@ func (t *PCTransport) AddRemoteTrackAndNegotiate(
|
||||
enabledCodecs = append(enabledCodecs, c)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for _, c := range codecs {
|
||||
if mime.IsMimeTypeStringRTX(c.RTPCodecCapability.MimeType) {
|
||||
enabledCodecs = append(enabledCodecs, c)
|
||||
}
|
||||
}
|
||||
}
|
||||
transceiver.SetCodecPreferences(enabledCodecs)
|
||||
|
||||
// arrange enabled by preference in TrackInfo
|
||||
// SINGLE-PEER-CONNECTION-TODO: have to figure out which codec index
|
||||
mimeType := ""
|
||||
if len(ti.Codecs) != 0 {
|
||||
mimeType = ti.Codecs[0].MimeType
|
||||
}
|
||||
preferredCodecs := make([]webrtc.RTPCodecParameters, 0, len(enabledCodecs))
|
||||
leftCodecs := make([]webrtc.RTPCodecParameters, 0, len(enabledCodecs))
|
||||
for _, enabledCodec := range enabledCodecs {
|
||||
if mimeType == "" || mime.NormalizeMimeType(enabledCodec.RTPCodecCapability.MimeType) == mime.NormalizeMimeType(mimeType) {
|
||||
preferredCodecs = append(preferredCodecs, enabledCodec)
|
||||
} else {
|
||||
leftCodecs = append(leftCodecs, enabledCodec)
|
||||
}
|
||||
}
|
||||
transceiver.SetCodecPreferences(append(append([]webrtc.RTPCodecParameters{}, preferredCodecs...), leftCodecs...))
|
||||
// SINGLE-PEER-CONNECTION-TOOD: need to configure stereo for audio codecs
|
||||
// SINGLE-PEER-CONNECTION-TODO: do setCodecPreferencesOpusRedForPublisher for audio
|
||||
|
||||
t.Negotiate(true)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user