[vlc-commits] mediacodec: split CloseDecoder into CleanDecoder
Thomas Guillem
git at videolan.org
Fri Dec 11 17:43:10 CET 2015
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Dec 11 17:22:42 2015 +0100| [0ef4745331786818c70a0b46c9a2b223859be85a] | committer: Thomas Guillem
mediacodec: split CloseDecoder into CleanDecoder
CloseDecoder join the thread and clean up the decoder via CleanDecoder.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0ef4745331786818c70a0b46c9a2b223859be85a
---
modules/codec/omxil/mediacodec.c | 41 +++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index 05ce821..b4e2c0c 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -147,6 +147,7 @@ struct decoder_sys_t
*****************************************************************************/
static int OpenDecoderJni(vlc_object_t *);
static int OpenDecoderNdk(vlc_object_t *);
+static void CleanDecoder(decoder_t *);
static void CloseDecoder(vlc_object_t *);
static int Video_OnNewBlock(decoder_t *, block_t *, int *);
@@ -679,7 +680,7 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
return VLC_SUCCESS;
bailout:
- CloseDecoder(p_this);
+ CleanDecoder(p_dec);
return VLC_EGENERIC;
}
@@ -693,28 +694,10 @@ static int OpenDecoderJni(vlc_object_t *p_this)
return OpenDecoder(p_this, MediaCodecJni_Init);
}
-/*****************************************************************************
- * CloseDecoder: Close the decoder instance
- *****************************************************************************/
-static void CloseDecoder(vlc_object_t *p_this)
+static void CleanDecoder(decoder_t *p_dec)
{
- decoder_t *p_dec = (decoder_t *)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
- if (!p_sys)
- return;
- vlc_mutex_lock(&p_sys->lock);
- if (p_sys->b_out_thread_running)
- {
- p_sys->b_out_thread_running = false;
- DecodeFlushLocked(p_dec);
- vlc_cond_broadcast(&p_sys->cond);
- vlc_mutex_unlock(&p_sys->lock);
- vlc_join(p_sys->out_thread, NULL);
- }
- else
- vlc_mutex_unlock(&p_sys->lock);
-
vlc_mutex_destroy(&p_sys->lock);
vlc_cond_destroy(&p_sys->cond);
vlc_cond_destroy(&p_sys->dec_cond);
@@ -739,6 +722,24 @@ static void CloseDecoder(vlc_object_t *p_this)
}
/*****************************************************************************
+ * CloseDecoder: Close the decoder instance
+ *****************************************************************************/
+static void CloseDecoder(vlc_object_t *p_this)
+{
+ decoder_t *p_dec = (decoder_t *)p_this;
+ decoder_sys_t *p_sys = p_dec->p_sys;
+
+ vlc_mutex_lock(&p_sys->lock);
+ p_sys->b_out_thread_running = false;
+ DecodeFlushLocked(p_dec);
+ vlc_cond_broadcast(&p_sys->cond);
+ vlc_mutex_unlock(&p_sys->lock);
+ vlc_join(p_sys->out_thread, NULL);
+
+ CleanDecoder(p_dec);
+}
+
+/*****************************************************************************
* vout callbacks
*****************************************************************************/
static void ReleasePicture(decoder_t *p_dec, unsigned i_index, bool b_render)
More information about the vlc-commits
mailing list