[vlc-commits] mediacodec: OutThread can be drained more than one time
Thomas Guillem
git at videolan.org
Wed Mar 29 15:49:46 CEST 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Mar 27 17:51:07 2017 +0200| [cbaaae4127585fdbe205e927f783fded5339004e] | committer: Thomas Guillem
mediacodec: OutThread can be drained more than one time
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cbaaae4127585fdbe205e927f783fded5339004e
---
modules/codec/omxil/mediacodec.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index 4f81400..af20d6f 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -103,6 +103,7 @@ struct decoder_sys_t
/* If true, the first input block was successfully dequeued */
bool b_input_dequeued;
bool b_aborted;
+ bool b_drained;
bool b_adaptive;
int i_decode_flags;
@@ -1211,9 +1212,9 @@ static void *OutThread(void *data)
if (out.b_eos)
{
- msg_Warn(p_dec, "EOS received, abort OutThread");
- vlc_restorecancel(canc);
- break;
+ msg_Warn(p_dec, "EOS received");
+ p_sys->b_drained = true;
+ vlc_cond_signal(&p_sys->dec_cond);
}
} else if (i_ret != 0)
{
@@ -1358,11 +1359,15 @@ static int QueueBlockLocked(decoder_t *p_dec, block_t *p_in_block,
* frames. Use a timeout here since we can't know if all decoders will
* behave correctly. */
mtime_t deadline = mdate() + INT64_C(1000000);
- while (!p_sys->b_aborted
+ while (!p_sys->b_aborted && !p_sys->b_drained
&& vlc_cond_timedwait(&p_sys->dec_cond, &p_sys->lock, deadline) == 0);
- if (!p_sys->b_aborted)
+ if (!p_sys->b_drained)
+ {
msg_Err(p_dec, "OutThread timed out");
+ p_sys->b_aborted = true;
+ }
+ p_sys->b_drained = false;
}
return VLC_SUCCESS;
More information about the vlc-commits
mailing list