Don't wait rtp packet to fire track (#3246)

* Don't wait rtp packet to fire track

Create track from sdp instead of first rtp packet,
it is consistent with the browser behavior and
will accelerate the track publication.

* fix test
This commit is contained in:
cnderrauber
2024-12-13 15:06:14 +08:00
committed by GitHub
parent 789d0484e2
commit 5dd6858acf
9 changed files with 174 additions and 24 deletions
+5
View File
@@ -260,6 +260,7 @@ type TransportParams struct {
AllowPlayoutDelay bool
DataChannelMaxBufferedAmount uint64
UseOneShotSignallingMode bool
FireOnTrackBySdp bool
}
func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimator cc.BandwidthEstimator)) (*webrtc.PeerConnection, *webrtc.MediaEngine, error) {
@@ -287,6 +288,10 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat
// https://github.com/pion/webrtc/pull/2961
se.DisableCloseByDTLS(true)
if params.FireOnTrackBySdp {
se.SetFireOnTrackBeforeFirstRTP(true)
}
//
// Disable SRTP replay protection (https://datatracker.ietf.org/doc/html/rfc3711#page-15).
// Needed due to lack of RTX stream support in Pion.