Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/audio audio: Only score hardware formats by channel ...



details:   https://anonhg.NetBSD.org/src/rev/15b85dc8b03f
branches:  trunk
changeset: 1021019:15b85dc8b03f
user:      nia <nia%NetBSD.org@localhost>
date:      Sun May 02 21:37:32 2021 +0000

description:
audio: Only score hardware formats by channel count at count<=2

Scoring by channel count makes sense when you are using hardware that
supports mono and stereo formats. However, if your hardware also supports
surround formats, defaulting to those might be confusing. So, don't
prefer them.

Problem reported and fix tested by tcmart14 with a 2015 model Macbook Pro.

diffstat:

 sys/dev/audio/audio.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r d1166340ed7f -r 15b85dc8b03f sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c     Sun May 02 21:22:09 2021 +0000
+++ b/sys/dev/audio/audio.c     Sun May 02 21:37:32 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.94 2021/04/26 19:59:58 thorpej Exp $       */
+/*     $NetBSD: audio.c,v 1.95 2021/05/02 21:37:32 nia Exp $   */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.94 2021/04/26 19:59:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.95 2021/05/02 21:37:32 nia Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -6574,7 +6574,10 @@
                    query.fmt.precision == AUDIO_INTERNAL_BITS) {
                        score += 0x10;
                }
-               score += query.fmt.channels;
+
+               /* Do not prefer surround formats */
+               if (query.fmt.channels <= 2)
+                       score += query.fmt.channels;
 
                if (score < cand_score) {
                        DPRINTF(1, "fmt[%d] skip; score 0x%x < 0x%x\n", i,



Home | Main Index | Thread Index | Old Index