summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-05-22 10:47:33 +0000
committerBenny Prijono <bennylp@teluu.com>2006-05-22 10:47:33 +0000
commitda5c5e15a3b22dd387afb8945a208336f9342a3e (patch)
tree020d62136cc95e8797f3a8a1850ef394fd1fb2e3 /pjmedia
parent40af5f63446816cb921e12e3f31f9e46535c6ac7 (diff)
Fixed crash bug in DSound closing procedure
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@470 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/src/pjmedia/dsound.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/pjmedia/src/pjmedia/dsound.c b/pjmedia/src/pjmedia/dsound.c
index 36db101d..9e1d7a55 100644
--- a/pjmedia/src/pjmedia/dsound.c
+++ b/pjmedia/src/pjmedia/dsound.c
@@ -882,19 +882,15 @@ PJ_DEF(pj_status_t) pjmedia_snd_stream_close(pjmedia_snd_stream *stream)
pjmedia_snd_stream_stop(stream);
- if (stream->play_strm.ds.play.lpDsBuffer) {
- IDirectSoundBuffer_Release( stream->play_strm.ds.play.lpDsBuffer );
- stream->play_strm.ds.play.lpDsBuffer = NULL;
- }
-
- if (stream->play_strm.ds.play.lpDs) {
- IDirectSound_Release( stream->play_strm.ds.play.lpDs );
- stream->play_strm.ds.play.lpDs = NULL;
+ if (stream->thread) {
+ stream->thread_quit_flag = 1;
+ pj_thread_join(stream->thread);
+ pj_thread_destroy(stream->thread);
+ stream->thread = NULL;
}
if (stream->play_strm.lpDsNotify) {
- //No need?
- //IDirectSoundNotify_Release( stream->play_strm.lpDsNotify );
+ IDirectSoundNotify_Release( stream->play_strm.lpDsNotify );
stream->play_strm.lpDsNotify = NULL;
}
@@ -903,20 +899,18 @@ PJ_DEF(pj_status_t) pjmedia_snd_stream_close(pjmedia_snd_stream *stream)
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;
+ if (stream->play_strm.ds.play.lpDsBuffer) {
+ IDirectSoundBuffer_Release( stream->play_strm.ds.play.lpDsBuffer );
+ stream->play_strm.ds.play.lpDsBuffer = NULL;
}
- if (stream->rec_strm.ds.capture.lpDs) {
- IDirectSoundCapture_Release( stream->rec_strm.ds.capture.lpDs );
- stream->rec_strm.ds.capture.lpDs = NULL;
+ if (stream->play_strm.ds.play.lpDs) {
+ IDirectSound_Release( stream->play_strm.ds.play.lpDs );
+ stream->play_strm.ds.play.lpDs = NULL;
}
if (stream->rec_strm.lpDsNotify) {
- //No need?
- //IDirectSoundNotify_Release( stream->rec_strm.lpDsNotify );
+ IDirectSoundNotify_Release( stream->rec_strm.lpDsNotify );
stream->rec_strm.lpDsNotify = NULL;
}
@@ -925,13 +919,17 @@ PJ_DEF(pj_status_t) pjmedia_snd_stream_close(pjmedia_snd_stream *stream)
stream->rec_strm.hEvent = NULL;
}
- if (stream->thread) {
- stream->thread_quit_flag = 1;
- pj_thread_join(stream->thread);
- pj_thread_destroy(stream->thread);
- stream->thread = NULL;
+ if (stream->rec_strm.ds.capture.lpDsBuffer) {
+ IDirectSoundCaptureBuffer_Release( stream->rec_strm.ds.capture.lpDsBuffer );
+ stream->rec_strm.ds.capture.lpDsBuffer = NULL;
+ }
+
+ if (stream->rec_strm.ds.capture.lpDs) {
+ IDirectSoundCapture_Release( stream->rec_strm.ds.capture.lpDs );
+ stream->rec_strm.ds.capture.lpDs = NULL;
}
+
pj_pool_release(stream->pool);
return PJ_SUCCESS;