[vlc-commits] opensles: fix mismatch object lifecycle between open/close and start/stop
Rafaël Carré
git at videolan.org
Sat Jun 8 13:18:03 CEST 2013
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sat Jun 8 13:16:44 2013 +0200| [5ceac2ed8e53c767dc1464706229a45fa1cd6a06] | committer: Rafaël Carré
opensles: fix mismatch object lifecycle between open/close and start/stop
Refs: #8579
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5ceac2ed8e53c767dc1464706229a45fa1cd6a06
---
modules/audio_output/opensles_android.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/modules/audio_output/opensles_android.c b/modules/audio_output/opensles_android.c
index cf6e9c5..0f509e6 100644
--- a/modules/audio_output/opensles_android.c
+++ b/modules/audio_output/opensles_android.c
@@ -352,16 +352,6 @@ static void PlayedCallback (SLAndroidSimpleBufferQueueItf caller, void *pContext
/*****************************************************************************
*
*****************************************************************************/
-static void Clean(aout_sys_t *sys)
-{
- if (sys->playerObject)
- Destroy(sys->playerObject);
- if (sys->outputMixObject)
- Destroy(sys->outputMixObject);
- if (sys->engineObject)
- Destroy(sys->engineObject);
-}
-
static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
{
SLresult result;
@@ -446,7 +436,11 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
return VLC_SUCCESS;
error:
- Clean(sys);
+ if (sys->playerObject) {
+ Destroy(sys->playerObject);
+ sys->playerObject = NULL;
+ }
+
return VLC_EGENERIC;
}
@@ -460,6 +454,9 @@ static void Stop(audio_output_t *aout)
free(sys->buf);
block_ChainRelease(sys->p_buffer_chain);
+
+ Destroy(sys->playerObject);
+ sys->playerObject = NULL;
}
/*****************************************************************************
@@ -470,7 +467,8 @@ static void Close(vlc_object_t *obj)
audio_output_t *aout = (audio_output_t *)obj;
aout_sys_t *sys = aout->sys;
- Clean(sys);
+ Destroy(sys->outputMixObject);
+ Destroy(sys->engineObject);
dlclose(sys->p_so_handle);
vlc_mutex_destroy(&sys->lock);
free(sys);
@@ -553,7 +551,10 @@ static int Open (vlc_object_t *obj)
return VLC_SUCCESS;
error:
- Clean(sys);
+ if (sys->outputMixObject)
+ Destroy(sys->outputMixObject);
+ if (sys->engineObject)
+ Destroy(sys->engineObject);
if (sys->p_so_handle)
dlclose(sys->p_so_handle);
free(sys);
More information about the vlc-commits
mailing list