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

Major Refactor reduces complication, increases dependability and solve critical bugs. #1523

Merged
merged 10 commits into from Aug 5, 2016

Conversation

dsparacio
Copy link
Contributor

This is a big change that just all keep creeping due to the original task; which was to solve issue #1365 and remove the Virtual Buffer. This task is complete!

That lead to multi-track changes since multi-track depended on VB. This lead to a refactor of buffer controller and schedule controller. But.....

While doing this @spiterikevin noticed duplicate loading in certain cases so I set out to fix that as well. This changed solved the duplicate issue and should solve #1205 as well!!

Then issue #1514 was reported and this solution for this fit into the current work for fragmentModel and multitrack... so It is also fixed and part of this PR.

Some of the line changes are really just es6 conversion. E.g use of const to improve readability and efficiency.

I have tested this code and reviewed it extensively.! Please review if you have time!

Dan Sparacio added 7 commits July 26, 2016 14:32
…a request, simplifed buffercontroller and schedulecontroller post VB removal
…a type so I may persist the model through track and period changes. Major es5 cleanup and some notes.
@dsparacio
Copy link
Contributor Author

@bbcrddave @LloydW93 or anyone else, Maybe you can check this out would love to get some eyes on it. I am going to run BBC browserstack test soon to see if results are same or better...

@@ -131,16 +129,15 @@ function BufferController(config) {
eventBus.on(Events.PLAYBACK_RATE_CHANGED, onPlaybackRateChanged, this);
eventBus.on(Events.PLAYBACK_SEEKING, onPlaybackSeeking, this);
eventBus.on(Events.WALLCLOCK_TIME_UPDATED, onWallclockTimeUpdated, this);
eventBus.on(Events.CURRENT_TRACK_CHANGED, onCurrentTrackChanged, this);
eventBus.on(Events.CURRENT_TRACK_CHANGED, onCurrentTrackChanged, this, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

EventBus should probably export some consts rather than using magic numbers - it isn't clear what priority 0 is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we do something like states of priority CONST the question is, is that scalable? What happens if there are five preset states of priority but then the use of an event type grows to 6 listeners and you need all six in a certain order. I opted for a pure int based system which is limitless so I want to see how we can make this more clear as I do agree this needs some help. However in most other event systems I have used it is the reverse, Higher number holds more priority.

Copy link
Member

Choose a reason for hiding this comment

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

It may be nice to have a few preset priorities that the library uses with plenty of space between them. Then third party developers and others in the library can have flexibility to adjust as needed.

Something like:

const priorities = {
  low: 0,
  normal: 200,
  high: 500
}

Obviously if we have need for more than those we can adjust, but at least that gives people some indication of where we're at.

Copy link
Member

Choose a reason for hiding this comment

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

This also has the benefit of resolving the "is 0 low or high" question by adding some labels to at least a few numbers.

@davemevans
Copy link
Contributor

Great effort Dan!

@dsparacio
Copy link
Contributor Author

Thanks Dave! Thanks for the great code review. I’ll fix all the commented items but we should discuss event priority and how to make it most useful and clear. I do want to keep that in. Thanks again for taking the time!

Dan

From: David Evans notifications@github.com
Reply-To: "Dash-Industry-Forum/dash.js" reply@reply.github.com
Date: Tuesday, August 2, 2016 at 5:37 AM
To: "Dash-Industry-Forum/dash.js" dash.js@noreply.github.com
Cc: Daniel Sparacio dsparaci@akamai.com, Author author@noreply.github.com
Subject: Re: [Dash-Industry-Forum/dash.js] Major Refactor reduces complication, increases dependability and solve critical bugs. (#1523)

Great effort Dan!


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Dash-2DIndustry-2DForum_dash.js_pull_1523-23issuecomment-2D236891107&d=DQMCaQ&c=96ZbZZcaMF4w0F4jpN6LZg&r=HMIPFyLErj4M8VUwg3x36W02236DJoh_A_hxovpfrCc&m=s7JjvEt3PFsDEuRHFF1yrprFNcGC5_n33zfM256ip2c&s=VjRnX8fxMFOOCRz-opGdRqF7zoVye5gbkFPouPmLyyI&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AHgAjsHfG4RkyD6EiubrfhHwHBD1r9Mmks5qbzokgaJpZM4JaJih&d=DQMCaQ&c=96ZbZZcaMF4w0F4jpN6LZg&r=HMIPFyLErj4M8VUwg3x36W02236DJoh_A_hxovpfrCc&m=s7JjvEt3PFsDEuRHFF1yrprFNcGC5_n33zfM256ip2c&s=GNrnnjfxb0jIojjxTsFQwfVS6pylwSjlVXfM-qt63zs&e=.

if (fragmentModel) {
fragmentModel.reset();
fragmentModel = null;
}
Copy link
Member

Choose a reason for hiding this comment

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

Why does the fragmentModel no longer need to be reset or nulled out? It's still being setup in the initialize method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is cleaned up in FragmentController and persisted over new creations of schedule controller. It is using the same one if it exists in the init of schedule controller.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha fair enough. I saw the .create for RepresentationController above and below this and assume we were creating FragmentModel... but we're not. So disregard

@boushley
Copy link
Member

boushley commented Aug 2, 2016

Gotta love when you remove > 2x the code added and things get better 👍

… for priority added default param, refactored a bit and added off for new listener in schedule controller.
@dsparacio
Copy link
Contributor Author

@bbcrddave @boushley if you get a chance check out 97673f7

@boushley
Copy link
Member

boushley commented Aug 4, 2016

This looks good. Much clearer what priority is low and what is high.

Looking good 👍

@dsparacio
Copy link
Contributor Author

Thanks guys. I am going to do some deep browsers os testing today and make sure all is well then merge by end of week hopefully!

…le controller. Data change / Stream init handlers would allow media type to cross and pollute the representation info usually of audio. Fixed buffer target access for metrics in buffer controller. Removed unused items in buffer controller and fixed in proper init of objects.
@dsparacio dsparacio merged commit 9150dd2 into Dash-Industry-Forum:development Aug 5, 2016
@boushley
Copy link
Member

boushley commented Aug 5, 2016

👏

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