Added sleep() before destroying sound device in playfile and playsine to prevent audio stutters

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@959 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/samples/playfile.c b/pjsip-apps/src/samples/playfile.c
index c267cd8..25f0767 100644
--- a/pjsip-apps/src/samples/playfile.c
+++ b/pjsip-apps/src/samples/playfile.c
@@ -176,6 +176,15 @@
     
     /* 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);