mirror of
https://github.com/livekit/livekit.git
synced 2026-07-17 18:32:03 +00:00
clean up
This commit is contained in:
+14
-1
@@ -2874,10 +2874,12 @@ func (p *ParticipantImpl) addPendingTrackLocked(req *livekit.AddTrackRequest) *l
|
||||
}
|
||||
|
||||
p.params.Telemetry.TrackPublishRequested(context.Background(), p.ID(), p.Identity(), utils.CloneProto(ti))
|
||||
|
||||
if p.supervisor != nil {
|
||||
p.supervisor.AddPublication(livekit.TrackID(ti.Sid))
|
||||
p.supervisor.SetPublicationMute(livekit.TrackID(ti.Sid), ti.Muted)
|
||||
}
|
||||
|
||||
if p.getPublishedTrackBySignalCid(req.Cid) != nil || p.getPublishedTrackBySdpCid(req.Cid) != nil || p.pendingTracks[req.Cid] != nil {
|
||||
if p.pendingTracks[req.Cid] == nil {
|
||||
p.pendingTracks[req.Cid] = &pendingTrackInfo{
|
||||
@@ -3737,7 +3739,18 @@ func (p *ParticipantImpl) setupEnabledCodecs(publishEnabledCodecs []*livekit.Cod
|
||||
subscribeCodecs = append(subscribeCodecs, c)
|
||||
}
|
||||
p.enabledSubscribeCodecs = subscribeCodecs
|
||||
p.params.Logger.Debugw("setup enabled codecs", "publish", p.enabledPublishCodecs, "subscribe", p.enabledSubscribeCodecs, "disabled", disabledCodecs)
|
||||
p.params.Logger.Debugw(
|
||||
"setup enabled codecs",
|
||||
"publish", p.enabledPublishCodecs,
|
||||
"subscribe", p.enabledSubscribeCodecs,
|
||||
"disabled", disabledCodecs,
|
||||
)
|
||||
p.params.Logger.Infow(
|
||||
"setup enabled codecs",
|
||||
"publish", p.enabledPublishCodecs,
|
||||
"subscribe", p.enabledSubscribeCodecs,
|
||||
"disabled", disabledCodecs,
|
||||
) // REMOVE
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) replayJoiningReliableMessages() {
|
||||
|
||||
@@ -25,7 +25,6 @@ import (
|
||||
"github.com/livekit/livekit-server/pkg/rtc/types"
|
||||
"github.com/livekit/livekit-server/pkg/sfu/mime"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
lksdp "github.com/livekit/protocol/sdp"
|
||||
"github.com/livekit/protocol/utils"
|
||||
)
|
||||
@@ -311,7 +310,6 @@ func (p *ParticipantImpl) setCodecPreferencesForPublisherMedia(
|
||||
if mimeType == "" && len(ti.Codecs) > 0 {
|
||||
mimeType = ti.Codecs[0].MimeType
|
||||
}
|
||||
p.params.Logger.Infow("RAJA mimeType", "mimeType", mimeType, "track", logger.Proto(ti)) // REMOVE
|
||||
|
||||
if mimeType == "" {
|
||||
unprocessed = append(unprocessed, unmatch)
|
||||
@@ -350,8 +348,12 @@ func (p *ParticipantImpl) setCodecPreferencesForPublisherMedia(
|
||||
if trackType == livekit.TrackType_VIDEO {
|
||||
// if the client don't comply with codec order in SDP answer, only keep preferred codecs to force client to use it
|
||||
if p.params.ClientInfo.ComplyWithCodecOrderInSDPAnswer() {
|
||||
p.pubLogger.Infow("complying with codec order") // REMOVE
|
||||
unmatch.MediaName.Formats = append(unmatch.MediaName.Formats, leftCodecs...)
|
||||
} else {
|
||||
p.pubLogger.Infow("not complying with codec order") // REMOVE
|
||||
}
|
||||
p.pubLogger.Infow("formats", "formats", unmatch.MediaName.Formats) // REMOVE
|
||||
} else {
|
||||
// ensure nack enabled for audio in publisher offer
|
||||
var nackFound bool
|
||||
@@ -371,8 +373,7 @@ func (p *ParticipantImpl) setCodecPreferencesForPublisherMedia(
|
||||
unmatch.MediaName.Formats = append(unmatch.MediaName.Formats, leftCodecs...)
|
||||
}
|
||||
|
||||
// RAJA-TODO: can set mid in TrackInfo before sending offer and check on receiving answer to set SdpCid
|
||||
// RAJA-TODO: Have to check which simulcast codec is not published
|
||||
// SINGLE-PEER-CONNECTION-TODO: can set mid in TrackInfo before sending offer and check on receiving answer to set SdpCid
|
||||
}
|
||||
|
||||
return parsedOffer, unprocessed
|
||||
|
||||
+17
-23
@@ -71,14 +71,15 @@ func (h TransportManagerTransportHandler) OnFailed(isShortLived bool, iceConnect
|
||||
|
||||
// -------------------------------
|
||||
|
||||
/* RAJA-REMOVE
|
||||
type TransportManagerPublisherTransportHandler struct {
|
||||
TransportManagerTransportHandler
|
||||
}
|
||||
|
||||
func (h TransportManagerPublisherTransportHandler) OnAnswer(sd webrtc.SessionDescription, answerId uint32) error {
|
||||
h.t.lastPublisherAnswer.Store(sd)
|
||||
return h.Handler.OnAnswer(sd, answerId)
|
||||
}
|
||||
*/
|
||||
|
||||
// -------------------------------
|
||||
|
||||
@@ -126,9 +127,8 @@ type TransportManager struct {
|
||||
pendingOfferIdPublisher uint32
|
||||
pendingDataChannelsPublisher []*livekit.DataChannelInfo
|
||||
// RAJA-TODO: check if this can be gotten from peer connection directly
|
||||
lastPublisherAnswer atomic.Value
|
||||
lastPublisherOffer atomic.Value
|
||||
iceConfig *livekit.ICEConfig
|
||||
lastPublisherOffer atomic.Value
|
||||
iceConfig *livekit.ICEConfig
|
||||
|
||||
mediaLossProxy *MediaLossProxy
|
||||
udpLossUnstableCount uint32
|
||||
@@ -153,17 +153,18 @@ func NewTransportManager(params TransportManagerParams) (*TransportManager, erro
|
||||
if t.params.UseOneShotSignallingMode || !t.params.SinglePeerConnection {
|
||||
lgr := LoggerWithPCTarget(params.Logger, livekit.SignalTarget_PUBLISHER)
|
||||
publisher, err := NewPCTransport(TransportParams{
|
||||
ProtocolVersion: params.ProtocolVersion,
|
||||
Config: params.Config,
|
||||
Twcc: params.Twcc,
|
||||
DirectionConfig: params.Config.Publisher,
|
||||
CongestionControlConfig: params.CongestionControlConfig,
|
||||
EnabledCodecs: params.EnabledPublishCodecs,
|
||||
Logger: lgr,
|
||||
SimTracks: params.SimTracks,
|
||||
ClientInfo: params.ClientInfo,
|
||||
Transport: livekit.SignalTarget_PUBLISHER,
|
||||
Handler: TransportManagerPublisherTransportHandler{TransportManagerTransportHandler{params.PublisherHandler, t, lgr}},
|
||||
ProtocolVersion: params.ProtocolVersion,
|
||||
Config: params.Config,
|
||||
Twcc: params.Twcc,
|
||||
DirectionConfig: params.Config.Publisher,
|
||||
CongestionControlConfig: params.CongestionControlConfig,
|
||||
EnabledCodecs: params.EnabledPublishCodecs,
|
||||
Logger: lgr,
|
||||
SimTracks: params.SimTracks,
|
||||
ClientInfo: params.ClientInfo,
|
||||
Transport: livekit.SignalTarget_PUBLISHER,
|
||||
// RAJA-REMOVE Handler: TransportManagerPublisherTransportHandler{TransportManagerTransportHandler{params.PublisherHandler, t, lgr}},
|
||||
Handler: params.PublisherHandler,
|
||||
UseOneShotSignallingMode: params.UseOneShotSignallingMode,
|
||||
DataChannelMaxBufferedAmount: params.DataChannelMaxBufferedAmount,
|
||||
DatachannelSlowThreshold: params.DatachannelSlowThreshold,
|
||||
@@ -412,11 +413,8 @@ func (t *TransportManager) createDataChannelsForSubscriber(pendingDataChannels [
|
||||
func (t *TransportManager) GetUnmatchMediaForOffer(parsedOffer *sdp.SessionDescription, mediaType string) (unmatched []*sdp.MediaDescription, err error) {
|
||||
// prefer codec from offer for clients that don't support setCodecPreferences
|
||||
var lastMatchedMid string
|
||||
// RAJA-TODO lastAnswer := t.lastPublisherAnswer.Load()
|
||||
lastAnswer := t.publisher.CurrentRemoteDescription()
|
||||
if lastAnswer != nil {
|
||||
// RAJA-TODO answer := lastAnswer.(webrtc.SessionDescription)
|
||||
// RAJA-TODO parsedAnswer, err1 := answer.Unmarshal()
|
||||
parsedAnswer, err1 := lastAnswer.Unmarshal()
|
||||
if err1 != nil {
|
||||
// should not happen
|
||||
@@ -469,11 +467,7 @@ func (t *TransportManager) HandleOffer(offer webrtc.SessionDescription, offerId
|
||||
}
|
||||
|
||||
func (t *TransportManager) GetAnswer() (webrtc.SessionDescription, uint32, error) {
|
||||
answer, answerId, err := t.publisher.GetAnswer()
|
||||
if err == nil {
|
||||
t.lastPublisherAnswer.Store(answer)
|
||||
}
|
||||
return answer, answerId, err
|
||||
return t.publisher.GetAnswer()
|
||||
}
|
||||
|
||||
func (t *TransportManager) GetPublisherICESessionUfrag() (string, error) {
|
||||
|
||||
@@ -16,7 +16,7 @@ package types
|
||||
|
||||
type ProtocolVersion int
|
||||
|
||||
const CurrentProtocol = 17
|
||||
const CurrentProtocol = 16
|
||||
|
||||
func (v ProtocolVersion) SupportsPackedStreamId() bool {
|
||||
return v > 0
|
||||
|
||||
+10
-3
@@ -443,9 +443,11 @@ func (c *RTCClient) handleSignalResponse(res *livekit.SignalResponse) error {
|
||||
|
||||
logger.Infow("join accepted, awaiting offer", "participant", msg.Join.Participant.Identity)
|
||||
case *livekit.SignalResponse_Answer:
|
||||
// logger.Debugw("received server answer",
|
||||
// "participant", c.localParticipant.Identity,
|
||||
// "answer", msg.Answer.Sdp)
|
||||
logger.Infow(
|
||||
"received server answer",
|
||||
"participant", c.localParticipant.Identity,
|
||||
"answer", msg.Answer.Sdp,
|
||||
)
|
||||
c.handleAnswer(signalling.FromProtoSessionDescription(msg.Answer))
|
||||
case *livekit.SignalResponse_Offer:
|
||||
desc, offerId := signalling.FromProtoSessionDescription(msg.Offer)
|
||||
@@ -961,6 +963,11 @@ func (c *RTCClient) handleAnswer(desc webrtc.SessionDescription, answerId uint32
|
||||
func (c *RTCClient) onOffer(offer webrtc.SessionDescription, offerId uint32) error {
|
||||
if c.localParticipant != nil {
|
||||
logger.Infow("starting negotiation", "participant", c.localParticipant.Identity)
|
||||
logger.Infow(
|
||||
"sending publisher offer",
|
||||
"participant", c.localParticipant.Identity,
|
||||
"offer", offer,
|
||||
)
|
||||
}
|
||||
return c.SendRequest(&livekit.SignalRequest{
|
||||
Message: &livekit.SignalRequest_Offer{
|
||||
|
||||
Reference in New Issue
Block a user