Skip to content

Commit

Permalink
Reduce dependencies (#3086)
Browse files Browse the repository at this point in the history
* detect initialization type has to be made by FragmentRequest object

* StreamProcessor has a dashHandler reference : remove the opposite reference.

* remove unused parameter

* hasInitialization and hasSegments don't need to be static functions

* remove keepIndex parameter, always equals true

* remove unused parameter

* code simplification

* liveEdgeFinder is only used in ScheduleController, move the instance in ScheduleController
remove dependance to streamProcessor in liveEdgeFinder

* add setInfo function to FragmentRequest class

* call segmentsController.update only if needed case
add comments

* add startDataUpdate and endDataUpdate functions

* remove useless parameter

* add missing function in mock class

* remove reference of DashHandler in RepresentationController

* modify updateData function

* rmove reference of streamProcessor in RepresentationController.
RepresentationController is created in StreamProcessor, but the instance of StreamProcessor is not an attribute of RepresentationController

* remove unused reference

* remove circular dependencies between debug.js and settings.js

* remove circular dependencies between BufferController.js and ThroughputRule.js

* fix rebase conflicts

* update isEndlessMedia function
  • Loading branch information
nicosang authored and jeoliva committed Oct 8, 2019
1 parent 787f549 commit 488a9d6
Show file tree
Hide file tree
Showing 34 changed files with 370 additions and 465 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ function DownloadRatioRuleClass() {

let factory = dashjs.FactoryMaker;
let SwitchRequest = factory.getClassFactoryByName('SwitchRequest');
let MetricsModel = factory.getSingletonFactoryByName('MetricsModel');
let DashMetrics = factory.getSingletonFactoryByName('DashMetrics');
let DashManifestModel = factory.getSingletonFactoryByName('DashManifestModel');
let StreamController = factory.getSingletonFactoryByName('StreamController');
Expand Down
53 changes: 5 additions & 48 deletions src/core/Debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import EventBus from './EventBus';
import Events from './events/Events';
import FactoryMaker from './FactoryMaker';
import Settings from './Settings';

const LOG_LEVEL_NONE = 0;
const LOG_LEVEL_FATAL = 1;
Expand All @@ -42,13 +41,15 @@ const LOG_LEVEL_DEBUG = 5;

/**
* @module Debug
* @param {object} config
* @ignore
*/
function Debug() {
function Debug(config) {

config = config || {};
const context = this.context;
const eventBus = EventBus(context).getInstance();
const settings = Settings(context).getInstance();
const settings = config.settings;

const logFn = [];

Expand Down Expand Up @@ -97,48 +98,6 @@ function Debug() {
};
}

/**
* Sets up the log level. The levels are cumulative. For example, if you set the log level
* to dashjs.Debug.LOG_LEVEL_WARNING all warnings, errors and fatals will be logged. Possible values
*
* <ul>
* <li>dashjs.Debug.LOG_LEVEL_NONE<br/>
* No message is written in the browser console.
*
* <li>dashjs.Debug.LOG_LEVEL_FATAL<br/>
* Log fatal errors. An error is considered fatal when it causes playback to fail completely.
*
* <li>dashjs.Debug.LOG_LEVEL_ERROR<br/>
* Log error messages.
*
* <li>dashjs.Debug.LOG_LEVEL_WARNING<br/>
* Log warning messages.
*
* <li>dashjs.Debug.LOG_LEVEL_INFO<br/>
* Log info messages.
*
* <li>dashjs.Debug.LOG_LEVEL_DEBUG<br/>
* Log debug messages.
* </ul>
* @param {number} value Log level
* @default true
* @memberof module:Debug
* @instance
*/
function setLogLevel(value) {
const s = { debug: { logLevel: value }};
settings.update(s);
}

/**
* Use this method to get the current log level.
* @memberof module:Debug
* @instance
*/
function getLogLevel() {
return settings.get().debug.logLevel;
}

/**
* Prepends a timestamp in milliseconds to each log message.
* @param {boolean} value Set to true if you want to see a timestamp in each log message.
Expand Down Expand Up @@ -216,9 +175,7 @@ function Debug() {
instance = {
getLogger: getLogger,
setLogTimestampVisible: setLogTimestampVisible,
setCalleeNameVisible: setCalleeNameVisible,
setLogLevel: setLogLevel,
getLogLevel: getLogLevel
setCalleeNameVisible: setCalleeNameVisible
};

setup();
Expand Down
5 changes: 1 addition & 4 deletions src/core/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ import FactoryMaker from './FactoryMaker';
import Utils from './Utils.js';
import Debug from '../core/Debug';
import Constants from '../streaming/constants/Constants';
import {
HTTPRequest
}
from '../streaming/vo/metrics/HTTPRequest';
import { HTTPRequest } from '../streaming/vo/metrics/HTTPRequest';

/** @module Settings
* @description Define the configuration parameters of Dash.js MediaPlayer.
Expand Down
3 changes: 2 additions & 1 deletion src/core/events/CoreEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class CoreEvents extends EventsBase {
this.MANIFEST_UPDATED = 'manifestUpdated';
this.MEDIA_FRAGMENT_LOADED = 'mediaFragmentLoaded';
this.QUOTA_EXCEEDED = 'quotaExceeded';
this.REPRESENTATION_UPDATED = 'representationUpdated';
this.REPRESENTATION_UPDATE_STARTED = 'representationUpdateStarted';
this.REPRESENTATION_UPDATE_COMPLETED = 'representationUpdateCompleted';
this.SEGMENTS_LOADED = 'segmentsLoaded';
this.SERVICE_LOCATION_BLACKLIST_ADD = 'serviceLocationBlacklistAdd';
this.SERVICE_LOCATION_BLACKLIST_CHANGED = 'serviceLocationBlacklistChanged';
Expand Down
Loading

0 comments on commit 488a9d6

Please sign in to comment.