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

refactor: offload mp4/ts probe to web worker #1117

Merged
merged 8 commits into from
Apr 22, 2021

Conversation

brandonocasey
Copy link
Contributor

Description

offloads ts / mp4 probing to the web worker saving us ~600 gzipped bytes.

@brandonocasey brandonocasey changed the title refactor: offload mp4 ts probe refactor: offload mp4/ts probe to web worker Apr 9, 2021
@codecov
Copy link

codecov bot commented Apr 9, 2021

Codecov Report

Merging #1117 (5bbf0a9) into main (82ff4f5) will increase coverage by 0.09%.
The diff coverage is 96.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1117      +/-   ##
==========================================
+ Coverage   86.30%   86.40%   +0.09%     
==========================================
  Files          38       39       +1     
  Lines        9072     9628     +556     
  Branches     2054     2176     +122     
==========================================
+ Hits         7830     8319     +489     
- Misses       1242     1309      +67     
Impacted Files Coverage Δ
src/util/segment.js 100.00% <ø> (ø)
src/util/worker-callback.js 91.66% <91.66%> (ø)
src/media-segment-request.js 96.19% <97.91%> (+0.46%) ⬆️
src/transmuxer-worker.js 76.04% <100.00%> (+1.93%) ⬆️

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 82ff4f5...5bbf0a9. Read the comment docs.

@brandonocasey brandonocasey force-pushed the refactor/offload-mp4-ts-probe branch from 270c34a to be43752 Compare April 12, 2021 16:09
// start time. Meaning cached frame data may corrupt our notion of where this segment
// really starts. To get around this, full segment appends should probe for the info
// needed.
workerCallback({
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing I'm curious about is now that this is asynchronous, the trackInfo, audioStart, and videoStart functions may come from different places (either from the probe or from the transmuxer). Due to cached data in the transmuxer, I wonder if this could lead to some different behavior due to race conditions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't send anything to the transmuxer until the probe comes back, so I wouldn't think so.

Copy link
Contributor

Choose a reason for hiding this comment

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

Missed that, you're right 👍

@@ -911,8 +936,7 @@ QUnit.module('SegmentLoader', function(hooks) {
this.clock.tick(1);

// decryption tick for syncWorker
this.clock.tick(1);

this.clock.tick(2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth adding a comment for the extra tick

}
transmuxer.removeEventListener('message', listenForEndEvent);

// transfer ownership of bytes back to us.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the ownership is transferred here, do we need to transfer the ownership again in the media-segment-request users of workerCallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do for anywhere else the data is referenced.

@brandonocasey brandonocasey merged commit 3c9f721 into main Apr 22, 2021
@brandonocasey brandonocasey deleted the refactor/offload-mp4-ts-probe branch April 22, 2021 18:47
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.

2 participants