From d4ea78bd27dda454b25fa6e6cecb93e3ec15a2fe Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Sat, 17 Feb 2007 19:34:46 +0000 Subject: Added sleep() before destroying sound device in playfile and playsine to prevent audio stutters git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@959 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/samples/playfile.c | 9 +++++++++ pjsip-apps/src/samples/playsine.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/pjsip-apps/src/samples/playfile.c b/pjsip-apps/src/samples/playfile.c index c267cd8d..25f07673 100644 --- a/pjsip-apps/src/samples/playfile.c +++ b/pjsip-apps/src/samples/playfile.c @@ -176,6 +176,15 @@ int main(int argc, char *argv[]) /* Start deinitialization: */ + /* Disconnect sound port from file port */ + status = pjmedia_snd_port_disconnect(snd_port); + PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); + + /* Without this sleep, Windows/DirectSound will repeteadly + * play the last frame during destroy. + */ + pj_thread_sleep(100); + /* Destroy sound device */ status = pjmedia_snd_port_destroy( snd_port ); PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); diff --git a/pjsip-apps/src/samples/playsine.c b/pjsip-apps/src/samples/playsine.c index a9a37131..9146334a 100644 --- a/pjsip-apps/src/samples/playsine.c +++ b/pjsip-apps/src/samples/playsine.c @@ -281,6 +281,15 @@ int main(int argc, char *argv[]) /* Start deinitialization: */ + /* Disconnect sound port from file port */ + status = pjmedia_snd_port_disconnect(snd_port); + PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); + + /* Without this sleep, Windows/DirectSound will repeteadly + * play the last frame during destroy. + */ + pj_thread_sleep(100); + /* Destroy sound device */ status = pjmedia_snd_port_destroy( snd_port ); PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); -- cgit v1.2.3