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

Implementation as a transform stream #30

Open
albertojorge1983 opened this issue Jun 1, 2024 · 1 comment
Open

Implementation as a transform stream #30

albertojorge1983 opened this issue Jun 1, 2024 · 1 comment

Comments

@albertojorge1983
Copy link

albertojorge1983 commented Jun 1, 2024

It would be safe to asume that this would work?
Because I'm getting weird result on my end.

var codecParserTransform = new Transform({
  transform: function (chunk, encoding, cb) {
    for (const frame of this.codecParser.parseChunk(chunk)) {
      this.push(frame.data)
    }

    cb()
  }
})

someReadableAudio.pipe(codecParserTransform).on('data', (frame) => { 
 someWritableStream.write(frame)
})

Or there is a better way of doing this??
Thanks.

@albertojorge1983 albertojorge1983 changed the title Im plementing it as a transform string Implementing it as a transform stream Jun 1, 2024
@albertojorge1983 albertojorge1983 changed the title Implementing it as a transform stream Implementation it as a transform stream Jun 1, 2024
@albertojorge1983 albertojorge1983 changed the title Implementation it as a transform stream Implementation as a transform stream Jun 1, 2024
@eshaz
Copy link
Owner

eshaz commented Jun 1, 2024

codec-parser should work fine wrapped as a transform stream and it should work fine reading partial chunks of data no matter what the size.

Unless you're seeing some specific codec parser error, or the data is being parsed incorrectly, I would guess the issue is with how your transform stream is implemented. You might check this out to help with implementing the transform stream: https://nodejs.org/api/stream.html#implementing-a-duplex-stream

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

No branches or pull requests

2 participants