Skip to content

Commit dfbbdbe

Browse files
authored
Fix/end number (Dash-Industry-Forum#4749)
* Fix minor bug in DashHandler.js when checking for endNumber. * Add check for replacement number in unit tests
1 parent 6957423 commit dfbbdbe

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/dash/DashHandler.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ function DashHandler(config) {
282282
}
283283

284284
let indexToRequest = lastSegment ? lastSegment.index + 1 : 0;
285-
if (representation && lastSegment && representation.endNumber && lastSegment.replacementNumber && lastSegment.replacementNumber > representation.endNumber) {
285+
if (representation && lastSegment && representation.endNumber && lastSegment.replacementNumber && lastSegment.replacementNumber >= representation.endNumber) {
286+
mediaHasFinished = true;
286287
return null;
287288
}
288289

test/unit/test/dash/dash.utils.TemplateSegmentsGetter.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ describe('TemplateSegmentsGetter', () => {
105105

106106
let seg = templateSegmentsGetter.getSegmentByIndex(representation, 3);
107107
expect(seg.index).to.equal(3);
108+
expect(seg.replacementNumber).to.equal(3);
108109
})
109110

110111
it('should not return null if segment is equal to endNumber and startNumber is 2', () => {
@@ -116,6 +117,7 @@ describe('TemplateSegmentsGetter', () => {
116117

117118
let seg = templateSegmentsGetter.getSegmentByIndex(representation, 3);
118119
expect(seg.index).to.equal(3);
120+
expect(seg.replacementNumber).to.equal(5);
119121
})
120122

121123
it('should return null if segment is after endNumber', () => {
@@ -126,7 +128,7 @@ describe('TemplateSegmentsGetter', () => {
126128
representation.endNumber = 2;
127129

128130
let seg = templateSegmentsGetter.getSegmentByIndex(representation, 3);
129-
expect(seg).to.be.null; // jshint ignore:line
131+
expect(seg).to.be.null;
130132
})
131133

132134
it('should return null if segment is after endNumber and startNumber is 2', () => {
@@ -137,7 +139,7 @@ describe('TemplateSegmentsGetter', () => {
137139
representation.endNumber = 5;
138140

139141
let seg = templateSegmentsGetter.getSegmentByIndex(representation, 4);
140-
expect(seg).to.be.null; // jshint ignore:line
142+
expect(seg).to.be.null;
141143
})
142144
});
143145

0 commit comments

Comments
 (0)