hls.js 1.5.9-0.canary.10181 → 1.5.9-0.canary.10182
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hls-demo.js +6 -0
- package/dist/hls-demo.js.map +1 -1
- package/dist/hls.js +24 -26
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +23 -25
- package/dist/hls.light.js.map +1 -1
- package/dist/hls.light.min.js +1 -1
- package/dist/hls.light.min.js.map +1 -1
- package/dist/hls.light.mjs +23 -25
- package/dist/hls.light.mjs.map +1 -1
- package/dist/hls.min.js +1 -1
- package/dist/hls.min.js.map +1 -1
- package/dist/hls.mjs +24 -26
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/dist/hls.worker.js.map +1 -1
- package/package.json +1 -1
- package/src/demux/video/avc-video-parser.ts +1 -1
- package/src/demux/video/base-video-parser.ts +20 -23
- package/src/demux/video/hevc-video-parser.ts +1 -1
- package/src/types/demuxer.ts +1 -0
package/package.json
CHANGED
@@ -17,7 +17,7 @@ class AvcVideoParser extends BaseVideoParser {
|
|
17
17
|
last: boolean,
|
18
18
|
duration: number,
|
19
19
|
) {
|
20
|
-
const units = this.parseNALu(track, pes.data);
|
20
|
+
const units = this.parseNALu(track, pes.data, last);
|
21
21
|
const debug = false;
|
22
22
|
let VideoSample = this.VideoSample;
|
23
23
|
let push: boolean;
|
@@ -29,22 +29,6 @@ abstract class BaseVideoParser {
|
|
29
29
|
};
|
30
30
|
}
|
31
31
|
|
32
|
-
protected getLastNalUnit(
|
33
|
-
samples: VideoSample[],
|
34
|
-
): VideoSampleUnit | undefined {
|
35
|
-
let VideoSample = this.VideoSample;
|
36
|
-
let lastUnit: VideoSampleUnit | undefined;
|
37
|
-
// try to fallback to previous sample if current one is empty
|
38
|
-
if (!VideoSample || VideoSample.units.length === 0) {
|
39
|
-
VideoSample = samples[samples.length - 1];
|
40
|
-
}
|
41
|
-
if (VideoSample?.units) {
|
42
|
-
const units = VideoSample.units;
|
43
|
-
lastUnit = units[units.length - 1];
|
44
|
-
}
|
45
|
-
return lastUnit;
|
46
|
-
}
|
47
|
-
|
48
32
|
protected pushAccessUnit(
|
49
33
|
VideoSample: ParsedVideoSample,
|
50
34
|
videoTrack: DemuxedVideoTrack,
|
@@ -86,6 +70,7 @@ abstract class BaseVideoParser {
|
|
86
70
|
protected parseNALu(
|
87
71
|
track: DemuxedVideoTrack,
|
88
72
|
array: Uint8Array,
|
73
|
+
last: boolean,
|
89
74
|
): Array<{
|
90
75
|
data: Uint8Array;
|
91
76
|
type: number;
|
@@ -133,6 +118,10 @@ abstract class BaseVideoParser {
|
|
133
118
|
data: array.subarray(lastUnitStart, overflow),
|
134
119
|
type: lastUnitType,
|
135
120
|
};
|
121
|
+
if (track.lastNalu) {
|
122
|
+
units.push(track.lastNalu);
|
123
|
+
track.lastNalu = null;
|
124
|
+
}
|
136
125
|
// logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength);
|
137
126
|
units.push(unit);
|
138
127
|
} else {
|
@@ -140,7 +129,7 @@ abstract class BaseVideoParser {
|
|
140
129
|
// first check if start code delimiter is overlapping between 2 PES packets,
|
141
130
|
// ie it started in last packet (lastState not zero)
|
142
131
|
// and ended at the beginning of this PES packet (i <= 4 - lastState)
|
143
|
-
const lastUnit =
|
132
|
+
const lastUnit = track.lastNalu;
|
144
133
|
if (lastUnit) {
|
145
134
|
if (lastState && i <= 4 - lastState) {
|
146
135
|
// start delimiter overlapping between PES packets
|
@@ -163,6 +152,8 @@ abstract class BaseVideoParser {
|
|
163
152
|
array.subarray(0, overflow),
|
164
153
|
);
|
165
154
|
lastUnit.state = 0;
|
155
|
+
units.push(lastUnit);
|
156
|
+
track.lastNalu = null;
|
166
157
|
}
|
167
158
|
}
|
168
159
|
}
|
@@ -187,15 +178,21 @@ abstract class BaseVideoParser {
|
|
187
178
|
type: lastUnitType,
|
188
179
|
state: state,
|
189
180
|
};
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
181
|
+
if (!last) {
|
182
|
+
track.lastNalu = unit;
|
183
|
+
// logger.log('store NALu to push it on next PES');
|
184
|
+
} else {
|
185
|
+
units.push(unit);
|
186
|
+
// logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state);
|
187
|
+
}
|
188
|
+
} else if (units.length === 0) {
|
189
|
+
// no NALu found
|
195
190
|
// append pes.data to previous NAL unit
|
196
|
-
const lastUnit =
|
191
|
+
const lastUnit = track.lastNalu;
|
197
192
|
if (lastUnit) {
|
198
193
|
lastUnit.data = appendUint8Array(lastUnit.data, array);
|
194
|
+
units.push(lastUnit);
|
195
|
+
track.lastNalu = null;
|
199
196
|
}
|
200
197
|
}
|
201
198
|
track.naluState = state;
|
@@ -19,7 +19,7 @@ class HevcVideoParser extends BaseVideoParser {
|
|
19
19
|
last: boolean,
|
20
20
|
duration: number,
|
21
21
|
) {
|
22
|
-
const units = this.parseNALu(track, pes.data);
|
22
|
+
const units = this.parseNALu(track, pes.data, last);
|
23
23
|
const debug = false;
|
24
24
|
let VideoSample = this.VideoSample;
|
25
25
|
let push: boolean;
|
package/src/types/demuxer.ts
CHANGED