MCPcopy Create free account
hub / github.com/apache/cloudstack / parse

Method parse

systemvm/agent/noVNC/core/decoders/h264.js:74–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72 }
73
74 parse() {
75 const startIndex = this._index;
76 let isKey = false;
77
78 while (this._index < this._data.length) {
79 const startSequenceLen = this._getStartSequenceLen(this._index);
80 if (startSequenceLen == 0) {
81 throw new Error('Invalid start sequence in bit stream');
82 }
83
84 const { slice, key } = this._parseNalUnit(this._index + startSequenceLen);
85
86 let nextIndex = this._indexOfNextNalUnit(this._index + startSequenceLen);
87 if (nextIndex == -1) {
88 this._index = this._data.length;
89 } else {
90 this._index = nextIndex;
91 }
92
93 if (key) {
94 isKey = true;
95 }
96 if (slice) {
97 break;
98 }
99 }
100
101 if (startIndex === this._index) {
102 return null;
103 }
104
105 return {
106 frame: this._data.subarray(startIndex, this._index),
107 key: isKey,
108 };
109 }
110}
111
112export class H264Context {

Callers 1

decodeMethod · 0.95

Calls 3

_getStartSequenceLenMethod · 0.95
_parseNalUnitMethod · 0.95
_indexOfNextNalUnitMethod · 0.95

Tested by

no test coverage detected