From 514bccbfc25f307027ecf793359b02a5990f4b6d Mon Sep 17 00:00:00 2001 From: nat Date: Sat, 6 Jan 2018 23:15:36 +0000 Subject: Only signal a pause change on a transition of a pause change. This addresses a problem found in audio/sox causing high cpu usage. Path and analysis by Onno van der Linden. --- sys/dev/audio.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/audio.c b/sys/dev/audio.c index 32d2a0dfc77..6db368693fd 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.446 2018/01/06 21:16:36 nat Exp $ */ +/* $NetBSD: audio.c,v 1.447 2018/01/06 23:15:36 nat Exp $ */ /*- * Copyright (c) 2016 Nathanial Sloss @@ -148,7 +148,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.446 2018/01/06 21:16:36 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.447 2018/01/06 23:15:36 nat Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -4762,14 +4762,18 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai, bool reset, } if (SPECIFIED_CH(p->pause)) { - vc->sc_mpr.pause = p->pause; pbus = !p->pause; - pausechange = true; + if (pbus != !vc->sc_mpr.pause) { + vc->sc_mpr.pause = p->pause; + pausechange = true; + } } if (SPECIFIED_CH(r->pause)) { - vc->sc_mrr.pause = r->pause; rbus = !r->pause; - pausechange = true; + if (rbus != !vc->sc_mrr.pause) { + vc->sc_mrr.pause = r->pause; + pausechange = true; + } } if (SPECIFIED(ai->mode)) { -- cgit