Skip to content

Implementation as a transform stream #30

Open

Description

@albertojorge1983

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.

Activity

  1. changed the title [-]Im plementing it as a transform string[/-] [+]Implementing it as a transform stream[/+] on Jun 1, 2024
  2. changed the title [-]Implementing it as a transform stream[/-] [+]Implementation it as a transform stream[/+] on Jun 1, 2024
  3. changed the title [-]Implementation it as a transform stream[/-] [+]Implementation as a transform stream[/+] on Jun 1, 2024
  4. eshaz commented on Jun 1, 2024

    @eshaz
    Owner

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions