From a25a91ecc867db804d45b2c517925eef18e781f6 Mon Sep 17 00:00:00 2001 From: Liong Sauw Ming Date: Thu, 21 Jul 2011 10:06:17 +0000 Subject: Fixed #1335 Fixes assertion when interruptionListener is called from an unregistered thread on iPhone OS. git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3674 74dad513-b988-da41-8d7b-12977e46ad98 --- pjmedia/src/pjmedia-audiodev/coreaudio_dev.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'pjmedia/src/pjmedia-audiodev/coreaudio_dev.c') diff --git a/pjmedia/src/pjmedia-audiodev/coreaudio_dev.c b/pjmedia/src/pjmedia-audiodev/coreaudio_dev.c index fd77c993..c5a3e621 100644 --- a/pjmedia/src/pjmedia-audiodev/coreaudio_dev.c +++ b/pjmedia/src/pjmedia-audiodev/coreaudio_dev.c @@ -1111,7 +1111,17 @@ static void interruptionListener(void *inClientData, UInt32 inInterruption) { struct stream_list *it, *itBegin; pj_status_t status; - + pj_thread_desc thread_desc; + pj_thread_t *thread; + + /* Register the thread with PJLIB, this is must for any external threads + * which need to use the PJLIB framework. + */ + if (!pj_thread_is_registered()) { + pj_bzero(thread_desc, sizeof(pj_thread_desc)); + status = pj_thread_register("intListener", thread_desc, &thread); + } + PJ_LOG(3, (THIS_FILE, "Session interrupted! --- %s ---", inInterruption == kAudioSessionBeginInterruption ? "Begin Interruption" : "End Interruption")); -- cgit v1.2.3