dropped-frame tracke
This commit is contained in:
+10
-8
@@ -467,7 +467,7 @@ func main() {
|
||||
displayedVideoStride uint32 = placeholderStride
|
||||
|
||||
fps float64
|
||||
lastIndex uint64
|
||||
dropTracker videoDropTracker
|
||||
dropped uint64
|
||||
droppedTotal uint64
|
||||
frameCount uint64
|
||||
@@ -530,6 +530,8 @@ func main() {
|
||||
resized = false
|
||||
}
|
||||
var shownIndex uint64
|
||||
var shownGeneration uint64
|
||||
var shownSource playback.FeedConfig
|
||||
hasFrame := false
|
||||
|
||||
frameCtx, frameCancel := context.WithTimeout(ctx, 100*time.Millisecond)
|
||||
@@ -555,6 +557,8 @@ func main() {
|
||||
}
|
||||
|
||||
shownIndex = pendingFrame.Frame.Index
|
||||
shownGeneration = pendingFrame.Generation
|
||||
shownSource = pendingFrame.Source
|
||||
displayedVideoWidth = pendingFrame.Frame.Width
|
||||
displayedVideoHeight = pendingFrame.Frame.Height
|
||||
displayedVideoStride = pendingFrame.Frame.Stride
|
||||
@@ -565,15 +569,14 @@ func main() {
|
||||
panic(frameErr)
|
||||
}
|
||||
|
||||
snapshot, hasSnapshot := player.Controller.Snapshot()
|
||||
|
||||
// stats
|
||||
if hasFrame {
|
||||
if lastIndex != 0 && shownIndex > lastIndex {
|
||||
if g := shownIndex - lastIndex - 1; g > 0 {
|
||||
dropped += g
|
||||
droppedTotal += g
|
||||
}
|
||||
if gap := dropTracker.Observe(shownGeneration, shownSource, shownIndex); gap > 0 {
|
||||
dropped += gap
|
||||
droppedTotal += gap
|
||||
}
|
||||
lastIndex = shownIndex
|
||||
frameCount++
|
||||
if now := time.Now(); now.Sub(lastReport) >= time.Second {
|
||||
dt := now.Sub(lastReport).Seconds()
|
||||
@@ -588,7 +591,6 @@ func main() {
|
||||
// end of stats
|
||||
if r != nil {
|
||||
gui.BeginFrame(time.Since(lastFrame), int32(r.Extent().Width), int32(r.Extent().Height))
|
||||
snapshot, hasSnapshot := player.Controller.Snapshot()
|
||||
if showStats {
|
||||
cimgui.SetNextWindowPos(cimgui.Vec2{X: 0, Y: 0})
|
||||
cimgui.SetNextWindowSize(cimgui.Vec2{X: 460, Y: 510})
|
||||
|
||||
Reference in New Issue
Block a user