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: check sidx on sidxmapping, check that end > start on remove #1121

Merged
merged 4 commits into from
Apr 23, 2021

Conversation

brandonocasey
Copy link
Contributor

@brandonocasey brandonocasey commented Apr 20, 2021

Description

Fixes two console errors that can be seen on dash sidx playlists right now during a rendition switch.

Fixes #1120

@@ -140,7 +140,8 @@ export const updateMaster = (oldMaster, newMaster, sidxMapping) => {
if (playlist.sidx) {
const sidxKey = generateSidxKey(playlist.sidx);

if (sidxMapping && sidxMapping[sidxKey]) {
// add sidx segments to the playlist if we have all the sidx info already
if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in addSidxSegmentsToPlaylist we try to use sidxMappind[sidxKey].sidx but it can be undefined if the request for sidx and parsing is still in progress (at which point it will be added). So we need to add the additional key check here.

@codecov
Copy link

codecov bot commented Apr 20, 2021

Codecov Report

Merging #1121 (85a500f) into main (3c9f721) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1121   +/-   ##
=======================================
  Coverage   86.40%   86.40%           
=======================================
  Files          39       39           
  Lines        9628     9631    +3     
  Branches     2176     2177    +1     
=======================================
+ Hits         8319     8322    +3     
  Misses       1309     1309           
Impacted Files Coverage Δ
src/dash-playlist-loader.js 90.05% <100.00%> (+0.28%) ⬆️
src/segment-loader.js 95.33% <100.00%> (+0.01%) ⬆️
src/source-updater.js 94.19% <0.00%> (-0.33%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c9f721...85a500f. Read the comment docs.

// skip removes that would throw an error
// commonly happens during a rendition switch at the start of a video
// from start 0 to end 0
if (end <= start) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was seeing a sourcebuffer remove error being thrown when trying to remove from 0 -> 0 at the start of a video, as end is <= start.

Copy link
Contributor

@gesinger gesinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Would maybe be good to have a couple tests around the behavior.

Comment on lines +2637 to +2643
loader.remove(0, 0, () => {});
assert.equal(audioRemoves, 0, 'no audio remove');
assert.equal(videoRemoves, 0, 'no video remove');

loader.remove(5, 4, () => {});
assert.equal(audioRemoves, 0, 'no audio remove');
assert.equal(videoRemoves, 0, 'no video remove');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worth having one positive case after to ensure that the removes would be incremented appropriately.

@brandonocasey brandonocasey merged commit 92f1333 into main Apr 23, 2021
@brandonocasey brandonocasey deleted the fix/error-checks branch April 23, 2021 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Manually selecting quality triggers: Cannot read 'timescale' of undefined
2 participants