enable track level audo nack config (#1306)

This commit is contained in:
cnderrauber
2023-01-13 17:07:06 +08:00
committed by GitHub
parent 17236799bb
commit 55962e300c
3 changed files with 10 additions and 9 deletions
+1
View File
@@ -209,6 +209,7 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
info := t.params.MediaTrack.ToProto()
addTrackParams := types.AddTrackParams{
Stereo: info.Stereo,
Red: !info.DisableRed,
}
sub.VerifySubscribeParticipantInfo(subTrack.PublisherID(), subTrack.PublisherVersion())
if sub.ProtocolVersion().SupportsTransceiverReuse() {
+8 -9
View File
@@ -220,10 +220,6 @@ type TransportParams struct {
func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimator cc.BandwidthEstimator)) (*webrtc.PeerConnection, *webrtc.MediaEngine, error) {
directionConfig := params.DirectionConfig
// enable nack if audio red is not support
if !isCodecEnabled(params.EnabledCodecs, webrtc.RTPCodecCapability{MimeType: sfu.MimeTypeAudioRed}) || !params.ClientInfo.SupportsAudioRED() {
directionConfig.RTCPFeedback.Audio = append(directionConfig.RTCPFeedback.Audio, webrtc.RTCPFeedback{Type: webrtc.TypeRTCPFBNACK})
}
me, err := createMediaEngine(params.EnabledCodecs, directionConfig)
if err != nil {
@@ -273,7 +269,7 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat
if len(nat1to1Ips) > 0 {
params.Logger.Infow("client doesn't support prflx over relay, use external ip only as host candidate", "ips", nat1to1Ips)
se.SetNAT1To1IPs(nat1to1Ips, webrtc.ICECandidateTypeHost)
se.SetIPFilter(func (ip net.IP) bool {
se.SetIPFilter(func(ip net.IP) bool {
ipstr := ip.String()
for _, inc := range includeIps {
if inc == ipstr {
@@ -627,7 +623,7 @@ func (t *PCTransport) AddTrack(trackLocal webrtc.TrackLocal, params types.AddTra
return
}
configureTransceiverStereo(transceiver, params.Stereo)
configureAudioTransceiver(transceiver, params.Stereo, !params.Red || !t.params.ClientInfo.SupportsAudioRED())
return
}
@@ -644,7 +640,7 @@ func (t *PCTransport) AddTransceiverFromTrack(trackLocal webrtc.TrackLocal, para
return
}
configureTransceiverStereo(transceiver, params.Stereo)
configureAudioTransceiver(transceiver, params.Stereo, !params.Red || !t.params.ClientInfo.SupportsAudioRED())
return
}
@@ -1766,8 +1762,8 @@ func (t *PCTransport) handleICERestart(e *event) error {
return t.doICERestart()
}
// configure subscriber tranceiver for audio stereo
func configureTransceiverStereo(tr *webrtc.RTPTransceiver, stereo bool) {
// configure subscriber tranceiver for audio stereo and nack
func configureAudioTransceiver(tr *webrtc.RTPTransceiver, stereo bool, nack bool) {
sender := tr.Sender()
if sender == nil {
return
@@ -1781,6 +1777,9 @@ func configureTransceiverStereo(tr *webrtc.RTPTransceiver, stereo bool) {
if stereo {
c.SDPFmtpLine += ";sprop-stereo=1"
}
if nack {
c.RTCPFeedback = append(c.RTCPFeedback, webrtc.RTCPFeedback{Type: webrtc.TypeRTCPFBNACK})
}
}
configCodecs = append(configCodecs, c)
}
+1
View File
@@ -220,6 +220,7 @@ const (
type AddTrackParams struct {
Stereo bool
Red bool
}
//counterfeiter:generate . LocalParticipant