audiofuntest: Terminate child process after parent exits

If the process exit abnormally, it will not call recorder.Terminate and
player.Terminate to terminate its child process. Add
prctl(PR_SET_PDEATHSIG, SIGHUP) to terminate children after parent exits.

BUG=b:168281719
TEST=The clild process stops successfully after parent exits

Change-Id: Ia89631ff631c5fe6f2c05c559bcc243cc43bf962
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/audiotest/+/2457206
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
Commit-Queue: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Tested-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
diff --git a/src/binary_client.cc b/src/binary_client.cc
index 6c2de9a..66c758d 100644
--- a/src/binary_client.cc
+++ b/src/binary_client.cc
@@ -10,6 +10,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
+#include <sys/prctl.h>
 
 #include <memory>
 
@@ -41,6 +42,7 @@
     perror("Failed to fork for player program");
     exit(EXIT_FAILURE);
   } else if (child_pid == 0) {  // child
+    prctl(PR_SET_PDEATHSIG, SIGHUP);
     if (stdin_fd > 0) {
       dup2(stdin_fd, STDIN_FILENO);
     }