Skip to content

Commit

Permalink
fix: Do not request for the initialization segment if it is not neces…
Browse files Browse the repository at this point in the history
…sary.
  • Loading branch information
avelad committed Jun 27, 2024
1 parent 19cfbf9 commit 68ee757
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -2652,7 +2652,6 @@ shaka.media.StreamingEngine = class {
mediaState.clearBufferSafeMargin = 0;
mediaState.clearingBuffer = true;
mediaState.lastSegmentReference = null;
mediaState.lastInitSegmentReference = null;
mediaState.segmentIterator = null;

shaka.log.debug(logPrefix, 'clearing buffer');
Expand Down
7 changes: 4 additions & 3 deletions test/media/streaming_engine_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1180,12 +1180,13 @@ describe('StreamingEngine', () => {

const segmentType = shaka.net.NetworkingEngine.RequestType.SEGMENT;
const segmentContext = {
type: shaka.net.NetworkingEngine.AdvancedRequestType.INIT_SEGMENT,
type: shaka.net.NetworkingEngine.AdvancedRequestType.MEDIA_SEGMENT,
};

// Quickly switching back to text1, and text init segment should be
// Quickly switching back to text1, and text init segment shouldn't be
// fetched again.
netEngine.expectRequest('text-20-init', segmentType, segmentContext);
netEngine.expectRequest('text-20-0.mp4', segmentType, segmentContext);
netEngine.expectNoRequest('text-20-init', segmentType, segmentContext);
netEngine.expectNoRequest('text-21-init', segmentType, segmentContext);
// TODO: huh?
});
Expand Down

0 comments on commit 68ee757

Please sign in to comment.