Increment RTP timestamp on padding when using dummy start. (#3989)
* Increment RTP timestamp on padding when using dummy start. This allows things like egress to have proper sequence to start the pipeline. * test
This commit is contained in:
@@ -88,6 +88,7 @@ const (
|
||||
|
||||
waitBeforeSendPaddingOnMute = 100 * time.Millisecond
|
||||
maxPaddingOnMuteDuration = 5 * time.Second
|
||||
paddingOnMuteInterval = 100 * time.Millisecond
|
||||
)
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
@@ -1158,7 +1159,14 @@ func (d *DownTrack) WritePaddingRTP(bytesToSend int, paddingOnMute bool, forceMa
|
||||
return 0
|
||||
}
|
||||
|
||||
snts, err := d.forwarder.GetSnTsForPadding(num, forceMarker)
|
||||
frameRate := uint32(0)
|
||||
if paddingOnMute {
|
||||
// advance timestamps when sending dummy padding packets to start a stream
|
||||
// to ensure receiver sees proper timestamp and starts the stream
|
||||
frameRate = uint32(time.Second / paddingOnMuteInterval)
|
||||
}
|
||||
|
||||
snts, err := d.forwarder.GetSnTsForPadding(num, frameRate, forceMarker)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
@@ -2391,7 +2399,6 @@ func (d *DownTrack) sendPaddingOnMute() {
|
||||
// let uptrack have chance to send packet before we send padding
|
||||
time.Sleep(waitBeforeSendPaddingOnMute)
|
||||
|
||||
paddingOnMuteInterval := 100 * time.Millisecond
|
||||
numPackets := maxPaddingOnMuteDuration / paddingOnMuteInterval
|
||||
for i := 0; i < int(numPackets); i++ {
|
||||
if d.rtpStats.IsActive() || d.IsClosed() {
|
||||
|
||||
Reference in New Issue
Block a user