Add number of keyframes and extradata size to process progress data

This commit is contained in:
Ingo Oppermann
2023-04-04 20:44:57 +02:00
parent baf1c3391a
commit 7e9e6fce8d
9 changed files with 139 additions and 72 deletions

View File

@@ -356,7 +356,7 @@ func (p *parser) Parse(line string) uint64 {
if p.collector.IsCollectableIP(p.process.input[i].IP) {
p.collector.Activate("")
p.collector.Ingress("", int64(p.stats.input[i].diff.size)*1024)
p.collector.Ingress("", int64(p.stats.input[i].diff.size))
}
}
}
@@ -373,7 +373,7 @@ func (p *parser) Parse(line string) uint64 {
if p.collector.IsCollectableIP(p.process.output[i].IP) {
p.collector.Activate("")
p.collector.Egress("", int64(p.stats.output[i].diff.size)*1024)
p.collector.Egress("", int64(p.stats.output[i].diff.size))
}
}
}
@@ -410,7 +410,7 @@ func (p *parser) parseDefaultProgress(line string) error {
if matches = p.re.size.FindStringSubmatch(line); matches != nil {
if x, err := strconv.ParseUint(matches[1], 10, 64); err == nil {
p.progress.ffmpeg.Size = x
p.progress.ffmpeg.Size = x * 1024
}
}
@@ -485,6 +485,26 @@ func (p *parser) parseFFmpegProgress(line string) error {
return fmt.Errorf("output length mismatch (have: %d, want: %d)", len(progress.Output), len(p.process.output))
}
if progress.Size == 0 {
progress.Size = progress.SizeKB * 1024
}
for i, io := range progress.Input {
if io.Size == 0 {
io.Size = io.SizeKB * 1024
}
progress.Input[i].Size = io.Size
}
for i, io := range progress.Output {
if io.Size == 0 {
io.Size = io.SizeKB * 1024
}
progress.Output[i].Size = io.Size
}
p.progress.ffmpeg = progress
return nil