Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression for representationInfo's segmentDuration #3284

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/dash/controllers/RepresentationController.js
Expand Up @@ -38,6 +38,7 @@ function RepresentationController(config) {
const eventBus = config.eventBus;
const events = config.events;
const errors = config.errors;
const indexHandler = config.indexHandler;
const abrController = config.abrController;
const dashMetrics = config.dashMetrics;
const playbackController = config.playbackController;
Expand Down Expand Up @@ -111,6 +112,12 @@ function RepresentationController(config) {
voAvailableRepresentations = availableRepresentations;

currentVoRepresentation = getRepresentationForQuality(quality);

// In case segmentDuration is not set (ex. SegmentTimeline), request a segment to determine the segmentDuration
if (currentVoRepresentation && isNaN(currentVoRepresentation.segmentDuration)) {
indexHandler.getSegmentRequestForTime(null, currentVoRepresentation, 0);
}

realAdaptation = newRealAdaptation;

if (type !== Constants.VIDEO && type !== Constants.AUDIO && type !== Constants.FRAGMENTED_TEXT) {
Expand Down Expand Up @@ -158,6 +165,10 @@ function RepresentationController(config) {
}

function updateRepresentation(representation, isDynamic) {
// In case segmentDuration is not set (ex. SegmentTimeline), request a segment to determine the segmentDuration
if (isNaN(representation.segmentDuration)) {
indexHandler.getSegmentRequestForTime(null, representation, 0);
}
representation.segmentAvailabilityRange = timelineConverter.calcSegmentAvailabilityRange(representation, isDynamic);

if ((representation.segmentAvailabilityRange.end < representation.segmentAvailabilityRange.start) && !representation.useCalculatedLiveEdgeTime) {
Expand Down
4 changes: 1 addition & 3 deletions src/streaming/StreamProcessor.js
Expand Up @@ -138,6 +138,7 @@ function StreamProcessor(config) {
representationController = RepresentationController(context).create({
streamId: streamInfo.id,
type: type,
indexHandler: indexHandler,
abrController: abrController,
dashMetrics: dashMetrics,
playbackController: playbackController,
Expand Down Expand Up @@ -544,9 +545,6 @@ function StreamProcessor(config) {
const quality = chunk.quality;
const currentRepresentation = getRepresentationInfo(quality);

// Update current representation info (to update fragmentDuration for example in case of SegmentTimeline)
scheduleController.setCurrentRepresentation(currentRepresentation);

const voRepresentation = representationController && currentRepresentation ? representationController.getRepresentationForQuality(currentRepresentation.quality) : null;
const eventStreamMedia = adapter.getEventsFor(currentRepresentation.mediaInfo);
const eventStreamTrack = adapter.getEventsFor(currentRepresentation, voRepresentation);
Expand Down