My setup looks like this:
inRtpStream = new AudioStream(InetAddress.getLocalHost());
inRtpStream.setMode(RtpStream.MODE_NORMAL);
inRtpStream.setCodec(AudioCodec.PCMU);
and then my punch hole code looks like this:
public static void punchHole(final int pPort, final String pRemoteHost) {
(new Thread() {
public void run() {
try {
String host = lServer;
int port = pPort;
byte[] message = "Java Source and Support".getBytes();
// Get the internet address of the specified host
InetAddress address = InetAddress.getByName(pRemoteHost);
Log.i("punchHole", "Punching a hole from port " + getAudio_port() + " to port " + port + " on address " + address.getHostAddress());
// Initialize a datagram packet with data and address
DatagramPacket packet = new DatagramPacket(message, message.length, address, port);
// Create a datagram socket, send the packet through it,
// close it.
DatagramSocket dsocket = new DatagramSocket(getAudio_port());
dsocket.send(packet);
dsocket.close();
dsocket = null;
packet = null;
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
If I call punchHole(remote_audio_port, remote_media_address); after the audiostream is set then it errors with:
java.net.BindException: bind failed: EADDRINUSE (Address already in use)
Shaun
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment