Constructor
new PeriodCombiner()
- Implements:
- Source:
Members
BetterOrWorse :number
Type:
Properties:
Name |
Value |
Type |
Description |
BETTER |
1
|
number
|
|
EQUAL |
0
|
number
|
|
WORSE |
-1
|
number
|
|
- Source:
usedPeriodIds_ :Set.<string>
The IDs of the periods we have already used to generate streams.
This helps us identify the periods which have been added when a live
stream is updated.
Type:
- Source:
Methods
areAVStreamsCompatible_(outputStream, candidate) → {boolean}
Parameters:
Name |
Type |
Description |
outputStream |
T
|
An audio or video output stream |
candidate |
T
|
A candidate stream to be combined with the output |
- Source:
Returns:
True if the candidate could be combined with the
output stream
-
Type
-
boolean
areImageStreamsCompatible_(outputStream, candidate) → {boolean}
Parameters:
Name |
Type |
Description |
outputStream |
T
|
A image output stream |
candidate |
T
|
A candidate stream to be combined with the output |
- Source:
Returns:
True if the candidate could be combined with the
output
-
Type
-
boolean
areTextStreamsCompatible_(outputStream, candidate) → {boolean}
Parameters:
Name |
Type |
Description |
outputStream |
T
|
A text output stream |
candidate |
T
|
A candidate stream to be combined with the output |
- Source:
Returns:
True if the candidate could be combined with the
output
-
Type
-
boolean
Clone a Stream to make an output Stream for combining others across
periods.
Parameters:
- Source:
Returns:
-
Type
-
shaka.extern.Stream
Clone a StreamDB to make an output stream for combining others across
periods.
Parameters:
- Source:
Returns:
-
Type
-
shaka.extern.StreamDB
combine_(outputStreamsnon-null, streamsPerPeriodnon-null, firstNewPeriodIndex, clone, concat) → {Promise.<!Array.<T>>}
Combine input Streams per period into flat output Streams.
Templatized to handle both DASH Streams and offline StreamDBs.
Parameters:
Name |
Type |
Description |
outputStreams |
Array.<T>
|
A list of existing output streams, to
facilitate updates for live DASH content. Will be modified and returned. |
streamsPerPeriod |
Array.<!Array.<T>>
|
A list of lists of Streams
from each period. |
firstNewPeriodIndex |
number
|
An index into streamsPerPeriod which
represents the first new period that hasn't been processed yet. |
clone |
function(T):T
|
Make a clone of an input stream. |
concat |
function(T, T)
|
Concatenate the second stream onto the end
of the first. |
- Source:
Returns:
The same array passed to outputStreams,
modified to include any newly-created streams.
-
Type
-
Promise.<!Array.<T>>
combineDbStreams(streamDbsPerPeriodnon-null) → {Promise.<!Array.<shaka.extern.StreamDB>>}
Stitch together DB streams across periods, taking a mix of stream types.
The offline database does not separate these by type.
Unlike the DASH case, this does not need to maintain any state for manifest
updates.
Parameters:
- Source:
Returns:
-
Type
-
Promise.<!Array.<shaka.extern.StreamDB>>
Compare the best value so far with the candidate value and the output
value. Decide if the candidate is better, equal, or worse than the best
so far. Any value less than or equal to the output is preferred over a
larger value, and closer to the output is better than farther.
This provides us a generic way to choose things that should match as
closely as possible, like resolution, frame rate, audio channels, or
sample rate. If we have to go higher to make a match, we will. But if
the user selects 480p, for example, we don't want to surprise them with
720p and waste bandwidth if there's another choice available to us.
Parameters:
Name |
Type |
Description |
outputValue |
number
|
|
bestValue |
number
|
|
candidateValue |
number
|
|
- Source:
Returns:
-
Type
-
shaka.util.PeriodCombiner.BetterOrWorse
concatenateStreamDBs_(output, input)
Combine the various fields of the input StreamDB into the output.
Parameters:
- Source:
concatenateStreams_(output, input)
Combine the various fields of the input Stream into the output.
Parameters:
- Source:
createNewOutputStream_(stream, streamsPerPeriodnon-null, clone, concat, unusedStreamsPerPeriodnon-null) → {Promise.<?T>}
Create a new output Stream based on a particular input Stream. Locates
matching Streams in all other periods and combines them into an output
Stream.
Templatized to handle both DASH Streams and offline StreamDBs.
Parameters:
Name |
Type |
Description |
stream |
T
|
An input stream on which to base the output stream. |
streamsPerPeriod |
Array.<!Array.<T>>
|
A list of lists of Streams
from each period. |
clone |
function(T):T
|
Make a clone of an input stream. |
concat |
function(T, T)
|
Concatenate the second stream onto the end
of the first. |
unusedStreamsPerPeriod |
Array.<!Set.<T>>
|
An array of sets of
unused streams from each period. |
- Source:
Returns:
A newly-created output Stream, or null if matches
could not be found.`
-
Type
-
Promise.<?T>
createSegmentIndexes_(streamsnon-null) → {Promise}
Creates all segment indexes for an array of streams. Returns once every
segment index is created.
Parameters:
- Source:
Returns:
-
Type
-
Promise
Create a dummy Stream to fill in periods that are missing a certain type,
to avoid failing the general flattening algorithm. This won't be used for
audio or video, since those are strictly required in all periods if they
exist in any period.
Parameters:
- Source:
Returns:
-
Type
-
shaka.extern.Stream
Create a dummy StreamDB to fill in periods that are missing a certain type,
to avoid failing the general flattening algorithm. This won't be used for
audio or video, since those are strictly required in all periods if they
exist in any period.
Parameters:
- Source:
Returns:
-
Type
-
shaka.extern.StreamDB
extendExistingOutputStream_(outputStream, streamsPerPeriodnon-null, firstNewPeriodIndex, concat, unusedStreamsPerPeriodnon-null) → {Promise.<boolean>}
Parameters:
Name |
Type |
Description |
outputStream |
T
|
An existing output stream which needs to be
extended into new periods. |
streamsPerPeriod |
Array.<!Array.<T>>
|
A list of lists of Streams
from each period. |
firstNewPeriodIndex |
number
|
An index into streamsPerPeriod which
represents the first new period that hasn't been processed yet. |
concat |
function(T, T)
|
Concatenate the second stream onto the end
of the first. |
unusedStreamsPerPeriod |
Array.<!Set.<T>>
|
An array of sets of
unused streams from each period. |
- Source:
Returns:
-
Type
-
Promise.<boolean>
extendOutputStream_(outputStream, matchesnon-null, firstNewPeriodIndex, concat, unusedStreamsPerPeriodnon-null)
Parameters:
Name |
Type |
Description |
outputStream |
T
|
An existing output stream which needs to be
extended into new periods. |
matches |
Array.<T>
|
A list of matching Streams from each period. |
firstNewPeriodIndex |
number
|
An index into streamsPerPeriod which
represents the first new period that hasn't been processed yet. |
concat |
function(T, T)
|
Concatenate the second stream onto the end
of the first. |
unusedStreamsPerPeriod |
Array.<!Set.<T>>
|
An array of sets of
unused streams from each period. |
- Source:
filterOutAudioStreamDuplicates_(periodsnon-null)
Parameters:
- Source:
filterOutImageStreamDuplicates_(periodsnon-null)
Parameters:
- Source:
filterOutTextStreamDuplicates_(periodsnon-null)
Parameters:
- Source:
filterOutVideoStreamDuplicates_(periodsnon-null)
Parameters:
- Source:
findBestMatchInPeriod_(streamsnon-null, outputStream) → {T}
Find the best match for the output stream.
Parameters:
Name |
Type |
Description |
streams |
Array.<T>
|
|
outputStream |
T
|
|
- Source:
Returns:
Returns null if no match can be found.
-
Type
-
T
findMatchesInAllPeriods_(streamsPerPeriodnon-null, outputStream) → {Array.<T>}
Finds streams in all periods which match the output stream.
Parameters:
Name |
Type |
Description |
streamsPerPeriod |
Array.<!Array.<T>>
|
|
outputStream |
T
|
|
- Source:
Returns:
-
Type
-
Array.<T>
isAudioStreamBetterMatch_(outputStream, best, candidate) → {boolean}
Parameters:
Name |
Type |
Description |
outputStream |
T
|
An audio output stream |
best |
T
|
The best match so far for this period |
candidate |
T
|
A candidate stream which might be better |
- Source:
Returns:
True if the candidate is a better match
-
Type
-
boolean
isImageStreamBetterMatch_(outputStream, best, candidate) → {boolean}
Parameters:
Name |
Type |
Description |
outputStream |
T
|
A image output stream |
best |
T
|
The best match so far for this period |
candidate |
T
|
A candidate stream which might be better |
- Source:
Returns:
True if the candidate is a better match
-
Type
-
boolean
isTextStreamBetterMatch_(outputStream, best, candidate) → {boolean}
Parameters:
Name |
Type |
Description |
outputStream |
T
|
A text output stream |
best |
T
|
The best match so far for this period |
candidate |
T
|
A candidate stream which might be better |
- Source:
Returns:
True if the candidate is a better match
-
Type
-
boolean
isVideoStreamBetterMatch_(outputStream, best, candidate) → {boolean}
Parameters:
Name |
Type |
Description |
outputStream |
T
|
A video output stream |
best |
T
|
The best match so far for this period |
candidate |
T
|
A candidate stream which might be better |
- Source:
Returns:
True if the candidate is a better match
-
Type
-
boolean
combinePeriods(periodsnon-null, isDynamic) → {Promise}
Parameters:
- Source:
Returns:
-
Type
-
Promise
release()
Request that this object release all internal references.
- Implements:
- Source:
Type Definitions
Period
Contains the streams from one DASH period.
Type:
Properties:
- Source: