Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/audio Reinitialize the sticky parameters whenever th...



details:   https://anonhg.NetBSD.org/src/rev/3ca4d2ed9ddf
branches:  trunk
changeset: 1007807:3ca4d2ed9ddf
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sun Mar 01 07:35:33 2020 +0000

description:
Reinitialize the sticky parameters whenever the hardware format is changed.
When the number of the hardware channels becomes less than the number of
channels that sticky parameters remember, subsequent open("/dev/sound") will
fail without this treatment.  This is for rev 1.43.

diffstat:

 sys/dev/audio/audio.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r cd1c1890e02c -r 3ca4d2ed9ddf sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c     Sun Mar 01 05:51:46 2020 +0000
+++ b/sys/dev/audio/audio.c     Sun Mar 01 07:35:33 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.58 2020/02/29 09:38:10 isaki Exp $ */
+/*     $NetBSD: audio.c,v 1.59 2020/03/01 07:35:33 isaki Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.58 2020/02/29 09:38:10 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.59 2020/03/01 07:35:33 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -6507,6 +6507,18 @@
        if (error)
                return error;
 
+       /*
+        * Reinitialize the sticky parameters for /dev/sound.
+        * If the number of the hardware channels becomes less than the number
+        * of channels that sticky parameters remember, subsequent /dev/sound
+        * open will fail.  To prevent this, reinitialize the sticky
+        * parameters whenever the hardware format is changed.
+        */
+       sc->sc_sound_pparams = params_to_format2(&audio_default);
+       sc->sc_sound_rparams = params_to_format2(&audio_default);
+       sc->sc_sound_ppause = false;
+       sc->sc_sound_rpause = false;
+
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index