Commit 13d0cee3 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix crash in iOS

parent 34ced926
...@@ -202,19 +202,25 @@ void audio_stream_prepare_sound(AudioStream *stream, MSSndCard *playcard, MSSndC ...@@ -202,19 +202,25 @@ void audio_stream_prepare_sound(AudioStream *stream, MSSndCard *playcard, MSSndC
stream->ms.state=MSStreamPreparing; stream->ms.state=MSStreamPreparing;
} }
void audio_stream_unprepare_sound(AudioStream *stream){ static void _audio_stream_unprepare_sound(AudioStream *stream, bool_t keep_sound_resources){
if (stream->ms.state==MSStreamPreparing){ if (stream->ms.state==MSStreamPreparing){
stop_preload_graph(stream); stop_preload_graph(stream);
#ifdef __ios #ifdef __ios
if (stream->soundread) ms_filter_destroy(stream->soundread); if (!keep_sound_resources){
stream->soundread=NULL; if (stream->soundread) ms_filter_destroy(stream->soundread);
if (stream->soundwrite) ms_filter_destroy(stream->soundwrite); stream->soundread=NULL;
stream->soundwrite=NULL; if (stream->soundwrite) ms_filter_destroy(stream->soundwrite);
stream->soundwrite=NULL;
}
#endif #endif
} }
stream->ms.state=MSStreamInitialized; stream->ms.state=MSStreamInitialized;
} }
void audio_stream_unprepare_sound(AudioStream *stream){
_audio_stream_unprepare_sound(stream,FALSE);
}
static void player_callback(void *ud, MSFilter *f, unsigned int id, void *arg){ static void player_callback(void *ud, MSFilter *f, unsigned int id, void *arg){
AudioStream *stream=(AudioStream *)ud; AudioStream *stream=(AudioStream *)ud;
int sr=0; int sr=0;
...@@ -579,8 +585,8 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char ...@@ -579,8 +585,8 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
/* create ticker */ /* create ticker */
if (stream->ms.sessions.ticker==NULL) media_stream_start_ticker(&stream->ms); if (stream->ms.sessions.ticker==NULL) media_stream_start_ticker(&stream->ms);
if (stream->ms.state==MSStreamPreparing){ if (stream->ms.state==MSStreamPreparing){
/*we were using the dummy preload graph, destroy it*/ /*we were using the dummy preload graph, destroy it but keep sound filters*/
audio_stream_unprepare_sound(stream); _audio_stream_unprepare_sound(stream,TRUE);
} }
/* and then connect all */ /* and then connect all */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment