@@ -235,6 +235,7 @@ func NewConfig(confString string, c *cli.Context) (*Config, error) {
|
|||||||
AutoCreate: true,
|
AutoCreate: true,
|
||||||
EnabledCodecs: []CodecSpec{
|
EnabledCodecs: []CodecSpec{
|
||||||
{Mime: webrtc.MimeTypeOpus},
|
{Mime: webrtc.MimeTypeOpus},
|
||||||
|
{Mime: "audio/red"},
|
||||||
{Mime: webrtc.MimeTypeVP8},
|
{Mime: webrtc.MimeTypeVP8},
|
||||||
{Mime: webrtc.MimeTypeH264},
|
{Mime: webrtc.MimeTypeH264},
|
||||||
// {Mime: webrtc.MimeTypeAV1},
|
// {Mime: webrtc.MimeTypeAV1},
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ type ClientInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c ClientInfo) SupportsAudioRED() bool {
|
func (c ClientInfo) SupportsAudioRED() bool {
|
||||||
return c.ClientInfo.Browser != "firefox" && c.ClientInfo.Browser != "safari"
|
return c.ClientInfo != nil && c.ClientInfo.Browser != "firefox" && c.ClientInfo.Browser != "safari"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/pion/webrtc/v3"
|
"github.com/pion/webrtc/v3"
|
||||||
|
|
||||||
|
"github.com/livekit/livekit-server/pkg/sfu"
|
||||||
"github.com/livekit/protocol/livekit"
|
"github.com/livekit/protocol/livekit"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ func registerCodecs(me *webrtc.MediaEngine, codecs []*livekit.Codec, rtcpFeedbac
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
redCodec := webrtc.RTPCodecCapability{MimeType: "audio/red", ClockRate: 48000, Channels: 2}
|
redCodec := webrtc.RTPCodecCapability{MimeType: sfu.MimeTypeAudioRed, ClockRate: 48000, Channels: 2}
|
||||||
if opusPayload != 0 && isCodecEnabled(codecs, redCodec) {
|
if opusPayload != 0 && isCodecEnabled(codecs, redCodec) {
|
||||||
redCodec.SDPFmtpLine = fmt.Sprintf("%d/%d", opusPayload, opusPayload)
|
redCodec.SDPFmtpLine = fmt.Sprintf("%d/%d", opusPayload, opusPayload)
|
||||||
if err := me.RegisterCodec(webrtc.RTPCodecParameters{
|
if err := me.RegisterCodec(webrtc.RTPCodecParameters{
|
||||||
|
|||||||
@@ -434,6 +434,7 @@ type participantOpts struct {
|
|||||||
protocolVersion types.ProtocolVersion
|
protocolVersion types.ProtocolVersion
|
||||||
publisher bool
|
publisher bool
|
||||||
clientConf *livekit.ClientConfiguration
|
clientConf *livekit.ClientConfiguration
|
||||||
|
clientInfo *livekit.ClientInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
func newParticipantForTestWithOpts(identity livekit.ParticipantIdentity, opts *participantOpts) *ParticipantImpl {
|
func newParticipantForTestWithOpts(identity livekit.ParticipantIdentity, opts *participantOpts) *ParticipantImpl {
|
||||||
@@ -477,6 +478,7 @@ func newParticipantForTestWithOpts(identity livekit.ParticipantIdentity, opts *p
|
|||||||
Grants: grants,
|
Grants: grants,
|
||||||
EnabledCodecs: enabledCodecs,
|
EnabledCodecs: enabledCodecs,
|
||||||
ClientConf: opts.clientConf,
|
ClientConf: opts.clientConf,
|
||||||
|
ClientInfo: ClientInfo{ClientInfo: opts.clientInfo},
|
||||||
})
|
})
|
||||||
p.isPublisher.Store(opts.publisher)
|
p.isPublisher.Store(opts.publisher)
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,10 @@ func (r *RedPrimaryReceiver) DeleteDownTrack(subscriberID livekit.ParticipantID)
|
|||||||
r.downTrackSpreader.Free(subscriberID)
|
r.downTrackSpreader.Free(subscriberID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *RedPrimaryReceiver) CanClose() bool {
|
||||||
|
return r.closed.Load() || r.downTrackSpreader.DownTrackCount() == 0
|
||||||
|
}
|
||||||
|
|
||||||
func (r *RedPrimaryReceiver) Close() {
|
func (r *RedPrimaryReceiver) Close() {
|
||||||
r.closed.Store(true)
|
r.closed.Store(true)
|
||||||
for _, dt := range r.downTrackSpreader.ResetAndGetDownTracks() {
|
for _, dt := range r.downTrackSpreader.ResetAndGetDownTracks() {
|
||||||
|
|||||||
Reference in New Issue
Block a user