Skip to content

Commit

Permalink
Add IgnoreEarliestSegment/IgnoreLatestSegment options (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfish-shogi authored Jun 19, 2023
1 parent 6259248 commit 9368858
Showing 1 changed file with 34 additions and 28 deletions.
62 changes: 34 additions & 28 deletions inspectors/dash/presentation_delay.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import (
)

type PresentationDelayInspectorConfig struct {
Warn time.Duration
Error time.Duration
Warn time.Duration
Error time.Duration
IgnoreEarliestSegment bool
IgnoreLatestSegment bool
}

func DefaultPresentationDelayInspectorConfig() *PresentationDelayInspectorConfig {
Expand Down Expand Up @@ -138,34 +140,38 @@ func (ins *PresentationDelayInspector) Inspect(manifest *core.Manifest, segments
}
earliestRenderTime := earliestVideoTime.Add(suggestedPresentationDelay)
latestRenderTime := latestVideoTime.Add(suggestedPresentationDelay)
if earliestRenderTime.Add(ins.config.Error).After(wallClock) {
return &core.Report{
Name: "PresentationDelayInspector",
Severity: core.Error,
Message: "earliest segment is out of suggested time range",
Values: values,
}
} else if earliestRenderTime.Add(ins.config.Warn).After(wallClock) {
return &core.Report{
Name: "PresentationDelayInspector",
Severity: core.Warn,
Message: "earliest segment is out of suggested time range",
Values: values,
if !ins.config.IgnoreEarliestSegment {
if earliestRenderTime.Add(ins.config.Error).After(wallClock) {
return &core.Report{
Name: "PresentationDelayInspector",
Severity: core.Error,
Message: "earliest segment is out of suggested time range",
Values: values,
}
} else if earliestRenderTime.Add(ins.config.Warn).After(wallClock) {
return &core.Report{
Name: "PresentationDelayInspector",
Severity: core.Warn,
Message: "earliest segment is out of suggested time range",
Values: values,
}
}
}
if latestRenderTime.Add(-ins.config.Error).Before(wallClock) {
return &core.Report{
Name: "PresentationDelayInspector",
Severity: core.Error,
Message: "latest segment is out of suggested time range",
Values: values,
}
} else if latestRenderTime.Add(-ins.config.Warn).Before(wallClock) {
return &core.Report{
Name: "PresentationDelayInspector",
Severity: core.Warn,
Message: "latest segment is out of suggested time range",
Values: values,
if !ins.config.IgnoreLatestSegment {
if latestRenderTime.Add(-ins.config.Error).Before(wallClock) {
return &core.Report{
Name: "PresentationDelayInspector",
Severity: core.Error,
Message: "latest segment is out of suggested time range",
Values: values,
}
} else if latestRenderTime.Add(-ins.config.Warn).Before(wallClock) {
return &core.Report{
Name: "PresentationDelayInspector",
Severity: core.Warn,
Message: "latest segment is out of suggested time range",
Values: values,
}
}
}
return &core.Report{
Expand Down

0 comments on commit 9368858

Please sign in to comment.