Skip to content

Commit

Permalink
Handle DTS wrapping in initial AVC CTS calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Walch committed Aug 1, 2020
1 parent aa15efa commit 7c80447
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/remux/mp4-remuxer.js
Expand Up @@ -232,7 +232,7 @@ class MP4Remuxer {

if (!contiguous) {
const pts = timeOffset * timeScale;
const cts = inputSamples[0].pts - inputSamples[0].dts;
const cts = inputSamples[0].pts - PTSNormalize(inputSamples[0].dts, inputSamples[0].pts);
// if not contiguous, let's use target timeOffset
nextAvcDts = pts - cts;
}
Expand Down
14 changes: 8 additions & 6 deletions tests/functional/auto/setup.js
Expand Up @@ -123,18 +123,20 @@ async function testSmoothSwitch (url, config) {
const callback = arguments[arguments.length - 1];
window.startStream(url, config, callback);
const video = window.video;
window.hls.once(window.Hls.Events.FRAG_CHANGED, (event, data) => {
window.hls.once(window.Hls.Events.FRAG_CHANGED, (eventName, data) => {
console.log('[test] > ' + eventName + ' frag.level: ' + data.frag.level);
window.switchToHighestLevel('next');
});
window.hls.on(window.Hls.Events.LEVEL_SWITCHED, (event, data) => {
console.log('[test] > level switched: ' + data.level);
window.hls.on(window.Hls.Events.LEVEL_SWITCHED, (eventName, data) => {
console.log('[test] > ' + eventName + ' data.level: ' + data.level);
let currentTime = video.currentTime;
if (data.level === window.hls.levels.length - 1) {
console.log('[test] > switched on level: ' + data.level);
const highestLevel = (window.hls.levels.length - 1);
if (data.level === highestLevel) {
window.setTimeout(function () {
let newCurrentTime = video.currentTime;
console.log('[test] > currentTime delta : ' + (newCurrentTime - currentTime));
console.log('[test] > currentTime delta: ' + (newCurrentTime - currentTime));
callback({
highestLevel: highestLevel,
currentTimeDelta: newCurrentTime - currentTime,
logs: window.logString
});
Expand Down
7 changes: 1 addition & 6 deletions tests/test-streams.js
Expand Up @@ -35,15 +35,10 @@ function createTestStreamWithConfig (target, config) {
}

module.exports = {
bbb: createTestStreamWithConfig({
bbb: {
url: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
description: 'Big Buck Bunny - adaptive qualities'
},
{
// try to workaround test failing because of slow seek on Chrome/Win10
nudgeMaxRetry: 5
}
),
fdr: {
url: 'https://cdn.jwplayer.com/manifests/pZxWPRg4.m3u8',
description: 'FDR - CDN packaged, 4s segments, 180p - 1080p',
Expand Down

0 comments on commit 7c80447

Please sign in to comment.