Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jurisevo committed Oct 22, 2024
1 parent dd1275e commit 81912cd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/analysis/plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ func CreateBitratePlot(frameStats []FrameStat) (*plot.Plot, error) {
var totSize uint64
var curSecond uint64

// TODO This is slightly specialised version of what FrameStats.ToBitrate() does. In
// future may consider to generalize.

// Bucket count should be same as video duration in seconds.
bSize := uint64(math.Floor(videoDuration)) + 1
// Create buckets for all types of interesting frames.
Expand Down Expand Up @@ -628,8 +631,7 @@ func (ff FrameStats) ToBitrate() ([]float64, error) {
}
// Bucket count should be same as video duration in seconds.
bSize := uint64(math.Floor(videoDuration)) + 1
// Create buckets for all types of interesting frames.
allFrameBuckets := make([]float64, bSize)
buckets := make([]float64, bSize)

var totSize uint64
var curSecond uint64
Expand All @@ -642,10 +644,10 @@ func (ff FrameStats) ToBitrate() ([]float64, error) {
curSecond = uint64(math.Floor(p.PtsTime - minPts))
// Convert frame size to Kbits.
s := float64(p.Size*8) / 1000
allFrameBuckets[curSecond] += s
buckets[curSecond] += s
}

return allFrameBuckets, nil
return buckets, nil
}

// packetStat is struct with per-packet meta-data as provided by ffprobe.
Expand Down

0 comments on commit 81912cd

Please sign in to comment.