Skip to content

Commit

Permalink
Merge pull request #1950 from Orange-OpenSource/removeUnusedParameter
Browse files Browse the repository at this point in the history
Remove unused functions or parameters
  • Loading branch information
Dan Sparacio committed Jun 16, 2017
2 parents 3071c09 + 6cac942 commit 84582f5
Show file tree
Hide file tree
Showing 15 changed files with 4 additions and 152 deletions.
1 change: 0 additions & 1 deletion src/dash/DashAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ function DashAdapter() {
streamInfo.duration = period.duration;
streamInfo.manifestInfo = convertMpdToManifestInfo(period.mpd);
streamInfo.isLast = period.mpd.manifest.Period_asArray.length === 1 || Math.abs((streamInfo.start + streamInfo.duration) - streamInfo.manifestInfo.duration) < THRESHOLD;
streamInfo.isFirst = period.mpd.manifest.Period_asArray.length === 1 || dashManifestModel.getRegularPeriods(dashManifestModel.getMpd(period.mpd.manifest))[0].id === period.id;

return streamInfo;
}
Expand Down
19 changes: 1 addition & 18 deletions src/dash/models/DashManifestModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,19 +281,8 @@ function DashManifestModel() {
return isDynamic;
}

function getIsDVR(manifest) {
let isDynamic = getIsDynamic(manifest);
let containsDVR,
isDVR;

containsDVR = !isNaN(manifest.timeShiftBufferDepth);
isDVR = (isDynamic && containsDVR);

return isDVR;
}

function hasProfile(manifest, profile) {
let has = false;
var has = false;

if (manifest.profiles && manifest.profiles.length > 0) {
has = (manifest.profiles.indexOf(profile) !== -1);
Expand All @@ -302,10 +291,6 @@ function DashManifestModel() {
return has;
}

function getIsOnDemand(manifest) {
return hasProfile(manifest, 'urn:mpeg:dash:profile:isoff-on-demand:2011');
}

function getIsDVB(manifest) {
return hasProfile(manifest, 'urn:dvb:dash:profile:dvb-dash:2014');
}
Expand Down Expand Up @@ -913,8 +898,6 @@ function DashManifestModel() {
getKID: getKID,
getContentProtectionData: getContentProtectionData,
getIsDynamic: getIsDynamic,
getIsDVR: getIsDVR,
getIsOnDemand: getIsOnDemand,
getIsDVB: getIsDVB,
getDuration: getDuration,
getBandwidth: getBandwidth,
Expand Down
25 changes: 0 additions & 25 deletions src/streaming/Stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ function Stream(config) {
streamInfo,
updateError,
isUpdating,
initialized,
protectionController,
liveEdgeFinder,
playbackController,
Expand All @@ -84,7 +83,6 @@ function Stream(config) {
streamInfo = null;
updateError = {};
isUpdating = false;
initialized = false;

liveEdgeFinder = LiveEdgeFinder(context).getInstance();
playbackController = PlaybackController(context).getInstance();
Expand Down Expand Up @@ -163,7 +161,6 @@ function Stream(config) {
log = null;
errHandler = null;
isUpdating = false;
initialized = false;
updateError = {};

eventBus.off(Events.DATA_UPDATE_COMPLETED, onDataUpdateCompleted, instance);
Expand All @@ -183,10 +180,6 @@ function Stream(config) {
return streamInfo.start;
}

function getStreamIndex() {
return streamInfo.index;
}

function getId() {
return streamInfo.id;
}
Expand All @@ -195,10 +188,6 @@ function Stream(config) {
return streamInfo;
}

function hasMedia(type) {
return (getMediaInfo(type) !== null);
}

/**
* @param {string} type
* @returns {Array}
Expand All @@ -221,14 +210,6 @@ function Stream(config) {
}
}

function isActivated() {
return isStreamActivated;
}

function isInitialized() {
return initialized;
}

function onProtectionError(event) {
if (event.error) {
errHandler.mediaKeySessionError(event.error);
Expand Down Expand Up @@ -430,7 +411,6 @@ function Stream(config) {
if (streamProcessors[i].isUpdating() || isUpdating) return;
}

initialized = true;
if (!isMediaInitialized) return;
if (protectionController) {
protectionController.initialize(manifestModel.getValue(), getMediaInfo('audio'), getMediaInfo('video'));
Expand Down Expand Up @@ -520,7 +500,6 @@ function Stream(config) {

isStreamActivated = false;
isUpdating = true;
initialized = false;
streamInfo = updatedStreamInfo;

if (eventController) {
Expand Down Expand Up @@ -554,14 +533,10 @@ function Stream(config) {
deactivate: deactivate,
getDuration: getDuration,
getStartTime: getStartTime,
getStreamIndex: getStreamIndex,
getId: getId,
getStreamInfo: getStreamInfo,
hasMedia: hasMedia,
getBitrateListFor: getBitrateListFor,
startEventController: startEventController,
isActivated: isActivated,
isInitialized: isInitialized,
updateData: updateData,
reset: reset,
getProcessors: getProcessors
Expand Down
3 changes: 0 additions & 3 deletions src/streaming/controllers/AbrController.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ function AbrController() {
abrController: instance,
streamProcessor: streamProcessorDict[type],
currentValue: oldQuality,
playbackIndex: playbackIndex,
switchHistory: switchHistoryDict[type],
droppedFramesHistory: droppedFramesHistory,
hasRichBuffer: hasRichBuffer(type)
Expand Down Expand Up @@ -590,7 +589,6 @@ function AbrController() {
abrController: instance,
streamProcessor: streamProcessorDict[type],
currentRequest: e.request,
currentValue: getQualityFor(type, streamController.getActiveStreamInfo()),
hasRichBuffer: hasRichBuffer(type)
});
let switchRequest = abrRulesCollection.shouldAbandonFragment(rulesContext);
Expand Down Expand Up @@ -645,7 +643,6 @@ function AbrController() {
setUsePixelRatioInLimitBitrateByPortal: setUsePixelRatioInLimitBitrateByPortal,
getQualityFor: getQualityFor,
getAbandonmentStateFor: getAbandonmentStateFor,
setAbandonmentStateFor: setAbandonmentStateFor,
setPlaybackQuality: setPlaybackQuality,
checkPlaybackQuality: checkPlaybackQuality,
setAverageThroughput: setAverageThroughput,
Expand Down
10 changes: 0 additions & 10 deletions src/streaming/controllers/BufferController.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,6 @@ function BufferController(config) {
return streamProcessor;
}

function setStreamProcessor(value) {
streamProcessor = value;
}

function setSeekStartTime(value) {
seekStartTime = value;
}
Expand All @@ -466,10 +462,6 @@ function BufferController(config) {
return bufferLevel;
}

function getCriticalBufferLevel() {
return criticalBufferLevel;
}

function setMediaSource(value) {
mediaSource = value;
}
Expand Down Expand Up @@ -526,12 +518,10 @@ function BufferController(config) {
createBuffer: createBuffer,
getType: getType,
getStreamProcessor: getStreamProcessor,
setStreamProcessor: setStreamProcessor,
setSeekStartTime: setSeekStartTime,
getBuffer: getBuffer,
setBuffer: setBuffer,
getBufferLevel: getBufferLevel,
getCriticalBufferLevel: getCriticalBufferLevel,
setMediaSource: setMediaSource,
getMediaSource: getMediaSource,
getIsBufferingCompleted: getIsBufferingCompleted,
Expand Down
10 changes: 0 additions & 10 deletions src/streaming/controllers/PlaybackController.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,6 @@ function PlaybackController() {
return startTime + (streamInfo.duration - offset) - getTime();
}

function isPlaybackStarted() {
return getTime() > 0;
}

function getStreamId() {
return streamInfo.id;
}

function play() {
if (videoModel && videoModel.getElement()) {
videoModel.play();
Expand Down Expand Up @@ -479,8 +471,6 @@ function PlaybackController() {
setConfig: setConfig,
getStreamStartTime: getStreamStartTime,
getTimeToStreamEnd: getTimeToStreamEnd,
isPlaybackStarted: isPlaybackStarted,
getStreamId: getStreamId,
getTime: getTime,
getPlaybackRate: getPlaybackRate,
getPlayedRanges: getPlayedRanges,
Expand Down
5 changes: 0 additions & 5 deletions src/streaming/controllers/ScheduleController.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,6 @@ function ScheduleController(config) {
return timeToLoadDelay;
}

function getStreamProcessor() {
return streamProcessor;
}

function getBufferTarget() {
return bufferLevelRule.getBufferTarget(streamProcessor, type, streamController.isVideoTrackPresent());
}
Expand Down Expand Up @@ -595,7 +591,6 @@ function ScheduleController(config) {
instance = {
initialize: initialize,
getType: getType,
getStreamProcessor: getStreamProcessor,
getSeekTarget: getSeekTarget,
setSeekTarget: setSeekTarget,
getFragmentModel: getFragmentModel,
Expand Down
13 changes: 0 additions & 13 deletions src/streaming/controllers/StreamController.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ function StreamController() {
protectionData,
autoPlay,
isStreamSwitchingInProgress,
isUpdating,
hasMediaError,
hasInitialisationError,
mediaSource,
Expand All @@ -90,7 +89,6 @@ function StreamController() {
mediaPlayerModel = MediaPlayerModel(context).getInstance();
autoPlay = true;
isStreamSwitchingInProgress = false;
isUpdating = false;
isPaused = false;
initialPlayback = true;
playListMetrics = null;
Expand Down Expand Up @@ -594,18 +592,10 @@ function StreamController() {
reset();
}

function getAutoPlay() {
return autoPlay;
}

function getActiveStreamInfo() {
return activeStream ? activeStream.getStreamInfo() : null;
}

function isStreamActive(streamInfo) {
return (activeStream.getId() === streamInfo.id);
}

function getStreamById(id) {
return streams.filter(function (item) {
return item.getId() === id;
Expand Down Expand Up @@ -702,7 +692,6 @@ function StreamController() {
liveEdgeFinder.reset();
initCache.reset();
isStreamSwitchingInProgress = false;
isUpdating = false;
activeStream = null;
hasMediaError = false;
hasInitialisationError = false;
Expand Down Expand Up @@ -739,9 +728,7 @@ function StreamController() {

instance = {
initialize: initialize,
getAutoPlay: getAutoPlay,
getActiveStreamInfo: getActiveStreamInfo,
isStreamActive: isStreamActive,
isVideoTrackPresent: isVideoTrackPresent,
getStreamById: getStreamById,
getTimeRelativeToStreamId: getTimeRelativeToStreamId,
Expand Down
12 changes: 0 additions & 12 deletions src/streaming/rules/RulesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ function RulesContext(config) {
let abrController = config.abrController;
let sp = config.streamProcessor;
let representationInfo = config.streamProcessor.getCurrentRepresentationInfo();
let currentValue = config.currentValue;
let playbackIndex = config.playbackIndex;
let switchHistory = config.switchHistory;
let droppedFramesHistory = config.droppedFramesHistory;
let currentRequest = config.currentRequest;
Expand All @@ -60,10 +58,6 @@ function RulesContext(config) {
return representationInfo;
}

function getCurrentValue() {
return currentValue;
}

function getStreamProcessor() {
return sp;
}
Expand All @@ -72,10 +66,6 @@ function RulesContext(config) {
return abrController;
}

function getPlaybackIndex() {
return playbackIndex;
}

function getSwitchHistory() {
return switchHistory;
}
Expand All @@ -94,9 +84,7 @@ function RulesContext(config) {

instance = {
getMediaType: getMediaType,
getCurrentValue: getCurrentValue,
getMediaInfo: getMediaInfo,
getPlaybackIndex: getPlaybackIndex,
getDroppedFramesHistory: getDroppedFramesHistory,
getCurrentRequest: getCurrentRequest,
getSwitchHistory: getSwitchHistory,
Expand Down
12 changes: 0 additions & 12 deletions src/streaming/rules/abr/ABRRulesCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,6 @@ function ABRRulesCollection(config) {
});
}

function getRules(type) {
switch (type) {
case QUALITY_SWITCH_RULES:
return qualitySwitchRules;
case ABANDON_FRAGMENT_RULES:
return abandonFragmentRules;
default:
return null;
}
}

function getActiveRules(srArray) {
return srArray.filter(sr => sr.quality > SwitchRequest.NO_CHANGE);
}
Expand Down Expand Up @@ -203,7 +192,6 @@ function ABRRulesCollection(config) {
instance = {
initialize: initialize,
reset: reset,
getRules: getRules,
getMaxQuality: getMaxQuality,
shouldAbandonFragment: shouldAbandonFragment
};
Expand Down
10 changes: 0 additions & 10 deletions src/streaming/text/NotFragmentedTextBufferController.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ function NotFragmentedTextBufferController(config) {
return mediaSource;
}

function setStreamProcessor(value) {
streamProcessor = value;
}

function getStreamProcessor() {
return streamProcessor;
}
Expand All @@ -132,10 +128,6 @@ function NotFragmentedTextBufferController(config) {
return 0;
}

function getCriticalBufferLevel() {
return 0;
}

function reset(errored) {

eventBus.off(Events.DATA_UPDATE_COMPLETED, onDataUpdateCompleted, this);
Expand Down Expand Up @@ -186,12 +178,10 @@ function NotFragmentedTextBufferController(config) {
createBuffer: createBuffer,
getType: getType,
getStreamProcessor: getStreamProcessor,
setStreamProcessor: setStreamProcessor,
setSeekStartTime: setSeekStartTime,
getBuffer: getBuffer,
setBuffer: setBuffer,
getBufferLevel: getBufferLevel,
getCriticalBufferLevel: getCriticalBufferLevel,
setMediaSource: setMediaSource,
getMediaSource: getMediaSource,
getIsBufferingCompleted: getIsBufferingCompleted,
Expand Down

0 comments on commit 84582f5

Please sign in to comment.