Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing SCTE-35 implicit signal closing rules. #63

Merged
merged 5 commits into from Jan 26, 2018
Merged

Conversation

mikereedell
Copy link
Collaborator

  • Treat the open events slice like a stack, with the oldest event on the bottom since the
    logic that closes events iterates from the tail of the slice to the head.
  • Added unit test that illustrated this issue and verifies the fix.

…ending.

- Treat the open events slice like a stack, with the oldest event on the bottom since the
logic that closes events iterates from the tail of the slice to the head.
- Added unit test that illustrated this issue and verifies the fix.
Copy link
Contributor

@markniebur markniebur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve
edit: I unapprove my approve.

…r implicit signal rules.

- Modified code around segCloseEventIDNotNested to account for expected segments.
- Changed segCloseNotNested to deal with 0x34 and 0x36 w/subsegments only.
- Changed segmentation descriptor equality to account for segments/subsegments.
- Created unit test for segmentation descriptor to get full coverage of CanClose().
- Added unit tests for state.go to increase coverage of state handling.
@mikereedell mikereedell changed the title Modified scte35/state.go to push events onto the slice instead of appening. Fixing SCTE-35 implicit signal closing rules. Jan 22, 2018
@markniebur
Copy link
Contributor

I haven't forgotten about this... will get to it tomorrow.

Copy link
Contributor

@markniebur markniebur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments around relying on the close rules map instead of adding extra logic to the close type switch statement that may be harder to maintain.

// this should also consider segnum == segexpected for IN signals closing an out signal.
if d.IsIn() && d.EventID() == out.EventID() && d.SegmentNumber() == d.SegmentsExpected() {
return true
}
if d.EventID() != out.EventID() {
return false
}
fallthrough
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this fallthrough still needed? From cog esam 2.0 doc, it seems like the logic has diverged enough that only the first if block is needed and all the old code can be deleted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if d.EventId()... statement is extraneous. As is the fallthrough.

// if in, last desc is x/x
if d.segNum == d.segsExpected {
case segCloseNotNested: // only applies to 0x34 and 0x36 with subsegments.
if d.IsOut() && (d.TypeID() == SegDescProviderPOStart || d.TypeID() == SegDescDistributorPOStart) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this should be dictated by the closeRules map only 0x34 and 0x36 should have segCloseNotNested, the extra logic here is unneeded, and two places will have to be updated if another signal gets this close rule footnote.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.

} else if d.IsOut() {
// if out, first descriptor in set closes existing open
if d.segNum == 1 {
if d.TypeID() == out.TypeID() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same story here, I think this is already done in the close rules map and this is just extra, unneeded logic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

- Removed extra logic around segCloseEventIDNotNested and segCloseNotNested.
- Removed fallthrough statement in switch statement.
- Cleaned up logic in segCloseNotNested.
Copy link
Contributor

@markniebur markniebur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great, thanks!

@BlakeOrth BlakeOrth merged commit 4985fe9 into master Jan 26, 2018
@mikereedell mikereedell deleted the fix/scte35state branch January 26, 2018 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants