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 download of some HLS assets #3934

Merged
merged 3 commits into from Feb 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 8 additions & 9 deletions lib/offline/storage.js
Expand Up @@ -681,16 +681,15 @@ shaka.offline.Storage = class {
* @private
*/
async filterManifest_(manifest, drmEngine, config) {
const StreamUtils = shaka.util.StreamUtils;

// Filter the manifest based on the restrictions given in the player
// configuration.
const maxHwRes = {width: Infinity, height: Infinity};
StreamUtils.filterByRestrictions(manifest, config.restrictions, maxHwRes);
shaka.util.StreamUtils.filterByRestrictions(
manifest, config.restrictions, maxHwRes);

// Filter the manifest based on what we know MediaCapabilities will be able
// to play later (no point storing something we can't play).
StreamUtils.filterManifestByMediaCapabilities(
await shaka.util.StreamUtils.filterManifestByMediaCapabilities(
manifest, config.offline.usePersistentLicense);

// Gather all tracks.
Expand All @@ -702,24 +701,24 @@ shaka.offline.Storage = class {
const preferredVideoCodecs = config.preferredVideoCodecs;
const preferredAudioCodecs = config.preferredAudioCodecs;

StreamUtils.chooseCodecsAndFilterManifest(
shaka.util.StreamUtils.chooseCodecsAndFilterManifest(
manifest, preferredVideoCodecs, preferredAudioCodecs,
preferredAudioChannelCount, preferredDecodingAttributes);

for (const variant of manifest.variants) {
goog.asserts.assert(
StreamUtils.isPlayable(variant),
shaka.util.StreamUtils.isPlayable(variant),
'We should have already filtered by "is playable"');

allTracks.push(StreamUtils.variantToTrack(variant));
allTracks.push(shaka.util.StreamUtils.variantToTrack(variant));
}

for (const text of manifest.textStreams) {
allTracks.push(StreamUtils.textStreamToTrack(text));
allTracks.push(shaka.util.StreamUtils.textStreamToTrack(text));
}

for (const image of manifest.imageStreams) {
allTracks.push(StreamUtils.imageStreamToTrack(image));
allTracks.push(shaka.util.StreamUtils.imageStreamToTrack(image));
}

// Let the application choose which tracks to store.
Expand Down