-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(DASH): Fix playback of some DASH with multiple periods #7519
base: main
Are you sure you want to change the base?
Changes from all commits
20116e8
91b601e
9c80790
133bdd9
3637d23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,13 @@ shaka.extern.ManifestParser = class { | |
* @exportDoc | ||
*/ | ||
setMediaElement(mediaElement) {} | ||
|
||
/** | ||
* provide CloseSegmentIndexRegister | ||
* @param {shaka.util.CloseSegmentIndexRegister} register | ||
* @exportDoc | ||
*/ | ||
setCloseSegmentIndexRegister(register) {} | ||
Comment on lines
+124
to
+129
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we want to add new method to publicly exposed interface, it will need to be documented better. |
||
}; | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,6 +230,18 @@ shaka.dash.DashParser = class { | |
} | ||
} | ||
|
||
/** | ||
* @override | ||
* @exportInterface | ||
*/ | ||
setCloseSegmentIndexRegister(register) { | ||
const parser = this; | ||
const closeSegmentIndexes = () => { | ||
parser.handleDeferredCloseSegmentIndexes(); | ||
}; | ||
register.add(closeSegmentIndexes); | ||
} | ||
|
||
/** | ||
* @override | ||
* @exportInterface | ||
|
@@ -1491,6 +1503,17 @@ shaka.dash.DashParser = class { | |
} | ||
} | ||
|
||
/** | ||
* Handles deferred releases of old SegmentIndexes | ||
* content type from a previous update. | ||
* @export | ||
Comment on lines
+1507
to
+1509
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not a part of public interface, don't export it |
||
*/ | ||
handleDeferredCloseSegmentIndexes() { | ||
if (this.periodCombiner_) { | ||
this.periodCombiner_.handleDeferredCloseSegmentIndexes(); | ||
} | ||
} | ||
|
||
/** | ||
* Clean StreamMap Object to remove reference of deleted Stream Object | ||
* @private | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,6 +308,17 @@ shaka.media.SegmentIndex = class { | |
this.numEvicted_ += diff; | ||
} | ||
|
||
/** | ||
* Removes all SegmentReferences that end before the given time. | ||
* @export | ||
*/ | ||
evictAll() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it was exported, it should be defined in |
||
if (this.references.length) { | ||
this.numEvicted_ += this.references.length; | ||
this.references = []; | ||
} | ||
} | ||
|
||
|
||
/** | ||
* Drops references that start after windowEnd, or end before windowStart, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
goog.provide('shaka.util.CloseSegmentIndexRegister'); | ||
|
||
/** | ||
* @summary a register which provides an interface | ||
* to close shaka.media.SegmentIndex | ||
* @export | ||
*/ | ||
shaka.util.CloseSegmentIndexRegister = class { | ||
/** */ | ||
constructor() { | ||
/** @private {!Array.<Function>} */ | ||
this.register_ = []; | ||
} | ||
|
||
/** | ||
* add function which closes shaka.media.SegmentIndex | ||
* from the stream | ||
* @param {Function} closeSegmentIndexFunction | ||
*/ | ||
add(closeSegmentIndexFunction) { | ||
if (closeSegmentIndexFunction) { | ||
this.register_.push(closeSegmentIndexFunction); | ||
} | ||
} | ||
|
||
/** | ||
* close shaka.media.SegmentIndex from register | ||
*/ | ||
closeSegmentIndexes() { | ||
for (const closeSegmentIndexFunction of this.register_) { | ||
if (closeSegmentIndexFunction) { | ||
closeSegmentIndexFunction(); | ||
} | ||
} | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already
lib/media/segment_index
, 2 same file names in different spaces might be confusing