Skip to content

Commit

Permalink
fix(dash): live to vod transition seek start (#7347)
Browse files Browse the repository at this point in the history
Fixes #7346

---------

Co-authored-by: Álvaro Velad Galván <[email protected]>
  • Loading branch information
2 people authored and joeyparrish committed Sep 26, 2024
1 parent a31369b commit f4ef439
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 8 deletions.
8 changes: 7 additions & 1 deletion lib/media/presentation_timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ shaka.media.PresentationTimeline = class {
/** @private {boolean} */
this.static_ = true;

/** @private {boolean} */
this.isLive2VodTransition_ = false;

/** @private {number} */
this.userSeekStart_ = 0;

Expand Down Expand Up @@ -179,6 +182,9 @@ shaka.media.PresentationTimeline = class {
*/
setStatic(isStatic) {
// NOTE: the argument name is not "static" because that's a keyword in ES6
if (isStatic && !this.static_) {
this.isLive2VodTransition_ = true;
}
this.static_ = isStatic;
}

Expand Down Expand Up @@ -384,7 +390,7 @@ shaka.media.PresentationTimeline = class {
// No data yet, and Math.min(null, startTime) is always 0. So just store
// startTime.
this.minSegmentStartTime_ = startTime;
} else {
} else if (!this.isLive2VodTransition_) {
this.minSegmentStartTime_ =
Math.min(this.minSegmentStartTime_, startTime);
}
Expand Down
6 changes: 4 additions & 2 deletions test/player_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ describe('Player', () => {
// Play the stream.
await player.load('/base/test/test/assets/3675/dash_0.mpd');
await video.play();

const seekRangeForStart = player.seekRange();
const start = seekRangeForStart.start;
// Wait for the stream to be over.
eventManager.listen(player, 'error', Util.spyFunc(onErrorSpy));
/** @type {shaka.test.Waiter} */
Expand All @@ -97,7 +98,8 @@ describe('Player', () => {

// Check that the final seek range is as expected.
const seekRange = player.seekRange();
expect(seekRange.end).toBeCloseTo(14);
expect(seekRange.end).toBeCloseTo(24);
expect(seekRange.start).toBeCloseTo(start);
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/test/assets/3675/dash_0.mpd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ProgramInformation>
<ServiceDescription id="0">
</ServiceDescription>
<Period id="0" start="PT0.0S">
<Period id="0" start="PT10.0S">
<AdaptationSet id="0" contentType="video" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true" frameRate="30/1" maxWidth="1280" maxHeight="720" par="16:9">
<Representation id="0" mimeType="video/mp4" codecs="avc1.64001f" bandwidth="122012" width="1280" height="720" sar="1:1">
<SegmentTemplate timescale="15360" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">
Expand Down
2 changes: 1 addition & 1 deletion test/test/assets/3675/dash_1.mpd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ProgramInformation>
<ServiceDescription id="0">
</ServiceDescription>
<Period id="0" start="PT0.0S">
<Period id="0" start="PT10.0S">
<AdaptationSet id="0" contentType="video" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true" frameRate="30/1" maxWidth="1280" maxHeight="720" par="16:9">
<Representation id="0" mimeType="video/mp4" codecs="avc1.64001f" bandwidth="122012" width="1280" height="720" sar="1:1">
<SegmentTemplate timescale="15360" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">
Expand Down
2 changes: 1 addition & 1 deletion test/test/assets/3675/dash_2.mpd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ProgramInformation>
<ServiceDescription id="0">
</ServiceDescription>
<Period id="0" start="PT0.0S">
<Period id="0" start="PT10.0S">
<AdaptationSet id="0" contentType="video" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true" frameRate="30/1" maxWidth="1280" maxHeight="720" par="16:9">
<Representation id="0" mimeType="video/mp4" codecs="avc1.64001f" bandwidth="122012" width="1280" height="720" sar="1:1">
<SegmentTemplate timescale="15360" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">
Expand Down
2 changes: 1 addition & 1 deletion test/test/assets/3675/dash_3.mpd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ProgramInformation>
<ServiceDescription id="0">
</ServiceDescription>
<Period id="0" start="PT0.0S">
<Period id="0" start="PT10.0S">
<AdaptationSet id="0" contentType="video" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true" frameRate="30/1" maxWidth="1280" maxHeight="720" par="16:9">
<Representation id="0" mimeType="video/mp4" codecs="avc1.64001f" bandwidth="122012" width="1280" height="720" sar="1:1">
<SegmentTemplate timescale="15360" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="1">
Expand Down
2 changes: 1 addition & 1 deletion test/test/assets/3675/dash_4.mpd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ProgramInformation>
<ServiceDescription id="0">
</ServiceDescription>
<Period id="0" start="PT0.0S">
<Period id="0" start="PT10.0S">
<AdaptationSet id="0" contentType="video" startWithSAP="1" segmentAlignment="true" bitstreamSwitching="true" frameRate="30/1" maxWidth="1280" maxHeight="720" par="16:9">
<Representation id="0" mimeType="video/mp4" codecs="avc1.64001f" bandwidth="122012" width="1280" height="720" sar="1:1">
<SegmentTemplate timescale="15360" initialization="init-stream$RepresentationID$.m4s" media="chunk-stream$RepresentationID$-$Number%05d$.m4s" startNumber="3">
Expand Down

0 comments on commit f4ef439

Please sign in to comment.