Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-Android
Commits
774bcd52
Commit
774bcd52
authored
Jul 09, 2014
by
flx42
Browse files
LibVLC: handle failures when getting the cache path
parent
606a53a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
vlc-android/jni/libvlcjni.c
View file @
774bcd52
...
...
@@ -262,8 +262,11 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
methodId
=
(
*
env
)
->
GetMethodID
(
env
,
cls
,
"getCachePath"
,
"()Ljava/lang/String;"
);
jstring
cachePath
=
(
*
env
)
->
CallObjectMethod
(
env
,
thiz
,
methodId
);
const
char
*
cache_path
=
(
*
env
)
->
GetStringUTFChars
(
env
,
cachePath
,
0
);
setenv
(
"DVDCSS_CACHE"
,
cache_path
,
1
);
if
(
cachePath
)
{
const
char
*
cache_path
=
(
*
env
)
->
GetStringUTFChars
(
env
,
cachePath
,
0
);
setenv
(
"DVDCSS_CACHE"
,
cache_path
,
1
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
cachePath
,
cache_path
);
}
/* Don't add any invalid options, otherwise it causes LibVLC to crash */
const
char
*
argv
[]
=
{
...
...
@@ -297,7 +300,6 @@ void Java_org_videolan_libvlc_LibVLC_nativeInit(JNIEnv *env, jobject thiz)
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
chroma
,
chromastr
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
subsencoding
,
subsencodingstr
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
cachePath
,
cache_path
);
if
(
!
instance
)
{
...
...
vlc-android/src/org/videolan/libvlc/LibVLC.java
View file @
774bcd52
...
...
@@ -20,6 +20,7 @@
package
org.videolan.libvlc
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.Map
;
...
...
@@ -378,7 +379,8 @@ public class LibVLC {
throw
new
LibVlcException
();
}
mCachePath
=
context
.
getCacheDir
().
getAbsolutePath
();
File
cacheDir
=
context
.
getCacheDir
();
mCachePath
=
(
cacheDir
!=
null
)
?
cacheDir
.
getAbsolutePath
()
:
null
;
nativeInit
();
mMediaList
=
mPrimaryList
=
new
MediaList
(
this
);
setEventHandler
(
EventHandler
.
getInstance
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment