Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added raw packets for realtime encode/decode #221

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dioptre
Copy link

@dioptre dioptre commented Oct 11, 2020

No description provided.

@chris-rudmin
Copy link
Owner

@dioptre Thanks for the pull request. Just curious what is the use case for opus encoded audio without a container?
If you would like this to be merged, could you add documentation, and unit tests for your code changes?

@dioptre
Copy link
Author

dioptre commented Oct 12, 2020

Fast efficient real-time streaming working like a charm.

I don't have time to write unit tests this week.

Thanks
Andrew

@MrdUkk
Copy link

MrdUkk commented Oct 29, 2020

just my 2 cents.
Im interested in raw encoded frames from opus too. without overhead. currently proposed patch is wrong.

encoderWorker.min.js:1 Uncaught ReferenceError: postMessage is not defined
at OggOpusEncoder.segmentPacket (encoderWorker.min.js:1)
at OggOpusEncoder.encode (encoderWorker.min.js:1)
at AudioWorkletProcessor.process (encoderWorker.min.js:1)

i think in segmentPacket function you can't invoke postMessage(). need change upper IF to
var exportPages = [];
if (this.config.rawPacket) {
if (packetLength > 0) {
var page = new Uint8Array( HEAPU8.subarray(this.encoderOutputPointer, this.encoderOutputPointer + packetLength) );
exportPages.push(page);
this.framesInPage = 0;
return;
}
}

be aware that inrementing framesInPage variable without resetting will lead to overflow. so i added reset

@MrdUkk
Copy link

MrdUkk commented Nov 6, 2020

digging little deeper in source i found better (and working!) solution. (I need RAW opus frames. each frame is distinct byteArray element inserted into another byteArray)

patching needed only in 3 functions: encode, flush, encodeFinalFrame (encoderWorker.js). This won't touch 'hot' path functions that deal with Ogg packing.
Now I don’t understand which is more correct: pull another request with changed file or simply put here changed lines from original source?

@pitonoved
Copy link

digging little deeper in source i found better (and working!) solution. (I need RAW opus frames. each frame is distinct byteArray element inserted into another byteArray)

patching needed only in 3 functions: encode, flush, encodeFinalFrame (encoderWorker.js). This won't touch 'hot' path functions that deal with Ogg packing.
Now I don’t understand which is more correct: pull another request with changed file or simply put here changed lines from original source?

I need this solution too..

@MrdUkk
Copy link

MrdUkk commented Feb 10, 2021

@pitonoved

I need this solution too..

how we would contact?
Original Author does not communicate what should i do (post here changed lines in original code or pull another request)

@dioptre
Copy link
Author

dioptre commented Feb 10, 2021 via email

@WindowsNT
Copy link

WindowsNT commented Mar 21, 2021

Do we still have this solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants