Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
8bb10a1b
Commit
8bb10a1b
authored
Jun 13, 2014
by
Adrien Maglo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
android mediacodec: catch more Java exceptions and add log messages
parent
bb9e60e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
modules/codec/omxil/android_mediacodec.c
modules/codec/omxil/android_mediacodec.c
+53
-0
No files found.
modules/codec/omxil/android_mediacodec.c
View file @
8bb10a1b
...
@@ -572,9 +572,21 @@ static void CloseDecoder(vlc_object_t *p_this)
...
@@ -572,9 +572,21 @@ static void CloseDecoder(vlc_object_t *p_this)
(
*
env
)
->
DeleteGlobalRef
(
env
,
p_sys
->
output_buffers
);
(
*
env
)
->
DeleteGlobalRef
(
env
,
p_sys
->
output_buffers
);
if
(
p_sys
->
codec
)
{
if
(
p_sys
->
codec
)
{
if
(
p_sys
->
started
)
if
(
p_sys
->
started
)
{
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
stop
);
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
stop
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.stop"
);
(
*
env
)
->
ExceptionClear
(
env
);
}
}
if
(
p_sys
->
allocated
)
if
(
p_sys
->
allocated
)
{
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
release
);
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
release
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.release"
);
(
*
env
)
->
ExceptionClear
(
env
);
}
}
(
*
env
)
->
DeleteGlobalRef
(
env
,
p_sys
->
codec
);
(
*
env
)
->
DeleteGlobalRef
(
env
,
p_sys
->
codec
);
}
}
if
(
p_sys
->
buffer_info
)
if
(
p_sys
->
buffer_info
)
...
@@ -658,6 +670,7 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t
...
@@ -658,6 +670,7 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t
int
index
=
(
*
env
)
->
CallIntMethod
(
env
,
p_sys
->
codec
,
p_sys
->
dequeue_output_buffer
,
int
index
=
(
*
env
)
->
CallIntMethod
(
env
,
p_sys
->
codec
,
p_sys
->
dequeue_output_buffer
,
p_sys
->
buffer_info
,
timeout
);
p_sys
->
buffer_info
,
timeout
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.dequeueOutputBuffer (GetOutput)"
);
(
*
env
)
->
ExceptionClear
(
env
);
(
*
env
)
->
ExceptionClear
(
env
);
p_sys
->
error_state
=
true
;
p_sys
->
error_state
=
true
;
return
;
return
;
...
@@ -667,6 +680,12 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t
...
@@ -667,6 +680,12 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t
if
(
!
p_sys
->
pixel_format
)
{
if
(
!
p_sys
->
pixel_format
)
{
msg_Warn
(
p_dec
,
"Buffers returned before output format is set, dropping frame"
);
msg_Warn
(
p_dec
,
"Buffers returned before output format is set, dropping frame"
);
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
release_output_buffer
,
index
,
false
);
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
release_output_buffer
,
index
,
false
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.releaseOutputBuffer"
);
(
*
env
)
->
ExceptionClear
(
env
);
p_sys
->
error_state
=
true
;
return
;
}
continue
;
continue
;
}
}
...
@@ -677,6 +696,13 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t
...
@@ -677,6 +696,13 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t
picture_sys_t
*
p_picsys
=
p_pic
->
p_sys
;
picture_sys_t
*
p_picsys
=
p_pic
->
p_sys
;
int
i_prev_index
=
p_picsys
->
i_index
;
int
i_prev_index
=
p_picsys
->
i_index
;
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
release_output_buffer
,
i_prev_index
,
false
);
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
release_output_buffer
,
i_prev_index
,
false
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.releaseOutputBuffer "
\
"(GetOutput, overwriting previous picture)"
);
(
*
env
)
->
ExceptionClear
(
env
);
p_sys
->
error_state
=
true
;
return
;
}
// No need to lock here since the previous picture was not sent.
// No need to lock here since the previous picture was not sent.
p_sys
->
inflight_picture
[
i_prev_index
]
=
NULL
;
p_sys
->
inflight_picture
[
i_prev_index
]
=
NULL
;
...
@@ -737,6 +763,11 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t
...
@@ -737,6 +763,11 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t
}
else
{
}
else
{
msg_Warn
(
p_dec
,
"NewPicture failed"
);
msg_Warn
(
p_dec
,
"NewPicture failed"
);
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
release_output_buffer
,
index
,
false
);
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
release_output_buffer
,
index
,
false
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.releaseOutputBuffer (GetOutput)"
);
(
*
env
)
->
ExceptionClear
(
env
);
p_sys
->
error_state
=
true
;
}
}
}
return
;
return
;
...
@@ -746,6 +777,14 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t
...
@@ -746,6 +777,14 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t
p_sys
->
output_buffers
=
(
*
env
)
->
CallObjectMethod
(
env
,
p_sys
->
codec
,
p_sys
->
output_buffers
=
(
*
env
)
->
CallObjectMethod
(
env
,
p_sys
->
codec
,
p_sys
->
get_output_buffers
);
p_sys
->
get_output_buffers
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.getOutputBuffer (GetOutput)"
);
(
*
env
)
->
ExceptionClear
(
env
);
p_sys
->
output_buffers
=
NULL
;
p_sys
->
error_state
=
true
;
return
;
}
p_sys
->
output_buffers
=
(
*
env
)
->
NewGlobalRef
(
env
,
p_sys
->
output_buffers
);
p_sys
->
output_buffers
=
(
*
env
)
->
NewGlobalRef
(
env
,
p_sys
->
output_buffers
);
vlc_mutex_lock
(
get_android_opaque_mutex
());
vlc_mutex_lock
(
get_android_opaque_mutex
());
...
@@ -756,6 +795,13 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t
...
@@ -756,6 +795,13 @@ static void GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong t
}
else
if
(
index
==
INFO_OUTPUT_FORMAT_CHANGED
)
{
}
else
if
(
index
==
INFO_OUTPUT_FORMAT_CHANGED
)
{
jobject
format
=
(
*
env
)
->
CallObjectMethod
(
env
,
p_sys
->
codec
,
p_sys
->
get_output_format
);
jobject
format
=
(
*
env
)
->
CallObjectMethod
(
env
,
p_sys
->
codec
,
p_sys
->
get_output_format
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.getOutputFormat (GetOutput)"
);
(
*
env
)
->
ExceptionClear
(
env
);
p_sys
->
error_state
=
true
;
return
;
}
jobject
format_string
=
(
*
env
)
->
CallObjectMethod
(
env
,
format
,
p_sys
->
tostring
);
jobject
format_string
=
(
*
env
)
->
CallObjectMethod
(
env
,
format
,
p_sys
->
tostring
);
jsize
format_len
=
(
*
env
)
->
GetStringUTFLength
(
env
,
format_string
);
jsize
format_len
=
(
*
env
)
->
GetStringUTFLength
(
env
,
format_string
);
...
@@ -880,6 +926,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
...
@@ -880,6 +926,7 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
while
(
true
)
{
while
(
true
)
{
int
index
=
(
*
env
)
->
CallIntMethod
(
env
,
p_sys
->
codec
,
p_sys
->
dequeue_input_buffer
,
(
jlong
)
0
);
int
index
=
(
*
env
)
->
CallIntMethod
(
env
,
p_sys
->
codec
,
p_sys
->
dequeue_input_buffer
,
(
jlong
)
0
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
msg_Err
(
p_dec
,
"Exception occurred in MediaCodec.dequeueInputBuffer"
);
(
*
env
)
->
ExceptionClear
(
env
);
(
*
env
)
->
ExceptionClear
(
env
);
p_sys
->
error_state
=
true
;
p_sys
->
error_state
=
true
;
break
;
break
;
...
@@ -940,6 +987,12 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
...
@@ -940,6 +987,12 @@ static picture_t *DecodeVideo(decoder_t *p_dec, block_t **pp_block)
timestamp_FifoPut
(
p_sys
->
timestamp_fifo
,
p_block
->
i_pts
?
VLC_TS_INVALID
:
p_block
->
i_dts
);
timestamp_FifoPut
(
p_sys
->
timestamp_fifo
,
p_block
->
i_pts
?
VLC_TS_INVALID
:
p_block
->
i_dts
);
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
queue_input_buffer
,
index
,
0
,
size
,
ts
,
0
);
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
queue_input_buffer
,
index
,
0
,
size
,
ts
,
0
);
(
*
env
)
->
DeleteLocalRef
(
env
,
buf
);
(
*
env
)
->
DeleteLocalRef
(
env
,
buf
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.queueInputBuffer"
);
(
*
env
)
->
ExceptionClear
(
env
);
p_sys
->
error_state
=
true
;
break
;
}
p_sys
->
decoded
=
true
;
p_sys
->
decoded
=
true
;
break
;
break
;
}
}
...
...
Write
Preview
Markdown
is supported
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