Refactor receiver and buffer into Base and higher layer. (#4185)
* Refactor receiver and buffer into Base and higher layer. To be able to share code/functionality with relay. * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * clean up * deps * fix test * fix test
This commit is contained in:
@@ -680,7 +680,7 @@ func (r *rtpStatsBase) updateJitter(ets uint64, packetTime int64) float64 {
|
||||
}
|
||||
|
||||
func (r *rtpStatsBase) getAndResetSnapshot(snapshotID uint32, extStartSN uint64, extHighestSN uint64) (*snapshot, *snapshot) {
|
||||
if !r.initialized {
|
||||
if !r.initialized || snapshotID < cFirstSnapshotID {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -751,6 +751,10 @@ func (r *RTPStatsReceiver) MarshalLogObject(e zapcore.ObjectEncoder) error {
|
||||
}
|
||||
|
||||
func (r *RTPStatsReceiver) ToProto() *livekit.RTPStats {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
r.lock.RLock()
|
||||
defer r.lock.RUnlock()
|
||||
|
||||
|
||||
@@ -1125,7 +1125,7 @@ func (r *RTPStatsSender) ToProto() *livekit.RTPStats {
|
||||
}
|
||||
|
||||
func (r *RTPStatsSender) getAndResetSenderSnapshotWindow(senderSnapshotID uint32) (*senderSnapshotWindow, *senderSnapshotWindow) {
|
||||
if !r.initialized {
|
||||
if !r.initialized || senderSnapshotID < cFirstSnapshotID {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -1166,7 +1166,7 @@ func (r *RTPStatsSender) getSenderSnapshotWindow(startTime int64) senderSnapshot
|
||||
}
|
||||
|
||||
func (r *RTPStatsSender) getAndResetSenderSnapshotReceiverView(senderSnapshotID uint32) (*senderSnapshotReceiverView, *senderSnapshotReceiverView) {
|
||||
if !r.initialized || r.lastRRTime == 0 {
|
||||
if !r.initialized || r.lastRRTime == 0 || senderSnapshotID < cFirstSnapshotID {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user