Skip to content

Commit

Permalink
Add granulePosition property to Page interface and update OggParser l…
Browse files Browse the repository at this point in the history
…ogic
  • Loading branch information
shinyoshiaki committed Dec 10, 2023
1 parent bb6e7e3 commit aa6031a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/rtp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "werift-rtp",
"version": "0.7.23",
"version": "0.7.24",
"description": "RTP,RTCP,SRTP,SRTCP implementation for TypeScript.",
"homepage": "https://github.com/shinyoshiaki/werift-webrtc",
"repository": {
Expand Down
16 changes: 5 additions & 11 deletions packages/rtp/src/container/ogg/parser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface Page {
granulePosition: number;
segments: Buffer[];
segmentTable: number[];
}
Expand Down Expand Up @@ -53,6 +54,9 @@ export class OggParser {
}
} else {
const magic = buf.subarray(index, index + 4).toString();
if (magic !== "OggS") {
break;
}
index += 4; // skip magic
index += 1; // skip version
const headerType = buf.readUInt8(index);
Expand All @@ -78,19 +82,9 @@ export class OggParser {
segments.push(segmentData);
}

console.log({
magic,
headerType,
granulePosition,
bitstreamSerialNumber,
pageSequenceNumber,
pageChecksum,
pageSegments,
segmentTable,
});

this.pages.push({
segments,
granulePosition: Number(granulePosition),
segmentTable: [...segmentTable.map((s) => s)],
});
}
Expand Down

0 comments on commit aa6031a

Please sign in to comment.