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
9d997cdf
Commit
9d997cdf
authored
Mar 24, 2015
by
Thomas Guillem
Committed by
Jean-Baptiste Kempf
Mar 24, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mediacodec: factorize release_output_buffer
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
a2ea54f0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
18 deletions
+21
-18
modules/codec/omxil/android_mediacodec.c
modules/codec/omxil/android_mediacodec.c
+21
-18
No files found.
modules/codec/omxil/android_mediacodec.c
View file @
9d997cdf
...
...
@@ -709,6 +709,23 @@ static void CloseDecoder(vlc_object_t *p_this)
free
(
p_sys
);
}
/*****************************************************************************
* ReleaseOutputBuffer
*****************************************************************************/
static
int
ReleaseOutputBuffer
(
decoder_t
*
p_dec
,
JNIEnv
*
env
,
int
i_index
,
bool
b_render
)
{
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
release_output_buffer
,
i_index
,
b_render
);
if
(
CHECK_EXCEPTION
())
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.releaseOutputBuffer"
);
return
-
1
;
}
return
0
;
}
/*****************************************************************************
* vout callbacks
*****************************************************************************/
...
...
@@ -716,7 +733,6 @@ static void UnlockPicture(picture_t* p_pic, bool b_render)
{
picture_sys_t
*
p_picsys
=
p_pic
->
p_sys
;
decoder_t
*
p_dec
=
p_picsys
->
priv
.
hw
.
p_dec
;
decoder_sys_t
*
p_sys
=
p_dec
->
p_sys
;
if
(
!
p_picsys
->
priv
.
hw
.
b_valid
)
return
;
...
...
@@ -735,10 +751,7 @@ static void UnlockPicture(picture_t* p_pic, bool b_render)
/* Release the MediaCodec buffer. */
JNIEnv
*
env
=
NULL
;
jni_attach_thread
(
&
env
,
THREAD_NAME
);
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
release_output_buffer
,
i_index
,
b_render
);
if
(
CHECK_EXCEPTION
())
msg_Err
(
p_dec
,
"Exception in MediaCodec.releaseOutputBuffer (DisplayBuffer)"
);
ReleaseOutputBuffer
(
p_dec
,
env
,
i_index
,
b_render
);
jni_detach_thread
();
p_picsys
->
priv
.
hw
.
b_valid
=
false
;
...
...
@@ -847,11 +860,8 @@ static int GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong ti
if
(
index
>=
0
)
{
if
(
!
p_sys
->
pixel_format
)
{
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
);
if
(
CHECK_EXCEPTION
())
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.releaseOutputBuffer"
);
if
(
ReleaseOutputBuffer
(
p_dec
,
env
,
index
,
false
)
!=
0
)
return
-
1
;
}
continue
;
}
...
...
@@ -861,12 +871,8 @@ static int GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong ti
picture_t
*
p_pic
=
*
pp_pic
;
picture_sys_t
*
p_picsys
=
p_pic
->
p_sys
;
int
i_prev_index
=
p_picsys
->
priv
.
hw
.
i_index
;
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
release_output_buffer
,
i_prev_index
,
false
);
if
(
CHECK_EXCEPTION
())
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.releaseOutputBuffer "
\
"(GetOutput, overwriting previous picture)"
);
if
(
ReleaseOutputBuffer
(
p_dec
,
env
,
i_prev_index
,
false
)
!=
0
)
return
-
1
;
}
// No need to lock here since the previous picture was not sent.
InsertInflightPicture
(
p_dec
,
NULL
,
i_prev_index
);
...
...
@@ -930,12 +936,9 @@ static int GetOutput(decoder_t *p_dec, JNIEnv *env, picture_t **pp_pic, jlong ti
}
}
else
{
msg_Warn
(
p_dec
,
"NewPicture failed"
);
(
*
env
)
->
CallVoidMethod
(
env
,
p_sys
->
codec
,
p_sys
->
release_output_buffer
,
index
,
false
);
if
(
CHECK_EXCEPTION
())
{
msg_Err
(
p_dec
,
"Exception in MediaCodec.releaseOutputBuffer (GetOutput)"
);
if
(
ReleaseOutputBuffer
(
p_dec
,
env
,
index
,
false
)
!=
0
)
return
-
1
;
}
}
return
0
;
}
else
if
(
index
==
INFO_OUTPUT_BUFFERS_CHANGED
)
{
...
...
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