[Android] [PATCH 2/3] Add option to enable RTSP TCP directly bypassing UDP.

Paulo Vitor Magacho da Silva pvmagacho at gmail.com
Tue Nov 25 01:28:52 CET 2014


---
 libvlc/jni/libvlcjni.c                     |  6 ++++++
 libvlc/src/org/videolan/libvlc/LibVLC.java | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c
index 6b28667..7edd52f 100644
--- a/libvlc/jni/libvlcjni.c
+++ b/libvlc/jni/libvlcjni.c
@@ -303,6 +303,9 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
     if (direct_rendering)
         vout = VOUT_ANDROID_WINDOW;
 
+    methodId = (*env)->GetMethodID(env, cls, "isRtspTcp", "()Z");
+    bool isRtspTcp = (*env)->CallBooleanMethod(env, thiz, methodId);
+
     methodId = (*env)->GetMethodID(env, cls, "getCachePath", "()Ljava/lang/String;");
     jstring cachePath = (*env)->CallObjectMethod(env, thiz, methodId);
     if (cachePath) {
@@ -328,6 +331,9 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
         /* Enable statistics */
         "--stats",
 
+        /* Enable RTSP tcp */
+        isRtspTcp ? "--rtsp-tcp" : "",
+
         /* XXX: why can't the default be fine ? #7792 */
         (networkCaching > 0) ? networkCachingstr : "",
 
diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index 5dffb47..8eb25ad 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -102,6 +102,8 @@ public class LibVLC {
     /** Native crash handler */
     private OnNativeCrashListener mOnNativeCrashListener;
 
+    private boolean isRtspTcp = false;
+
     /** Check in libVLC already initialized otherwise crash */
     private boolean mIsInitialized = false;
     public native void attachSurface(Surface surface, IVideoPlayer player);
@@ -871,6 +873,14 @@ public class LibVLC {
             mOnNativeCrashListener.onNativeCrash();
     }
 
+    public boolean isRtspTcp() {
+        return isRtspTcp;
+    }
+
+    public void setRtspTcp(boolean value) {
+        this.isRtspTcp = value;
+    }
+
     public String getCachePath() {
         return mCachePath;
     }
-- 
1.9.3 (Apple Git-50)



More information about the Android mailing list