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

Multi channel #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Multi channel #6

wants to merge 3 commits into from

Conversation

megaadam
Copy link
Contributor

  • support multi-channels
  • support arbitrary live-window-size

return 0, err
}

ci, err := esf.ParseContentInfo(bytes)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: get duration from a dat file instead,
only the "demo-contentinfo" files contain a duration

Copy link
Collaborator

@tobbee tobbee left a comment

Choose a reason for hiding this comment

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

I have a number of minor remarks, but in general it looks fine.

However, we should be careful with growing this code too much, since it is intended as a an open-source "simple" example that one can learn from. If we want to have a tool for testing performance, it should probably be another piece of software.

v2l/channel.go Outdated
nowMS := time.Now().UnixNano() / 1_000_000
return nowMS/(gopDurMS*nrGopsPerSegment) - 1
// CreateChannels - create a slice filled with channels
func CreateChannels(nofChannels int,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use "nrOfChannels" instead of "nofChannels" to be consistent with the rest of the names.

main.go Outdated
)

func main() {
err := v2l.DeleteChannel(server, channelName) // Delete any old channel and schedule
nofChannels := 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

change variable name to nrOfChannels to align with reset of code

if err != nil {
log.Fatal(err)
}
}
chIndex++
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd suggest that you do the modulo operation right away, so that one does not suspect an error. index should be less than nrOfChannels. From a performance point of view, it is also better to write it as

chIndex++
if chIndex == nrOfChannels {
chIndex -= nrOfChannels
}

since divisions and mod are very expensive operations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or rather this

if ... {
    chIndex = 0
}


cd := ci.ContentDurationMS
if cd == 0 {
return 0, fmt.Errorf("ContentDurationMS not found")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use the proper JSON name here instead of the internal Go name.

}

// CreateSchedule -- create a complete schedule to fill the entire live window
func (channel *Channel) CreateSchedule(slidingWindowNrGops, futureScheduleNrGops, gopDurMS int64, assetPaths []AssetPath) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe extend here is that the schedule is built by pairs of a "program" and an "ad"

v2l/channel.go Outdated
}
}

// CreateChannel - create a channel with two assets and an ad in between
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment no longer describes what the function does so it should be updated

v2l/channel.go Outdated
assetPaths []AssetPath) (*Channel, error) {
startGopNr := nowToGopNr(gopDurMS, time.Now())

log.Printf("Start time for channels set to %s\n", time.Duration(startGopNr*gopDurMS)*(time.Millisecond))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be better to get a UTC time here or at least also.

gd := ci.GOPDurationMS
if gd == 0 {
return 0, fmt.Errorf("GOPDurationMS not found")
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And JSON here too

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.

2 participants