Move callbacks out of messageRouter (#269)
* move callbacks out of messageRouter * OCD * more OCD * fix forwarder test * even more OCD * maximum OCD * package name collision, copy lock by value
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/sfu/buffer"
|
||||
"github.com/pion/webrtc/v3"
|
||||
)
|
||||
|
||||
@@ -41,23 +40,6 @@ func codecParametersFuzzySearch(needle webrtc.RTPCodecParameters, haystack []web
|
||||
return webrtc.RTPCodecParameters{}, webrtc.ErrCodecNotFound
|
||||
}
|
||||
|
||||
func ntpToMillisSinceEpoch(ntp uint64) uint64 {
|
||||
// ntp time since epoch calculate fractional ntp as milliseconds
|
||||
// (lower 32 bits stored as 1/2^32 seconds) and add
|
||||
// ntp seconds (stored in higher 32 bits) as milliseconds
|
||||
return (((ntp & 0xFFFFFFFF) * 1000) >> 32) + ((ntp >> 32) * 1000)
|
||||
}
|
||||
|
||||
func fastForwardTimestampAmount(newestTimestamp uint32, referenceTimestamp uint32) uint32 {
|
||||
if buffer.IsTimestampWrapAround(newestTimestamp, referenceTimestamp) {
|
||||
return uint32(uint64(newestTimestamp) + 0x100000000 - uint64(referenceTimestamp))
|
||||
}
|
||||
if newestTimestamp < referenceTimestamp {
|
||||
return 0
|
||||
}
|
||||
return newestTimestamp - referenceTimestamp
|
||||
}
|
||||
|
||||
func (t ntpTime) Duration() time.Duration {
|
||||
sec := (t >> 32) * 1e9
|
||||
frac := (t & 0xffffffff) * 1e9
|
||||
|
||||
Reference in New Issue
Block a user