Question

I want to send the raw audio buffer to c++ for audio transcoding. I have two option

  1. using piped stream
    • using direct buffers (java.nio)

Are these really my 2 best options (and which would people recommend?) Thanks!

Was it helpful?

Solution

Direct buffers in NIO will almost certainly have better performance. This is pretty much the ideal case for direct buffers.

I'm not sure what the point of your question is - if you want to know if there are other options, then the answer is certainly yet (you could, for example, write to a file then invoke an external application to process it - or you could use JNI without direct buffers). But if you want a tightly coupled, highly performant interface between Java and C++ code, JNI along with direct buffers, is going to be the tool to use.

OTHER TIPS

JNI is easy to screw up, therefore people tend to complain about it. But it is an excellent and extremely stable option, when done correctly.

You may use sockets (that accepts connection from local) but that will be more effective on *nix systems I guess.

If you don't need realtime transcoding, I would choose the buffers approach. In this way you have better control and you'll be sure that no byte is lost.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top