diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-05-17 17:15:48 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-05-17 17:15:48 +0000 |
commit | 79e6d6ac5ae27d653d1724059f081a6be1c39b7e (patch) | |
tree | 322a4bb337214e75fcf5193b2f6440089d5f8e11 /pjmedia | |
parent | 03a6acef4c667de767751c5cb4b51f49627b90c7 (diff) |
Rearrange DirectSound closing steps to reduce blocking delay
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@451 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/src/pjmedia/dsound.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/pjmedia/src/pjmedia/dsound.c b/pjmedia/src/pjmedia/dsound.c index c80dbad0..700f3612 100644 --- a/pjmedia/src/pjmedia/dsound.c +++ b/pjmedia/src/pjmedia/dsound.c @@ -750,16 +750,6 @@ PJ_DEF(pj_status_t) pjmedia_snd_stream_close(pjmedia_snd_stream *stream) pjmedia_snd_stream_stop(stream); - if (stream->play_strm.lpDsNotify) { - IDirectSoundNotify_Release( stream->play_strm.lpDsNotify ); - stream->play_strm.lpDsNotify = NULL; - } - - if (stream->play_strm.hEvent) { - CloseHandle(stream->play_strm.hEvent); - stream->play_strm.hEvent = NULL; - } - if (stream->play_strm.ds.play.lpDsBuffer) { IDirectSoundBuffer_Release( stream->play_strm.ds.play.lpDsBuffer ); stream->play_strm.ds.play.lpDsBuffer = NULL; @@ -770,16 +760,18 @@ PJ_DEF(pj_status_t) pjmedia_snd_stream_close(pjmedia_snd_stream *stream) stream->play_strm.ds.play.lpDs = NULL; } - if (stream->rec_strm.lpDsNotify) { - IDirectSoundNotify_Release( stream->rec_strm.lpDsNotify ); - stream->rec_strm.lpDsNotify = NULL; + if (stream->play_strm.lpDsNotify) { + //No need? + //IDirectSoundNotify_Release( stream->play_strm.lpDsNotify ); + stream->play_strm.lpDsNotify = NULL; } - if (stream->rec_strm.hEvent) { - CloseHandle(stream->rec_strm.hEvent); - stream->rec_strm.hEvent = NULL; + if (stream->play_strm.hEvent) { + CloseHandle(stream->play_strm.hEvent); + stream->play_strm.hEvent = NULL; } + if (stream->rec_strm.ds.capture.lpDsBuffer) { IDirectSoundCaptureBuffer_Release( stream->rec_strm.ds.capture.lpDsBuffer ); stream->rec_strm.ds.capture.lpDsBuffer = NULL; @@ -790,6 +782,17 @@ PJ_DEF(pj_status_t) pjmedia_snd_stream_close(pjmedia_snd_stream *stream) stream->rec_strm.ds.capture.lpDs = NULL; } + if (stream->rec_strm.lpDsNotify) { + //No need? + //IDirectSoundNotify_Release( stream->rec_strm.lpDsNotify ); + stream->rec_strm.lpDsNotify = NULL; + } + + if (stream->rec_strm.hEvent) { + CloseHandle(stream->rec_strm.hEvent); + stream->rec_strm.hEvent = NULL; + } + if (stream->thread) { stream->thread_quit_flag = 1; pj_thread_join(stream->thread); |