diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-03-25 17:05:59 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-03-25 17:05:59 +0000 |
commit | 552360cfe801ffecc71d2cc585b7d2026897510e (patch) | |
tree | c56f83cda22d3e03fe5373a5c383cee208041167 /pjmedia | |
parent | 74cc8df71fea7eaa32600d726c948830649b077d (diff) |
Ticket #516: Assertion in sound device when headset is plugged/unplugged in MacOS X (thanks Alexei Kuznetsov)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1893 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/src/pjmedia/pasound.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/pjmedia/src/pjmedia/pasound.c b/pjmedia/src/pjmedia/pasound.c index 78f4778c..e355749f 100644 --- a/pjmedia/src/pjmedia/pasound.c +++ b/pjmedia/src/pjmedia/pasound.c @@ -69,12 +69,12 @@ struct pjmedia_snd_stream pj_bool_t quit_flag; pj_bool_t rec_thread_exited; - pj_bool_t rec_thread_initialized; + //pj_bool_t rec_thread_initialized; pj_thread_desc rec_thread_desc; pj_thread_t *rec_thread; pj_bool_t play_thread_exited; - pj_bool_t play_thread_initialized; + //pj_bool_t play_thread_initialized; pj_thread_desc play_thread_desc; pj_thread_t *play_thread; }; @@ -101,10 +101,13 @@ static int PaRecorderCallback(const void *input, if (input == NULL) return paContinue; - if (stream->rec_thread_initialized == 0) { + // Sometime the thread, where this callback called from, is changed + // (e.g: in MacOS this happens when plugging/unplugging headphone) + // if (stream->rec_thread_initialized == 0) { + if (!pj_thread_is_registered()) { status = pj_thread_register("pa_rec", stream->rec_thread_desc, &stream->rec_thread); - stream->rec_thread_initialized = 1; + //stream->rec_thread_initialized = 1; PJ_LOG(5,(THIS_FILE, "Recorder thread started")); } @@ -151,10 +154,13 @@ static int PaPlayerCallback( const void *input, if (output == NULL) return paContinue; - if (stream->play_thread_initialized == 0) { + // Sometime the thread, where this callback called from, is changed + // (e.g: in MacOS this happens when plugging/unplugging headphone) + // if (stream->play_thread_initialized == 0) { + if (!pj_thread_is_registered()) { status = pj_thread_register("portaudio", stream->play_thread_desc, &stream->play_thread); - stream->play_thread_initialized = 1; + //stream->play_thread_initialized = 1; PJ_LOG(5,(THIS_FILE, "Player thread started")); } |