-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
178 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,28 @@ | ||
--- oggwriter.go.org 2023-01-17 12:52:08 | ||
+++ oggwriter.go 2023-01-17 16:18:23 | ||
@@ -1,5 +1,4 @@ | ||
-// Package oggwriter implements OGG media container writer | ||
--- oggwriter.go.org 2024-10-24 10:52:25 | ||
+++ oggwriter.go 2024-10-24 10:49:11 | ||
@@ -2,7 +2,7 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
// Package oggwriter implements OGG media container writer | ||
-package oggwriter | ||
+package suzu | ||
|
||
import ( | ||
"encoding/binary" | ||
@@ -20,6 +19,7 @@ | ||
idPageSignature = "OpusHead" | ||
commentPageSignature = "OpusTags" | ||
pageHeaderSignature = "OggS" | ||
+ vendorName = "pion" | ||
) | ||
|
||
var ( | ||
@@ -73,9 +73,6 @@ | ||
previousTimestamp: 1, | ||
previousGranulePosition: 1, | ||
} | ||
- if err := writer.writeHeaders(); err != nil { | ||
- return nil, err | ||
- } | ||
@@ -12,7 +12,6 @@ | ||
|
||
return writer, nil | ||
} | ||
@@ -83,7 +80,6 @@ | ||
/* | ||
ref: https://tools.ietf.org/html/rfc7845.html | ||
https://git.xiph.org/?p=opus-tools.git;a=blob;f=src/opus_header.c#l219 | ||
- | ||
Page 0 Pages 1 ... n Pages (n+1) ... | ||
+------------+ +---+ +---+ ... +---+ +-----------+ +---------+ +-- | ||
| | | | | | | | | | | | | | ||
@@ -99,7 +95,6 @@ | ||
| ID header is contained on a single page | ||
| | ||
'Beginning Of Stream' | ||
- | ||
Figure 1: Example Packet Organization for a Logical Ogg Opus Stream | ||
*/ | ||
|
||
@@ -124,11 +119,11 @@ | ||
i.pageIndex++ | ||
"github.com/pion/rtp" | ||
"github.com/pion/rtp/codecs" | ||
- "github.com/pion/webrtc/v4/internal/util" | ||
) | ||
|
||
// Comment Header | ||
- oggCommentHeader := make([]byte, 21) | ||
- copy(oggCommentHeader[0:], commentPageSignature) // Magic Signature 'OpusTags' | ||
- binary.LittleEndian.PutUint32(oggCommentHeader[8:], 5) // Vendor Length | ||
- copy(oggCommentHeader[12:], "pion") // Vendor name 'pion' | ||
- binary.LittleEndian.PutUint32(oggCommentHeader[17:], 0) // User Comment List Length | ||
+ oggCommentHeader := make([]byte, (8 + len(vendorName) + 4 + 4)) | ||
+ copy(oggCommentHeader[0:], commentPageSignature) // Magic Signature 'OpusTags' | ||
+ binary.LittleEndian.PutUint32(oggCommentHeader[8:], uint32(len(vendorName))) // Vendor Length | ||
+ copy(oggCommentHeader[12:], vendorName) // Vendor name 'pion' | ||
+ binary.LittleEndian.PutUint32(oggCommentHeader[16:], 0) // User Comment List Length | ||
const ( | ||
@@ -68,7 +67,7 @@ | ||
stream: out, | ||
sampleRate: sampleRate, | ||
channelCount: channelCount, | ||
- serial: util.RandUint32(), | ||
+ serial: RandUint32(), | ||
checksumTable: generateChecksumTable(), | ||
|
||
// RFC specifies that the page where the CommentHeader completes should have a granule position of 0 | ||
data = i.createPage(oggCommentHeader, pageHeaderTypeContinuationOfStream, 0, i.pageIndex) | ||
// Timestamp and Granule MUST start from 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- util.go.org 2024-10-24 10:53:48 | ||
+++ util.go 2024-10-24 10:50:15 | ||
@@ -2,7 +2,7 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
// Package util provides auxiliary functions internally used in webrtc package | ||
-package util | ||
+package suzu | ||
|
||
import ( | ||
"errors" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.