summaryrefslogtreecommitdiffstats
path: root/voip/java/android/net/rtp/RtpStream.java
diff options
context:
space:
mode:
authorChia-chi Yeh <chiachi@android.com>2012-03-30 13:25:19 -0700
committerChia-chi Yeh <chiachi@android.com>2012-03-30 13:32:16 -0700
commite66950506c473e660f2e5762d7a71e13808be387 (patch)
tree9ca2791a39e5b0f4a2c1fb59373225b766ff5b1d /voip/java/android/net/rtp/RtpStream.java
parent54e1553df69350130df5e4518abf14a9a64931bb (diff)
downloadframeworks_base-e66950506c473e660f2e5762d7a71e13808be387.zip
frameworks_base-e66950506c473e660f2e5762d7a71e13808be387.tar.gz
frameworks_base-e66950506c473e660f2e5762d7a71e13808be387.tar.bz2
RTP: refactor a little bit and fix few minor bugs.
Change-Id: I063644507f26996ded462972afcb550a4528dac8
Diffstat (limited to 'voip/java/android/net/rtp/RtpStream.java')
-rw-r--r--voip/java/android/net/rtp/RtpStream.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/voip/java/android/net/rtp/RtpStream.java b/voip/java/android/net/rtp/RtpStream.java
index e94ac42..b9d75cd 100644
--- a/voip/java/android/net/rtp/RtpStream.java
+++ b/voip/java/android/net/rtp/RtpStream.java
@@ -54,7 +54,7 @@ public class RtpStream {
private int mRemotePort = -1;
private int mMode = MODE_NORMAL;
- private int mNative;
+ private int mSocket = -1;
static {
System.loadLibrary("rtp_jni");
}
@@ -165,7 +165,9 @@ public class RtpStream {
mRemotePort = port;
}
- synchronized native int dup();
+ int getSocket() {
+ return mSocket;
+ }
/**
* Releases allocated resources. The stream becomes inoperable after calling
@@ -175,13 +177,15 @@ public class RtpStream {
* @see #isBusy()
*/
public void release() {
- if (isBusy()) {
- throw new IllegalStateException("Busy");
+ synchronized (this) {
+ if (isBusy()) {
+ throw new IllegalStateException("Busy");
+ }
+ close();
}
- close();
}
- private synchronized native void close();
+ private native void close();
@Override
protected void finalize() throws Throwable {