Use refTS if ahead. (#1956)
As expectedTS is tied to first packet and first packet adjustment may not have happened, refTS being ahead is not a bad thing. In one example, - first packet was late - a layer switch happened around 110ms later - in that time, 190ms worth of media was forwarded - but first packet adjustment did not happen yet - so at that layer switch, expected was behind - choosing ref at that switch is the right thing
This commit is contained in:
@@ -1563,10 +1563,8 @@ func (f *Forwarder) processSourceSwitch(extPkt *buffer.ExtPacket, layer int32) e
|
|||||||
diffSeconds = float64(int32(expectedTS-refTS)) / float64(f.codec.ClockRate)
|
diffSeconds = float64(int32(expectedTS-refTS)) / float64(f.codec.ClockRate)
|
||||||
if diffSeconds < 0.0 && math.Abs(diffSeconds) > SwitchAheadThresholdSeconds {
|
if diffSeconds < 0.0 && math.Abs(diffSeconds) > SwitchAheadThresholdSeconds {
|
||||||
logTransition("layer switch, reference too far ahead", expectedTS, refTS, lastTS, diffSeconds)
|
logTransition("layer switch, reference too far ahead", expectedTS, refTS, lastTS, diffSeconds)
|
||||||
nextTS = expectedTS
|
|
||||||
} else {
|
|
||||||
nextTS = refTS
|
|
||||||
}
|
}
|
||||||
|
nextTS = refTS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user