Skip to content

Commit

Permalink
adress review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrelltle committed Dec 10, 2022
1 parent 5fb54ca commit b1690c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions externs/shaka/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1081,9 +1081,9 @@ shaka.extern.ManifestConfiguration;
* @property {boolean} segmentPrefetchLimit
* The maximum number of segments for each active stream to be prefetched
* ahead of playhead in parallel.
* If <code>null</code> or <code><1</code>, the segments will be fetched
* If <code>0</code>, the segments will be fetched
* sequentially.
* Defaults to <code>null</code>.
* Defaults to <code>0</code>.
* @exportDoc
*/
shaka.extern.StreamingConfiguration;
Expand Down
16 changes: 9 additions & 7 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,8 @@ shaka.media.StreamingEngine = class {
if (state.segmentPrefetch) {
state.segmentPrefetch.resetLimit(config.segmentPrefetchLimit);
if (!(config.segmentPrefetchLimit > 0)) {
/**
* ResetLimit is still needed in this case,
* to abort existing prefetch operations.
*/
// ResetLimit is still needed in this case,
// to abort existing prefetch operations.
state.segmentPrefetch = null;
}
} else if (config.segmentPrefetchLimit > 0) {
Expand Down Expand Up @@ -1142,6 +1140,7 @@ shaka.media.StreamingEngine = class {
return null;
}


/**
* Gets the next timestamp needed. Returns the playhead's position if the
* buffer is empty; otherwise, returns the time at which the last segment
Expand Down Expand Up @@ -2071,7 +2070,6 @@ shaka.media.StreamingEngine = class {
*
* @return {!shaka.net.NetworkingEngine.PendingRequest}
* @private
* @suppress {strictMissingProperties}
*/
dispatchFetch_(reference, stream, streamDataCallback) {
const requestType = shaka.net.NetworkingEngine.RequestType.SEGMENT;
Expand All @@ -2084,13 +2082,17 @@ shaka.media.StreamingEngine = class {
streamDataCallback);

shaka.log.v2('fetching: reference=', reference);

let duration = 0;
if ((reference instanceof shaka.media.SegmentReference)) {
// start and endTime are not defined in InitSegmentReference
duration = reference.endTime - reference.startTime;
}
this.playerInterface_.modifySegmentRequest(
request,
{
type: stream.type,
init: reference instanceof shaka.media.InitSegmentReference,
duration: reference.endTime - reference.startTime,
duration: duration,
mimeType: stream.mimeType,
codecs: stream.codecs,
bandwidth: stream.bandwidth,
Expand Down

0 comments on commit b1690c8

Please sign in to comment.