summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjsip-apps/src/samples/playfile.c9
-rw-r--r--pjsip-apps/src/samples/playsine.c9
2 files changed, 18 insertions, 0 deletions
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);