Skip to content

Commit

Permalink
v0.11.0 regression fixes (video-dev#1867)
Browse files Browse the repository at this point in the history
- Reassign audio track ids after filtering
- Unassign level property from audio tracks and captions
- Fix performance now usage typo
  • Loading branch information
johnBartos authored Aug 13, 2018
1 parent 1838705 commit 04eee54
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/controller/audio-track-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class AudioTrackController extends TaskLoop {
}
// We need to match the (pre-)selected group ID
// and the NAME of the current track.
if ((!this.audioGroupId || track.groupId === this.audioGroupId) &&
if ((!this.audioGroupId || track.groupId === this.audioGroupId) &&
(!name || name === track.name)) {
// If there was a previous track try to stay with the same `NAME`.
// It should be unique across tracks of same group, and consistent through redundant track groups.
Expand Down
4 changes: 4 additions & 0 deletions src/controller/level-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ export default class LevelController extends EventHandler {

if (data.audioTracks) {
audioTracks = data.audioTracks.filter(track => !track.audioCodec || isCodecSupportedInMp4(track.audioCodec, 'audio'));
// Reassign id's after filtering since they're used as array indices
audioTracks.forEach((track, index) => {
track.id = index;
});
}

if (levels.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/demux/aacdemuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AACDemuxer {
let track = this._audioTrack;
let id3Data = ID3.getID3Data(data, 0) || [];
let timestamp = ID3.getTimeStamp(id3Data);
let pts = isNaN(timestamp) ? timeOffset * 90000 : timestamp * 90;
let pts = Number.isFinite(timestamp) ? timestamp * 90 : timeOffset * 90000;
let frameIndex = 0;
let stamp = pts;
let length = data.length;
Expand Down
2 changes: 1 addition & 1 deletion src/demux/demuxer-inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { getSelfScope } from '../utils/get-self-scope';

// see https://stackoverflow.com/a/11237259/589493
const global = getSelfScope(); // safeguard for code that might run both on worker and main thread
const performance = global;
const performance = global.performance;

class DemuxerInline {
constructor (observer, typeSupported, config, vendor) {
Expand Down
4 changes: 2 additions & 2 deletions src/loader/playlist-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ class PlaylistLoader extends EventHandler {
}

onAudioTrackLoading (data) {
this.load(data.url, { type: ContextType.AUDIO_TRACK, level: 0, id: data.id });
this.load(data.url, { type: ContextType.AUDIO_TRACK, level: null, id: data.id });
}

onSubtitleTrackLoading (data) {
this.load(data.url, { type: ContextType.SUBTITLE_TRACK, level: 0, id: data.id });
this.load(data.url, { type: ContextType.SUBTITLE_TRACK, level: null, id: data.id });
}

load (url, context) {
Expand Down

0 comments on commit 04eee54

Please sign in to comment.