diff options
author | Liong Sauw Ming <ming@teluu.com> | 2011-07-21 10:06:17 +0000 |
---|---|---|
committer | Liong Sauw Ming <ming@teluu.com> | 2011-07-21 10:06:17 +0000 |
commit | a25a91ecc867db804d45b2c517925eef18e781f6 (patch) | |
tree | 69b0cb54a7c38612da13730ba7107b01446f9152 | |
parent | 53b101f625974c7e70a4629d95490e9c8a6c5e85 (diff) |
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
-rw-r--r-- | pjmedia/src/pjmedia-audiodev/coreaudio_dev.c | 12 |
1 files changed, 11 insertions, 1 deletions
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")); |