Skip to content

Commit

Permalink
Fix PPS growth in HEVC TS parser (#6724)
Browse files Browse the repository at this point in the history
Co-authored-by: vladimir.vyatkin <[email protected]>
  • Loading branch information
devoldemar and vladimir.vyatkin authored Oct 6, 2024
1 parent ed32b5b commit bf0180c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/demux/video/hevc-video-parser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BaseVideoParser from './base-video-parser';
import type { ParsedVideoSample } from '../tsdemuxer';
import type {
DemuxedVideoTrack,
DemuxedUserdataTrack,
Expand Down Expand Up @@ -180,7 +181,7 @@ class HevcVideoParser extends BaseVideoParser {
track.params[prop] = config[prop];
}
}
if (this.initVPS !== null || track.pps.length === 0) {
if (track.vps !== undefined && track.vps[0] === this.initVPS) {
track.pps.push(unit.data);
}
}
Expand Down Expand Up @@ -239,6 +240,16 @@ class HevcVideoParser extends BaseVideoParser {
return new Uint8Array(dst.buffer, 0, dstIdx);
}

protected pushAccessUnit(
VideoSample: ParsedVideoSample,
videoTrack: DemuxedVideoTrack,
) {
super.pushAccessUnit(VideoSample, videoTrack);
if (this.initVPS) {
this.initVPS = null; // null initVPS to prevent possible track's sps/pps growth until next VPS
}
}

readVPS(vps: Uint8Array): {
numTemporalLayers: number;
temporalIdNested: boolean;
Expand Down

0 comments on commit bf0180c

Please sign in to comment.