Skip to content

Commit

Permalink
Merge pull request #1443 from AkamaiDASH/BugFixes
Browse files Browse the repository at this point in the history
Fix for #1437
  • Loading branch information
Dan Sparacio authored and Dan Sparacio committed Jun 7, 2016
2 parents a9d3bfc + 89ef671 commit fcacac5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/streaming/controllers/AbrController.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const ABANDON_LOAD = 'abandonload';
const ALLOW_LOAD = 'allowload';
const DEFAULT_VIDEO_BITRATE = 1000;
const DEFAULT_AUDIO_BITRATE = 100;
const QUALITY_DEFAULT = -1;
const QUALITY_DEFAULT = 0;

function AbrController() {

Expand Down
16 changes: 8 additions & 8 deletions src/streaming/controllers/BufferController.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ function BufferController(config) {
clearBufferTimeout;

function setup() {
requiredQuality = -1;
currentQuality = -1;
requiredQuality = AbrController.QUALITY_DEFAULT;
currentQuality = AbrController.QUALITY_DEFAULT;
isBufferingCompleted = false;
bufferLevel = 0;
bufferTarget = 0;
criticalBufferLevel = Number.POSITIVE_INFINITY;
maxAppendedIndex = -1;
lastIndex = -1;
maxAppendedIndex = 0;
lastIndex = 0;
buffer = null;
bufferState = BUFFER_EMPTY;
wallclockTicked = 0;
Expand Down Expand Up @@ -713,10 +713,10 @@ function BufferController(config) {

criticalBufferLevel = Number.POSITIVE_INFINITY;
bufferState = BUFFER_EMPTY;
currentQuality = -1;
lastIndex = -1;
maxAppendedIndex = -1;
requiredQuality = 0;
currentQuality = AbrController.QUALITY_DEFAULT;
requiredQuality = AbrController.QUALITY_DEFAULT;
lastIndex = 0;
maxAppendedIndex = 0;
appendedBytesInfo = null;
appendingMediaChunk = false;
isBufferingCompleted = false;
Expand Down
6 changes: 5 additions & 1 deletion src/streaming/controllers/ScheduleController.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ function ScheduleController(config) {
bufferLevelRule,
nextFragmentRequestRule,
scheduleWhilePaused,
initialQualityChange,
qualityChangeInProgress,
renderTimeCheckInterval;

function setup() {
qualityChangeInProgress = false;
initialPlayback = true;
initialQualityChange = true;
isStopped = false;
playListMetrics = null;
playListTraceMetrics = null;
Expand Down Expand Up @@ -275,9 +277,11 @@ function ScheduleController(config) {
throw new Error('Unexpected error! - currentRepresentationInfo is null or undefined');
}

if (e.oldQuality !== AbrController.QUALITY_DEFAULT) { //blocks init quality change
if (!initialQualityChange) { //blocks init quality change
qualityChangeInProgress = true;
eventBus.trigger(Events.QUALITY_CHANGE_START, {mediaType: e.mediaType, newQuality: e.newQuality, oldQuality: e.oldQuality});
} else {
initialQualityChange = false;
}

clearPlayListTraceMetrics(new Date(), PlayListTrace.REPRESENTATION_SWITCH_STOP_REASON);
Expand Down
5 changes: 0 additions & 5 deletions test/helpers/SpecHelper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class SpecHelper {
constructor() {
this.DEFAULT_QUALITY = -1;
this.EVENT_NOTIFICATION_DELAY = 200;
this.TIMEOUT_DELAY = 2000;
this.isHtmlRunner = false; //window.location.href.indexOf("runner.html") > 0;
Expand Down Expand Up @@ -28,10 +27,6 @@ class SpecHelper {
return this.TIMEOUT_DELAY;
}

getDefaultQuality() {
return this.DEFAULT_QUALITY;
}

getUnixTime() {
return new Date("01/01/1970 GMT");
}
Expand Down
2 changes: 1 addition & 1 deletion test/streaming.AbrControllerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("AbrController", function () {
const context = {};
const testType = 'video';
const voHelper = new VoHelper();
const defaultQuality = new SpecHelper().getDefaultQuality();
const defaultQuality = AbrController.QUALITY_DEFAULT;
const abrCtrl = AbrController(context).getInstance();
const dummyMediaInfo = voHelper.getDummyMediaInfo('video');
const representationCount = dummyMediaInfo.representationCount;
Expand Down

0 comments on commit fcacac5

Please sign in to comment.