tags:

views:

142

answers:

4

Hi friends,

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

I have two option

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

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

A: 

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

Cem Kalyoncu
raw audio buffer will be created while recording from browser.does browser supports creating local sockets?
krishnakumar
A: 

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.

Carlos Tasada
+3  A: 

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.

Joonas Pulakka
+1  A: 

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.

Kevin Day
i am using JNI along with direct buffers
krishnakumar