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

GOP-FUSION #57

Merged
merged 13 commits into from
Mar 7, 2016
Merged

GOP-FUSION #57

merged 13 commits into from
Mar 7, 2016

Conversation

imbcmdth
Copy link
Member

The first iteration of holding onto the last-segment's-GOP and attempting to prepend that GOP to the next segment.

The flush functions are much nicer - far fewer variables; limited global mutations; fit on one screen! The bulk of the work has been moved to functions that perform limited parts of what the giant while loop used to do. The functions are written so that they do not mutate their parameters for sanity reasons.

While this might be slightly less performant, it is still O(n) and is much easier to reason about the steps that are happening on a flush.

The last GOP in a segment is held onto and prepended onto the next segment providing the next segment is greater than the GOP in time AND the next segment is within 10 seconds of the GOP.

var
i,
currentObj,
sum = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Man, we need to start switching to let in the project, pronto.

@dmlap
Copy link
Member

dmlap commented Jan 27, 2016

One other thing to think about: what happens with lastGop if we're switching renditions to a encoding with a different SPS or PPS?

i,
currentFrame,
dataOffset = 0,
data = new Uint8Array(sumByteLengths(frames, 'data'));
Copy link
Member

Choose a reason for hiding this comment

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

I'm still slightly concerned that we're doing byte-wise iteration over and over again. Is there any way we could test the performance impact of this?

Copy link
Member Author

Choose a reason for hiding this comment

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

We aren't doing byte-wise iteration at all. Instead simply iterating over each frame to sum the lengths. It's exactly the same work as before just in it's own function. Also this is audio which is an order of magnitude less data (at least) than the video side.

/**
* Compare two arrays (event typed) for same-ness
*/
compareArrays = function(a, b) {
Copy link
Member

Choose a reason for hiding this comment

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

This function name is a bit vague. What about arrayEquals()?


// create the default sample
// see ISO/IEC 14496-12:2012, section 8.6.4.3
this.createDefaultSample_ = function() {
Copy link
Member

Choose a reason for hiding this comment

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

This might be a little easier to understand as an object prototype/class that you can new.

@imbcmdth imbcmdth force-pushed the goppers branch 2 times, most recently from 9cc7250 to 5064f06 Compare February 29, 2016 18:48
currentFrame = aacFrames[0];
sample = {
size: currentFrame.data.byteLength,
duration: 1024 // FIXME calculate for realz
Copy link
Member

Choose a reason for hiding this comment

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

Kinda sad to see this delightful comment go...

jrivera added 13 commits March 2, 2016 17:20
* Clean up a lot and made both flush functions much more readable and extensible
* Added the ability for VideoSegment to hold onto the last GOP in a segment and prepend it to the next segment if certain conditions are met
* We are now much more strict about filtering everything before the first AUD
* We also are more consistent and use DTS values only for calculating the compositionTimeOffset - PTS is used everywhere else
* Rules for guessing sample duration changed slightly
* Supports minor backtracking by the fetcher which is seen in certain scenarios
* Tightened the GOP selection code to be more strict
* Doesn't select a GOP if the SPS or PPS different (ie. on a rendition switch)
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

2 participants