Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2074546ybb; Thu, 2 Apr 2020 12:34:37 -0700 (PDT) X-Google-Smtp-Source: APiQypIlnpAKe/wk8SccdPWF6T4NXshLh1JM7IinRyrYaKrvhnsJnGONKDa+DFSW43V+z0L5AK6o X-Received: by 2002:a05:6830:2147:: with SMTP id r7mr3649531otd.59.1585856077179; Thu, 02 Apr 2020 12:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585856077; cv=none; d=google.com; s=arc-20160816; b=a75lGJS3n0Yn9QRBry2e9ws5wLyrl8456lQum7mu4NUy4DB9sadFhLsDmwtJ6Kna6q cKVKAFi1l+BU9dlpiIOJvS9NjwWxIKxa3lF2TFSisij19mMtO2vaPbFU6nVWzvM3QGgD EjXsZLSQAmUHbYQ7YDMNxtl7J3Jjp5XjftNK1JTNDyyOhTjz6XbKmVvSoFAdz5+JjYCx fBTr6j2Egsal9sut53bvion6irFTOiyAIgl2V8raRAQN3vMMpwIj01hfKjl7qzdZmCuI lYO8D4ochwCnUipT48lUeUTSWyZnUljvCXB+00471bTsfyt6RYnqk4nODjGauqQ3KjzD 2hYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=nE8GkM4t8o8udZ4kzTBmZp+OEaekHEkDfFpTPtpCZ3E=; b=YzxorlD6tZ4gAq2Pa0gRtdkjr1mtBc+TMr9ZzKPEfe2FcSfl1nU/CkoaaeaB7ElxwU BpyAADJmqjy8jLyIL4Zs6u6dnxrW3c9wwt7TmAq+pJ7oNokI3AHTBVd5TY15BnaEUETy KjUQaXAdQF9mhmv/hJG0ixFnKw2x11fHFpgnnczXQZRgDGLdWvzqnvegkhWNfEH9+yfH IxDpDILzFteA1KJjubuUbeKlwzUxXAaCIZNNOpsa6anmSuCnd5eLlbxEJFHBtm4vUMj1 IAJyDtV4xJMiRB4mzLgmGCEm3PzpRCNnfVgq3f9wdHPggI/pl1cr5aEcfE1ydR5DOIcA cyJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 184si2744874oig.33.2020.04.02.12.34.24; Thu, 02 Apr 2020 12:34:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389415AbgDBS7P (ORCPT + 99 others); Thu, 2 Apr 2020 14:59:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:52406 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389013AbgDBS7P (ORCPT ); Thu, 2 Apr 2020 14:59:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3CB4AB134; Thu, 2 Apr 2020 18:59:13 +0000 (UTC) Date: Thu, 02 Apr 2020 20:59:13 +0200 Message-ID: From: Takashi Iwai To: Jari Ruusu Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: Re: linux-4.14.175 broke audio In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 02 Apr 2020 20:06:59 +0200, Jari Ruusu wrote: > > $ uname -s -r -m > Linux 4.14.175 x86_64 > $ cat ${HOME}/.config/mpv/mpv.conf > ao=oss > vo=opengl > audio-channels=stereo > no-msg-color > $ mpv track18.mp3 > Playing: track18.mp3 > (+) Audio --aid=1 (mp3) > [ao/oss] Can't set audio device to s16 output. > [ao/oss] Can't set audio device to u8 output. > [ao/oss] Can't set sample format. > [ao] Failed to initialize audio driver 'oss' > Could not open/initialize audio device -> no sound. > Audio: no audio > > > Reverting "ALSA: pcm: oss: Avoid plugin buffer overflow" > upstream commit f2ecf903ef06eb1bbbfa969db9889643d487e73a > restored audio back to normal working state. Does the patch below change the behavior? thanks, Takashi --- diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c index 752d078908e9..50c35ecc8953 100644 --- a/sound/core/oss/pcm_plugin.c +++ b/sound/core/oss/pcm_plugin.c @@ -196,7 +196,9 @@ int snd_pcm_plugin_free(struct snd_pcm_plugin *plugin) return 0; } -snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_pcm_uframes_t drv_frames) +static snd_pcm_sframes_t plug_client_size(struct snd_pcm_substream *plug, + snd_pcm_uframes_t drv_frames, + bool check_size) { struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next; int stream; @@ -209,7 +211,7 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_p if (stream == SNDRV_PCM_STREAM_PLAYBACK) { plugin = snd_pcm_plug_last(plug); while (plugin && drv_frames > 0) { - if (drv_frames > plugin->buf_frames) + if (check_size && drv_frames > plugin->buf_frames) drv_frames = plugin->buf_frames; plugin_prev = plugin->prev; if (plugin->src_frames) @@ -222,7 +224,7 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_p plugin_next = plugin->next; if (plugin->dst_frames) drv_frames = plugin->dst_frames(plugin, drv_frames); - if (drv_frames > plugin->buf_frames) + if (check_size && drv_frames > plugin->buf_frames) drv_frames = plugin->buf_frames; plugin = plugin_next; } @@ -231,7 +233,9 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_p return drv_frames; } -snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pcm_uframes_t clt_frames) +static snd_pcm_sframes_t plug_slave_size(struct snd_pcm_substream *plug, + snd_pcm_uframes_t clt_frames, + bool check_size) { struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next; snd_pcm_sframes_t frames; @@ -252,14 +256,14 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc if (frames < 0) return frames; } - if (frames > plugin->buf_frames) + if (check_size && frames > plugin->buf_frames) frames = plugin->buf_frames; plugin = plugin_next; } } else if (stream == SNDRV_PCM_STREAM_CAPTURE) { plugin = snd_pcm_plug_last(plug); while (plugin) { - if (frames > plugin->buf_frames) + if (check_size && frames > plugin->buf_frames) frames = plugin->buf_frames; plugin_prev = plugin->prev; if (plugin->src_frames) { @@ -274,6 +278,18 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc return frames; } +snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, + snd_pcm_uframes_t drv_frames) +{ + return plug_client_size(plug, drv_frames, false); +} + +snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, + snd_pcm_uframes_t clt_frames) +{ + return plug_slave_size(plug, clt_frames, false); +} + static int snd_pcm_plug_formats(const struct snd_mask *mask, snd_pcm_format_t format) { @@ -630,7 +646,7 @@ snd_pcm_sframes_t snd_pcm_plug_write_transfer(struct snd_pcm_substream *plug, st src_channels = dst_channels; plugin = next; } - return snd_pcm_plug_client_size(plug, frames); + return plug_client_size(plug, frames, true); } snd_pcm_sframes_t snd_pcm_plug_read_transfer(struct snd_pcm_substream *plug, struct snd_pcm_plugin_channel *dst_channels_final, snd_pcm_uframes_t size) @@ -640,7 +656,7 @@ snd_pcm_sframes_t snd_pcm_plug_read_transfer(struct snd_pcm_substream *plug, str snd_pcm_sframes_t frames = size; int err; - frames = snd_pcm_plug_slave_size(plug, frames); + frames = plug_slave_size(plug, frames, true); if (frames < 0) return frames;