enable track level audo nack config (#1306)
This commit is contained in:
@@ -209,6 +209,7 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
|
|||||||
info := t.params.MediaTrack.ToProto()
|
info := t.params.MediaTrack.ToProto()
|
||||||
addTrackParams := types.AddTrackParams{
|
addTrackParams := types.AddTrackParams{
|
||||||
Stereo: info.Stereo,
|
Stereo: info.Stereo,
|
||||||
|
Red: !info.DisableRed,
|
||||||
}
|
}
|
||||||
sub.VerifySubscribeParticipantInfo(subTrack.PublisherID(), subTrack.PublisherVersion())
|
sub.VerifySubscribeParticipantInfo(subTrack.PublisherID(), subTrack.PublisherVersion())
|
||||||
if sub.ProtocolVersion().SupportsTransceiverReuse() {
|
if sub.ProtocolVersion().SupportsTransceiverReuse() {
|
||||||
|
|||||||
@@ -220,10 +220,6 @@ type TransportParams struct {
|
|||||||
|
|
||||||
func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimator cc.BandwidthEstimator)) (*webrtc.PeerConnection, *webrtc.MediaEngine, error) {
|
func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimator cc.BandwidthEstimator)) (*webrtc.PeerConnection, *webrtc.MediaEngine, error) {
|
||||||
directionConfig := params.DirectionConfig
|
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)
|
me, err := createMediaEngine(params.EnabledCodecs, directionConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -627,7 +623,7 @@ func (t *PCTransport) AddTrack(trackLocal webrtc.TrackLocal, params types.AddTra
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
configureTransceiverStereo(transceiver, params.Stereo)
|
configureAudioTransceiver(transceiver, params.Stereo, !params.Red || !t.params.ClientInfo.SupportsAudioRED())
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -644,7 +640,7 @@ func (t *PCTransport) AddTransceiverFromTrack(trackLocal webrtc.TrackLocal, para
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
configureTransceiverStereo(transceiver, params.Stereo)
|
configureAudioTransceiver(transceiver, params.Stereo, !params.Red || !t.params.ClientInfo.SupportsAudioRED())
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -1766,8 +1762,8 @@ func (t *PCTransport) handleICERestart(e *event) error {
|
|||||||
return t.doICERestart()
|
return t.doICERestart()
|
||||||
}
|
}
|
||||||
|
|
||||||
// configure subscriber tranceiver for audio stereo
|
// configure subscriber tranceiver for audio stereo and nack
|
||||||
func configureTransceiverStereo(tr *webrtc.RTPTransceiver, stereo bool) {
|
func configureAudioTransceiver(tr *webrtc.RTPTransceiver, stereo bool, nack bool) {
|
||||||
sender := tr.Sender()
|
sender := tr.Sender()
|
||||||
if sender == nil {
|
if sender == nil {
|
||||||
return
|
return
|
||||||
@@ -1781,6 +1777,9 @@ func configureTransceiverStereo(tr *webrtc.RTPTransceiver, stereo bool) {
|
|||||||
if stereo {
|
if stereo {
|
||||||
c.SDPFmtpLine += ";sprop-stereo=1"
|
c.SDPFmtpLine += ";sprop-stereo=1"
|
||||||
}
|
}
|
||||||
|
if nack {
|
||||||
|
c.RTCPFeedback = append(c.RTCPFeedback, webrtc.RTCPFeedback{Type: webrtc.TypeRTCPFBNACK})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
configCodecs = append(configCodecs, c)
|
configCodecs = append(configCodecs, c)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ const (
|
|||||||
|
|
||||||
type AddTrackParams struct {
|
type AddTrackParams struct {
|
||||||
Stereo bool
|
Stereo bool
|
||||||
|
Red bool
|
||||||
}
|
}
|
||||||
|
|
||||||
//counterfeiter:generate . LocalParticipant
|
//counterfeiter:generate . LocalParticipant
|
||||||
|
|||||||
Reference in New Issue
Block a user