aboutsummaryrefslogtreecommitdiffstats
path: root/meta-mentor-staging/recipes-multimedia/alsa/alsa-utils/0001-alsa-utils-interrupt-streaming-via-signal.patch
blob: 7ff0646d7a528e5f41c968c732d1bfebd3f6b6ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From 0a6011294769c49652bda6f37b0282a29c55cbe9 Mon Sep 17 00:00:00 2001
From: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
Date: Mon, 19 Dec 2016 14:04:39 +0530
Subject: [PATCH] alsa-utils: interrupt streaming via signal

aplay/arecord (alsa-utils v1.1.2) cannot interrupt streaming
via CTRL-C. Fixed the issue by properly handling 'in_aborting'
flag in appropriate functions.

Upstream-Status: Pending

Signed-off-by: Anant Agrawal <Anant_Agrawal@mentor.com>
Signed-off-by: Mikhail Durnev <mikhail_durnev@mentor.com>
Signed-off-by: Srikanth Krishnakar <Srikanth_Krishnakar@mentor.com>
---
 aplay/aplay.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

Index: alsa-utils-1.1.5/aplay/aplay.c
===================================================================
--- alsa-utils-1.1.5.orig/aplay/aplay.c	2017-12-22 00:15:51.570478262 +0500
+++ alsa-utils-1.1.5/aplay/aplay.c	2017-12-22 00:15:51.566478262 +0500
@@ -396,14 +396,22 @@
 		putchar('\n');
 	if (!quiet_mode)
 		fprintf(stderr, _("Aborted by signal %s...\n"), strsignal(sig));
-	if (handle)
+	if (stream == SND_PCM_STREAM_CAPTURE) {
+		if (fmt_rec_table[file_type].end) {
+			fmt_rec_table[file_type].end(fd);
+			fd = -1;
+		}
+		stream = -1;
+	}
+	if (fd > 1) {
+		close(fd);
+		fd = -1;
+	}
+	if (handle && sig != SIGABRT) {
 		snd_pcm_abort(handle);
-	if (sig == SIGABRT) {
-		/* do not call snd_pcm_close() and abort immediately */
 		handle = NULL;
-		prg_exit(EXIT_FAILURE);
 	}
-	signal(sig, SIG_DFL);
+	prg_exit(EXIT_FAILURE);
 }
 
 /* call on SIGUSR1 signal. */