From nobody Sun Nov 16 14:04:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600852328; cv=none; d=zohomail.com; s=zohoarc; b=Y9Bh4bqTDmxdBS0w2kT4Ns1lo+RfaoGLAtvU78tDLLUFvm8noDiz/mwKxICil3zW42CaA8+RjgiFspM9MDI6Pqpulh4A70vk0yPABaC7Rn9W68Vm2EJYzG1NOfUBIhDyhsAI5pr5411DOU2HTadIzTiBJC015otJJtY9xDASSAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600852328; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zPmHNn4vW8iu/khSTnDPXOa3pRSorw5LCCVbF7XMAIc=; b=LijuJ9do4PZShQ2fxLY/GUfKmhIsdIy5qJfJZuls4QDcnrJAbT/NqoILf3MT+lzAnIN/dCVEWxz5AMxd5XTx3wp+YAVjxPuMMZOoZPaM6M3ShiHZcoXZjcmXPAFIPoSceAT8VXW/spz4bqLYP1pIFnKzyJrvKLBuNupDAKgNPoQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160085232799645.782938337485575; Wed, 23 Sep 2020 02:12:07 -0700 (PDT) Received: from localhost ([::1]:51674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL0oo-0000zy-NX for importer@patchew.org; Wed, 23 Sep 2020 05:12:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL0mz-0007j8-M5 for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:26548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL0my-000218-2t for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:13 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-332-FWvEMWfjMuSTsYO557vC4Q-1; Wed, 23 Sep 2020 05:10:08 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 56F2081CBE7; Wed, 23 Sep 2020 09:10:07 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 803F0702E7; Wed, 23 Sep 2020 09:10:02 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BF1101FCEE; Wed, 23 Sep 2020 11:10:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600852211; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zPmHNn4vW8iu/khSTnDPXOa3pRSorw5LCCVbF7XMAIc=; b=U4xe1nsQztS1+biIPdWAa+EeAlBe4gMxFFa1S8CwtSH/S1ooDCwRTas8e6BNIXkUF6bNR2 u5vsj2wpTpPMRy47t9YDR3mq9VFFngwpmValg4UA/R3riVMruS9F4SJ8qHOHUcSmdetSEg 9RVq5xcHNAcS9so7Wo4OjCX1T+reQjA= X-MC-Unique: FWvEMWfjMuSTsYO557vC4Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 1/9] audio: handle buf == NULL in put_buffer_out() Date: Wed, 23 Sep 2020 11:09:53 +0200 Message-Id: <20200923091001.20814-2-kraxel@redhat.com> In-Reply-To: <20200923091001.20814-1-kraxel@redhat.com> References: <20200923091001.20814-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 00:53:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin With the next patch all audio backends put_buffer_out() functions have to handle the buf =3D=3D NULL case, provided the get_buffer_out() function may return buf =3D NULL and size > 0. It turns out that all audio backends get_buffer_out() functions either can't return buf =3D NULL or return buf =3D NULL and size =3D 0 at the same time. The only exception is the spiceaudio backend where size may be uninitialized. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200920171729.15861-1-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- audio/spiceaudio.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index b6b5da4812f2..c8d81ba44290 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -135,6 +135,7 @@ static void *line_out_get_buffer(HWVoiceOut *hw, size_t= *size) (out->fsize - out->fpos) * hw->info.bytes_per_frame); } else { audio_rate_start(&out->rate); + *size =3D LINE_OUT_SAMPLES << 2; } return out->frame + out->fpos; } @@ -143,12 +144,14 @@ static size_t line_out_put_buffer(HWVoiceOut *hw, voi= d *buf, size_t size) { SpiceVoiceOut *out =3D container_of(hw, SpiceVoiceOut, hw); =20 - assert(buf =3D=3D out->frame + out->fpos && out->fpos <=3D out->fsize); - out->fpos +=3D size >> 2; + if (buf) { + assert(buf =3D=3D out->frame + out->fpos && out->fpos <=3D out->fs= ize); + out->fpos +=3D size >> 2; =20 - if (out->fpos =3D=3D out->fsize) { /* buffer full */ - spice_server_playback_put_samples(&out->sin, out->frame); - out->frame =3D NULL; + if (out->fpos =3D=3D out->fsize) { /* buffer full */ + spice_server_playback_put_samples(&out->sin, out->frame); + out->frame =3D NULL; + } } =20 return size; --=20 2.27.0 From nobody Sun Nov 16 14:04:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600852436; cv=none; d=zohomail.com; s=zohoarc; b=ipwSmXfV00Ne0dnHsRat7qUHpA9sqMSkRiOT1q9d9pVkPRGNZ/9JPAU06Vlg+Cx3763on5WLe2alY3HPnlUaGqczttYYf8D/sPHx3ZZdH7TLev0yojPkSttZk2A2CxrlMHRl5vVlUDkqbUmqc8rdEscq97Tzb04ujAwIZO6LPLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600852436; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dUUhJZUJNQ98mPvRgxdG/nK0wS8NrKuyi1QgyFaNmvU=; b=IpBwpSOid+ggfCrUu9R0N5oQdGTJydgBkwaxdKUK2L9CE/E83anl2ZJmIg2c6nuD0L2aCf5C0fK+5mGdcFFecGOhFYODY6DG24kN697Xs65ja6xTUWQx0jm9KhFVgqwcqdy/axA9wVGY1ORL+4GnA8KGesA7Sdqh26ZyKwvPoAo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600852436764516.8857739962491; Wed, 23 Sep 2020 02:13:56 -0700 (PDT) Received: from localhost ([::1]:60228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL0qZ-0004WH-Gt for importer@patchew.org; Wed, 23 Sep 2020 05:13:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL0n2-0007lS-BF for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54642) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL0n0-00022T-DL for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:16 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-45-LG3ezJtPP-SU4yVcQpkSwA-1; Wed, 23 Sep 2020 05:10:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 16C9710BBEED; Wed, 23 Sep 2020 09:10:09 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7D84973691; Wed, 23 Sep 2020 09:10:02 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C831D1FCF5; Wed, 23 Sep 2020 11:10:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600852213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dUUhJZUJNQ98mPvRgxdG/nK0wS8NrKuyi1QgyFaNmvU=; b=OR8bkljW64+EQ3Y0iquIxK9WvAztcAkYNZq1STmFFJGITpqdbEt5OgAJ3JPcJj+GmiT1ZW pepYEPxvgPUsMEoRfW+qXuaxsMvxiuOU/sEWK40WZPlZGwmnLOrVZbaIsUxVwKlyiwiTQ4 LKnG4VOzQk/8b7HjzxnucpLdCFyQ7nw= X-MC-Unique: LG3ezJtPP-SU4yVcQpkSwA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 2/9] audio/audio: fix video playback slowdown with spiceaudio Date: Wed, 23 Sep 2020 11:09:54 +0200 Message-Id: <20200923091001.20814-3-kraxel@redhat.com> In-Reply-To: <20200923091001.20814-1-kraxel@redhat.com> References: <20200923091001.20814-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 23:02:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann , Qi Zhou Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin This patch allows the audio backends get_buffer_out() functions to drop audio data and mitigates a bug reported on the qemu-devel mailing list. https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03832.html The new rules for the variables buf and size returned by get_buffer_out() are: size =3D=3D 0: Downstream playback buffer is full. Retry later. size > 0, buf !=3D NULL: Copy size bytes to buf for playback. size > 0, buf =3D=3D NULL: Drop size bytes. The audio playback rate with spiceaudio for the no audio case is too fast, but that's what we had before commit fb35c2cec5 "audio/dsound: fix invalid parameters error". The complete fix comes with the next patch. Reported-by: Qi Zhou Signed-off-by: Volker R=C3=BCmelin Message-id: 20200920171729.15861-2-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- audio/audio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 1a68cfaafb9f..7b660dd0c4d0 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1091,12 +1091,15 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, = size_t live) while (live) { size_t size, decr, proc; void *buf =3D hw->pcm_ops->get_buffer_out(hw, &size); - if (!buf || size =3D=3D 0) { + + if (size =3D=3D 0) { break; } =20 decr =3D MIN(size / hw->info.bytes_per_frame, live); - audio_pcm_hw_clip_out(hw, buf, decr); + if (buf) { + audio_pcm_hw_clip_out(hw, buf, decr); + } proc =3D hw->pcm_ops->put_buffer_out(hw, buf, decr * hw->info.bytes_per_frame= ) / hw->info.bytes_per_frame; --=20 2.27.0 From nobody Sun Nov 16 14:04:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600852333; cv=none; d=zohomail.com; s=zohoarc; b=NWeUZALFZIiVoQkEgU2r+rRgNa/H8JOk8Sh6hrYzq2O1xRvH6b1rcHqfV0gaIQ9tBKsfiaW/RLVlh4reXpV8jUZopCf+gwc+f1RyoOx4iUPw+JOKZ5AvaxI5p8bUZyd5U42Bsq7BieXDrkBErKBOuWB14uFbS0eUzbQT8DSB3ec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600852333; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Hz6vgAXVN+6iymYK2FXK3DUNVOmvhLDNkub3oy/OyYc=; b=AVLVM+whv+5l8LnQEpG66CJbNbhJY4siIo9KDv4XQJqbMGsDI9L1U9NxoHTOqHFxHN7b3lyRqfrLfmHIQx3/Qma9I0eBmd4UFuqjF+If2aSERa6Wzg4dOu/M8MEhuFXUb5JUBP9OBQpoxtZEJBTpux0UOQqXMzPvC1qHvWboWuM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600852333070700.0626313344533; Wed, 23 Sep 2020 02:12:13 -0700 (PDT) Received: from localhost ([::1]:52242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL0ot-0001Fi-O5 for importer@patchew.org; Wed, 23 Sep 2020 05:12:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL0n5-0007rw-3r for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:19 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:49784 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL0n3-00023f-2v for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:18 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-490-Ye_emMwYMi-aVKwGzrastw-1; Wed, 23 Sep 2020 05:10:13 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A224B190A3EC; Wed, 23 Sep 2020 09:10:12 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 936B21002C0B; Wed, 23 Sep 2020 09:10:02 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id D31631FCF6; Wed, 23 Sep 2020 11:10:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600852215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Hz6vgAXVN+6iymYK2FXK3DUNVOmvhLDNkub3oy/OyYc=; b=fzRnQyMKXItPQS4QY0UYCsTlt8oUMG11kbZsDIQC4u6Sw88NsEPB2DXIk95ijU6w0hNXld nPXpvTwuIbEjPSrTQbFhc+LN6g3vXkqvq9mG1XDcvhRnFszz9EsK4Uh9btKevIuyjQ555O 5Yxg6bPruk2rjTKOiNoSAEOzETe1biY= X-MC-Unique: Ye_emMwYMi-aVKwGzrastw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 3/9] audio/spiceaudio: always rate limit playback stream Date: Wed, 23 Sep 2020 11:09:55 +0200 Message-Id: <20200923091001.20814-4-kraxel@redhat.com> In-Reply-To: <20200923091001.20814-1-kraxel@redhat.com> References: <20200923091001.20814-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 03:55:48 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin The playback rate with the spiceaudio backend is currently too fast if there's no spice client connected or the spice client can't play audio. Rate limit the audio playback stream in all cases. To calculate the rate correctly the limiter has to know the maximum buffer size. Fixes: 8c198ff065 ("spiceaudio: port to the new audio backend api") Signed-off-by: Volker R=C3=BCmelin Message-id: 20200920171729.15861-3-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- audio/audio.c | 3 ++- audio/spiceaudio.c | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 7b660dd0c4d0..d5891e1928bc 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1089,7 +1089,8 @@ static size_t audio_pcm_hw_run_out(HWVoiceOut *hw, si= ze_t live) size_t clipped =3D 0; =20 while (live) { - size_t size, decr, proc; + size_t size =3D live * hw->info.bytes_per_frame; + size_t decr, proc; void *buf =3D hw->pcm_ops->get_buffer_out(hw, &size); =20 if (size =3D=3D 0) { diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index c8d81ba44290..c062742622e4 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -130,13 +130,11 @@ static void *line_out_get_buffer(HWVoiceOut *hw, size= _t *size) } =20 if (out->frame) { - *size =3D audio_rate_get_bytes( - &hw->info, &out->rate, - (out->fsize - out->fpos) * hw->info.bytes_per_frame); - } else { - audio_rate_start(&out->rate); - *size =3D LINE_OUT_SAMPLES << 2; + *size =3D MIN((out->fsize - out->fpos) << 2, *size); } + + *size =3D audio_rate_get_bytes(&hw->info, &out->rate, *size); + return out->frame + out->fpos; } =20 --=20 2.27.0 From nobody Sun Nov 16 14:04:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600852436; cv=none; d=zohomail.com; s=zohoarc; b=JSLaJXs81pu/4lKku+ZFGAnyN5BSlnFupC+iOwE7y9jyYzPmNKedA2fISFuHPhDpfnAiqggnfhEO4p61U5XRDbWfBbWrjZ+dMTJhDAdS1NQZxxygx+lM8Ih11suJNUF9TjnXtBOqf07xoHaC0defn9GzXMt4S3L3SOcu68dvgYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600852436; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=miyIlc08Uqjo9uTYNRdj0lv8hh2b6A33x0o9HQh2RxI=; b=Em13tavCztjH+TCBMbcG1WMP3zc+NU/qc0uv7Q+c7OZ0hiBgGmWnhn6R96Krfpk++lFyeQSiv6NFE3XLpumLvm5I4MDBb3Uav4Gqag6JKtDOVMF1x1P0cVOs9MLRKFYNisW9M+QI7DmtIIiqqqv9358y9VcfayJ1DMgw8CV8AZE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600852436650508.5903893875304; Wed, 23 Sep 2020 02:13:56 -0700 (PDT) Received: from localhost ([::1]:60136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL0qZ-0004Tx-4i for importer@patchew.org; Wed, 23 Sep 2020 05:13:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL0n1-0007jm-9W for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL0mz-00021M-Jy for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:14 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-461-TYPRBHd2OdCY94kqUdJZZw-1; Wed, 23 Sep 2020 05:10:09 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E0B4F800475; Wed, 23 Sep 2020 09:10:08 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D2D05C5B0; Wed, 23 Sep 2020 09:10:02 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DC2B8204A1; Wed, 23 Sep 2020 11:10:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600852212; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=miyIlc08Uqjo9uTYNRdj0lv8hh2b6A33x0o9HQh2RxI=; b=JaIYY8Zx+y4UtBajxRr3L5Mte9E9xjSuP8unYNRE4bjATM2OYr6/EX4EDcwWZIuv1b0WzY mJhDlBCRwKrUeFo8CMXo2feDeiULXKdYm3QlRKlE39bbIXeXwzfmL2oVQ0HqAC2FzgaWFd ExJk8pLFSG+t2+rN4pdQLBohufYklB4= X-MC-Unique: TYPRBHd2OdCY94kqUdJZZw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 4/9] audio: align audio_generic_read with audio_pcm_hw_run_in Date: Wed, 23 Sep 2020 11:09:56 +0200 Message-Id: <20200923091001.20814-5-kraxel@redhat.com> In-Reply-To: <20200923091001.20814-1-kraxel@redhat.com> References: <20200923091001.20814-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 23:02:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin The function audio_generic_read should work exactly like audio_pcm_hw_run_in. It's a very similar function working on a different buffer. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200920171729.15861-4-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- audio/audio.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index d5891e1928bc..5c47a036028c 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1495,12 +1495,23 @@ size_t audio_generic_write(HWVoiceOut *hw, void *bu= f, size_t size) =20 size_t audio_generic_read(HWVoiceIn *hw, void *buf, size_t size) { - void *src =3D hw->pcm_ops->get_buffer_in(hw, &size); + size_t total =3D 0; =20 - memcpy(buf, src, size); - hw->pcm_ops->put_buffer_in(hw, src, size); + while (total < size) { + size_t src_size =3D size - total; + void *src =3D hw->pcm_ops->get_buffer_in(hw, &src_size); =20 - return size; + if (src_size =3D=3D 0) { + hw->pcm_ops->put_buffer_in(hw, src, src_size); + break; + } + + memcpy((char *)buf + total, src, src_size); + hw->pcm_ops->put_buffer_in(hw, src, src_size); + total +=3D src_size; + } + + return total; } =20 static int audio_driver_init(AudioState *s, struct audio_driver *drv, --=20 2.27.0 From nobody Sun Nov 16 14:04:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600852750; cv=none; d=zohomail.com; s=zohoarc; b=dR/LCAwAI0Y3L2+HI0/Dv8SZDxXJSQrxWRs+j4BQLHmOEASV9H5LNPRueZ+rFvlaQ8+cqH8N0k2HpkYsvtfJdjwskCKtzKiRX5luLxA/HXXqgp3q1ERmiaAIw5mtBjIy/D48EtA4FMzqBYtnYt9Qm16yo9zlPe/yjwe7He7h72A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600852750; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oF6uWLN54rhpi5znI8oZjbiaXIAljFhTjCrXho8KFh8=; b=TnubFgih2ACJNFB8hCU6qNLS+GsMd3vx+9DbeE0wtotc6Xt0sHK0+WjQpButIGV/TO5MBmmPtv0H94VID2wBxUODxSUQ4f+vX58x9sp+G/MGfr2JTQJWkZAeuzdqBRvQXsDbeYAr3Nz4s/Z+sYDYUCzG3ANjZf/y2ze1dthA4hw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600852750866753.9466435171543; Wed, 23 Sep 2020 02:19:10 -0700 (PDT) Received: from localhost ([::1]:48552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL0vd-00034c-9b for importer@patchew.org; Wed, 23 Sep 2020 05:19:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL0n6-0007vI-Fs for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:40510) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL0n4-00025a-P8 for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-552-18yGpEj_OlKmwWVF1tEj5Q-1; Wed, 23 Sep 2020 05:10:16 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E83E8027E2; Wed, 23 Sep 2020 09:10:15 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D36A55782; Wed, 23 Sep 2020 09:10:08 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E5B8031E60; Wed, 23 Sep 2020 11:10:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600852217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oF6uWLN54rhpi5znI8oZjbiaXIAljFhTjCrXho8KFh8=; b=dsb42MBKbgs7H5iir9b7L5ldnRwgpwviwjpOiEygT1b2TzIFTo9k8IlwNzuelPuhiy/GAO kbWGym/488Tz33AHZ+xyDrTfUYW8SklBonZBxarVLlwKZ+u+1MQxrTu/x36gZVe2D0vciB RR7zLC6jmBM2rg+tkLse99ZZL4ORK/w= X-MC-Unique: 18yGpEj_OlKmwWVF1tEj5Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 5/9] audio: remove unnecessary calls to put_buffer_in Date: Wed, 23 Sep 2020 11:09:57 +0200 Message-Id: <20200923091001.20814-6-kraxel@redhat.com> In-Reply-To: <20200923091001.20814-1-kraxel@redhat.com> References: <20200923091001.20814-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 00:53:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin This patch removes unnecessary calls to the pcm_ops function put_buffer_in(). No audio backend needs this call if the returned length of pcm_ops function get_buffer_in() is zero. For the DirectSound backend this prevents a call to dsound_unlock_in() without a preceding call to dsound_lock_in(). While Windows doesn't complain it seems wrong anyway. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200920171729.15861-5-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- audio/audio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 5c47a036028c..341edc4d0012 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1261,7 +1261,6 @@ static size_t audio_pcm_hw_run_in(HWVoiceIn *hw, size= _t samples) =20 assert(size % hw->info.bytes_per_frame =3D=3D 0); if (size =3D=3D 0) { - hw->pcm_ops->put_buffer_in(hw, buf, size); break; } =20 @@ -1502,7 +1501,6 @@ size_t audio_generic_read(HWVoiceIn *hw, void *buf, s= ize_t size) void *src =3D hw->pcm_ops->get_buffer_in(hw, &src_size); =20 if (src_size =3D=3D 0) { - hw->pcm_ops->put_buffer_in(hw, src, src_size); break; } =20 --=20 2.27.0 From nobody Sun Nov 16 14:04:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600852437; cv=none; d=zohomail.com; s=zohoarc; b=ijDq5Kd8Yt6OyzMfMqCg4InB6NtgIkmG9Dr/h+/YwOOAZtuZ/0I5AOybt+bKaiwdi5V8yQ0/d6fyPeA2CwZlcr9hk5dXvrjpK4NNMJZ1jjfE2cPVTOhhvTxyJ3/k4RiJNgDg9Nh2H4J4kgqvGCqYWqKyHUnXOoFcP3z9hTjAunc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600852437; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cnSTnTrhv6Es+jAHFfSChZVlDhkfCwsAKM+1T7vyOHY=; b=dLu0irFOCRJh9DMjBe9u6wPm24bHzYpgIgJIqn8eOmVFU/q+MkwmOqXBd4hdn6GhIxKbAbXW58cL3wLJUWZ7s2TIMw9GYxZMp2t3rQlorSQfvk0ecENMrqoRg5Y5RUdsDWar8j8h0sbA8gMnEQC8GgiAosasabVU6nTUNl3Ti+E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600852437440255.4387814347491; Wed, 23 Sep 2020 02:13:57 -0700 (PDT) Received: from localhost ([::1]:60202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL0qZ-0004Vh-50 for importer@patchew.org; Wed, 23 Sep 2020 05:13:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL0n0-0007jg-VV for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:55515) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL0my-00021I-T7 for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:14 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-448-H6vZys00Nkuuf8Iqdwaajg-1; Wed, 23 Sep 2020 05:10:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 237CAAD687; Wed, 23 Sep 2020 09:10:09 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F99273692; Wed, 23 Sep 2020 09:10:08 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 01F0231E63; Wed, 23 Sep 2020 11:10:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600852212; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cnSTnTrhv6Es+jAHFfSChZVlDhkfCwsAKM+1T7vyOHY=; b=dm9mPrDJ1+U3gsybeWO2y7BUn6aQHhc0DpiYjDcexoaEK5sVbYn93MNFqMx1ZDXm7Rr8Hh /zaYO0ICC8+ctCDOkPqdLWhKeWNYZB0EhHyVHgSQ4dNGuqYZ3vda2Z3NDoRQQSrysinmvW 7g8+SN8uumVzs6TZFg6YQ95nISdRPic= X-MC-Unique: H6vZys00Nkuuf8Iqdwaajg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 6/9] audio: align audio_generic_write with audio_pcm_hw_run_out Date: Wed, 23 Sep 2020 11:09:58 +0200 Message-Id: <20200923091001.20814-7-kraxel@redhat.com> In-Reply-To: <20200923091001.20814-1-kraxel@redhat.com> References: <20200923091001.20814-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 00:53:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin The function audio_generic_write should work exactly like audio_pcm_hw_run_out. It's a very similar function working on a different buffer. This patch significantly reduces the number of drop-outs with the DirectSound backend. To hear the difference start qemu with -audiodev dsound,id=3Daudio0,out.mixing-engine=3Doff and play a song in the guest with and without this patch. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200920171729.15861-6-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- audio/audio.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 341edc4d0012..8587e3d15225 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1484,12 +1484,34 @@ size_t audio_generic_put_buffer_out(HWVoiceOut *hw,= void *buf, size_t size) =20 size_t audio_generic_write(HWVoiceOut *hw, void *buf, size_t size) { - size_t dst_size, copy_size; - void *dst =3D hw->pcm_ops->get_buffer_out(hw, &dst_size); - copy_size =3D MIN(size, dst_size); + size_t total =3D 0; =20 - memcpy(dst, buf, copy_size); - return hw->pcm_ops->put_buffer_out(hw, dst, copy_size); + while (total < size) { + size_t dst_size =3D size - total; + size_t copy_size, proc; + void *dst =3D hw->pcm_ops->get_buffer_out(hw, &dst_size); + + if (dst_size =3D=3D 0) { + break; + } + + copy_size =3D MIN(size - total, dst_size); + if (dst) { + memcpy(dst, (char *)buf + total, copy_size); + } + proc =3D hw->pcm_ops->put_buffer_out(hw, dst, copy_size); + total +=3D proc; + + if (proc =3D=3D 0 || proc < copy_size) { + break; + } + } + + if (hw->pcm_ops->run_buffer_out) { + hw->pcm_ops->run_buffer_out(hw); + } + + return total; } =20 size_t audio_generic_read(HWVoiceIn *hw, void *buf, size_t size) --=20 2.27.0 From nobody Sun Nov 16 14:04:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600852330; cv=none; d=zohomail.com; s=zohoarc; b=ADdIAQ0v7Ia1nYmGElKztAFhfJ0n96tnH9hXMUFuymozjC6elDqDjAL+op23wU06GFMfAyHFtCBLQ5vgsjszId8ScVV8adhF3LdLoI77celnAjZvgfEYIS6w7FFMOylgC1d90IfK9gVG5f1I4KMbr0WXV8Uf8y+Q4aHfuXA9cvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600852330; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Batucimm19YsJIh/bxesW5I6UB+VAdtmibJ1TEnBpkA=; b=PxlYzpRaio1KIcrj58/la6/KecWuLsLkH7K0RP0kipdhjZOYhKAVI0/8WnpmHclcqowHLAn3st7oLpnID7Bj2j8iAb4aqB49FHcCGbhCfekWc+guBjGvIY25CE3H3iye50xc6tT8Y+eDvGJQL59s4nZlxhUyY+kKUxFWhGzfnfI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600852330523342.21063633814776; Wed, 23 Sep 2020 02:12:10 -0700 (PDT) Received: from localhost ([::1]:51862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL0or-00014P-9l for importer@patchew.org; Wed, 23 Sep 2020 05:12:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL0n1-0007kb-S1 for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:28876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL0n0-00021b-40 for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:15 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-500-bFF2WrdRNfiWt_OnKLq19Q-1; Wed, 23 Sep 2020 05:10:11 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 084F987308D; Wed, 23 Sep 2020 09:10:10 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id C09615C1DC; Wed, 23 Sep 2020 09:10:09 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0B1E031E68; Wed, 23 Sep 2020 11:10:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600852213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Batucimm19YsJIh/bxesW5I6UB+VAdtmibJ1TEnBpkA=; b=Ho/5RZ9WYd8O2P6tYUpGE4Td0vGZCY1EewNbBkF6mV8JxW0bdmdCCLREZptqYwscS2m8pe muBpbrYsyTASrezAP0uxY1MlVxKZJXJK5eh91sG3w1OUTqaoPfhfaB3iXzI528oYZWu2rN r0gqxBPi2DG3dya1AyImFvDJKle8sJ8= X-MC-Unique: bFF2WrdRNfiWt_OnKLq19Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 7/9] audio: run downstream playback queue unconditionally Date: Wed, 23 Sep 2020 11:09:59 +0200 Message-Id: <20200923091001.20814-8-kraxel@redhat.com> In-Reply-To: <20200923091001.20814-1-kraxel@redhat.com> References: <20200923091001.20814-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 00:53:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Volker R=C3=BCmelin Run the downstream playback queue even if there are no samples in the mixing engine buffer. The downstream queue may still have queued samples. Signed-off-by: Volker R=C3=BCmelin Message-id: 20200920171729.15861-7-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- audio/audio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/audio/audio.c b/audio/audio.c index 8587e3d15225..6ff3f168d7b7 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1186,6 +1186,9 @@ static void audio_run_out (AudioState *s) } } } + if (hw->pcm_ops->run_buffer_out) { + hw->pcm_ops->run_buffer_out(hw); + } continue; } =20 --=20 2.27.0 From nobody Sun Nov 16 14:04:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600852497; cv=none; d=zohomail.com; s=zohoarc; b=A444BMOQ+4ua5+GyASruk/mxgfN1/3pdeXbO6ykNcfeGKG7HFGkK4NKLDAQtdQQumoSG1ZExTMDxgDtmVFrMr/OvvofLAvuX5xf9O8knIUiRHPWQM+OLQKpmDO0CKdcWBsl2Ce4X78LjNXV8OYxcyXXm10/X7xnIiLIkIGOJBI8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600852497; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FG21qE8YNskzRko4iVhalgjzjLwYCBN9eIUPuR9V2Z0=; b=hVrz0g+JzPCrcG9hkYkMBPwTYDZNRDKO2JvK9IiYEM4HCjKW0/FSkHggsIyrK+s+pXZfaRsunxM0oVmeMyJXVtTeEQAubGwR6iGCFlkwT8IWzzUBAhLlZS/a3n5XfKeRVTYiBmMkpP3f/eMtlaARjydB0pZ0YItvk+Km+eFMAu0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16008524976391012.5363428979141; Wed, 23 Sep 2020 02:14:57 -0700 (PDT) Received: from localhost ([::1]:35246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL0rY-0005qf-AX for importer@patchew.org; Wed, 23 Sep 2020 05:14:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL0n6-0007w6-PO for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:56598) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL0n4-00025d-RJ for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-550-Oq6133UmM4WdReGw-B-1qQ-1; Wed, 23 Sep 2020 05:10:15 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 053EE10BBEC3 for ; Wed, 23 Sep 2020 09:10:15 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2E2E5577D; Wed, 23 Sep 2020 09:10:09 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 18F5E31E7F; Wed, 23 Sep 2020 11:10:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600852218; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FG21qE8YNskzRko4iVhalgjzjLwYCBN9eIUPuR9V2Z0=; b=RkhDnHRNoGS9fPwu6o8Y3rAY39jT2iRDBp54OLI1TY8laGH+YvqeUcyEUukUaOYAi/Xosc fSzGfhSKXkbQVmpQ+tCl+wGbN/Nj5HKU12NfBQutmnPzQV0/ymLutE79nrJ9PKUzv8FfWn CBb6QTE+khJmpdmyW8V/r8/yXQi6kfc= X-MC-Unique: Oq6133UmM4WdReGw-B-1qQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 8/9] audio: remove qemu_spice_audio_init() Date: Wed, 23 Sep 2020 11:10:00 +0200 Message-Id: <20200923091001.20814-9-kraxel@redhat.com> In-Reply-To: <20200923091001.20814-1-kraxel@redhat.com> References: <20200923091001.20814-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 00:53:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Handle the spice special case in audio_init instead. With the qemu_spice_audio_init() symbol dependency being gone we can build spiceaudio as module. Signed-off-by: Gerd Hoffmann Message-id: 20200916084117.21828-2-kraxel@redhat.com --- include/ui/qemu-spice.h | 1 - audio/audio.c | 16 ++++++++++++++++ audio/spiceaudio.c | 5 ----- ui/spice-core.c | 1 - 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h index 8c23dfe71797..12474d88f40e 100644 --- a/include/ui/qemu-spice.h +++ b/include/ui/qemu-spice.h @@ -29,7 +29,6 @@ extern int using_spice; =20 void qemu_spice_init(void); void qemu_spice_input_init(void); -void qemu_spice_audio_init(void); void qemu_spice_display_init(void); int qemu_spice_display_add_client(int csock, int skipauth, int tls); int qemu_spice_add_interface(SpiceBaseInstance *sin); diff --git a/audio/audio.c b/audio/audio.c index 6ff3f168d7b7..46578e4a583b 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -34,6 +34,7 @@ #include "qemu/module.h" #include "sysemu/replay.h" #include "sysemu/runstate.h" +#include "ui/qemu-spice.h" #include "trace.h" =20 #define AUDIO_CAP "audio" @@ -1696,6 +1697,21 @@ static AudioState *audio_init(Audiodev *dev, const c= har *name) /* silence gcc warning about uninitialized variable */ AudiodevListHead head =3D QSIMPLEQ_HEAD_INITIALIZER(head); =20 + if (using_spice) { + /* + * When using spice allow the spice audio driver being picked + * as default. + * + * Temporary hack. Using audio devices without explicit + * audiodev=3D property is already deprecated. Same goes for + * the -soundhw switch. Once this support gets finally + * removed we can also drop the concept of a default audio + * backend and this can go away. + */ + driver =3D audio_driver_lookup("spice"); + driver->can_be_default =3D 1; + } + if (dev) { /* -audiodev option */ legacy_config =3D false; diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index c062742622e4..ed6dff1dcc41 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -311,11 +311,6 @@ static struct audio_driver spice_audio_driver =3D { .voice_size_in =3D sizeof (SpiceVoiceIn), }; =20 -void qemu_spice_audio_init (void) -{ - spice_audio_driver.can_be_default =3D 1; -} - static void register_audio_spice(void) { audio_driver_register(&spice_audio_driver); diff --git a/ui/spice-core.c b/ui/spice-core.c index ecc2ec2c55c2..10aa309f78f7 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -804,7 +804,6 @@ void qemu_spice_init(void) qemu_spice_add_interface(&spice_migrate.base); =20 qemu_spice_input_init(); - qemu_spice_audio_init(); =20 qemu_add_vm_change_state_handler(vm_change_state_handler, NULL); qemu_spice_display_stop(); --=20 2.27.0 From nobody Sun Nov 16 14:04:13 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600852583; cv=none; d=zohomail.com; s=zohoarc; b=NotaDa4qQVK3mXghO6s4ifsDlDxuRLB1DOEvesRGI8v4D7kZftqNsRVUhuPwQ76WLjffngN71CylU+3fgSXUKOafUu/rgmTsyc+GYr2Oimcv1zBHx3+ujkyK4J5HMhDyAN6721lXpZC6RJRGJgUNZMC6joBIOQDoI8w5Benfd/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600852583; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7Rpgfk3s9p62fTEsPWdSnHkf4EXgJbNyQ4c7ZwpEErE=; b=Nh7PZJxMMekXreuE//r57s2ukzMlLupV4EO6Se1YBPaD1opQ4543lP1EKjwt5pTHGJMc+NRrKJrcBTDqkZxxNIgHW1Hfb/60jQ41pYYaVCLMjHLSpJdd2t85F5QumMn25w/CUJfdAFGH/pN0bv0tgHLylNMDWIty2VZPgkbsNX8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160085258310529.87183192814416; Wed, 23 Sep 2020 02:16:23 -0700 (PDT) Received: from localhost ([::1]:40290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL0sv-00083s-OR for importer@patchew.org; Wed, 23 Sep 2020 05:16:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL0n3-0007mi-00 for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:17 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:56306 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL0mz-00021O-IV for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:10:16 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-369-i3Fs6NB1PRWbY5vQPWL5Ow-1; Wed, 23 Sep 2020 05:10:11 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1260887309E for ; Wed, 23 Sep 2020 09:10:10 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-112-85.ams2.redhat.com [10.36.112.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id C82B35C230; Wed, 23 Sep 2020 09:10:09 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 226F531E88; Wed, 23 Sep 2020 11:10:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600852213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Rpgfk3s9p62fTEsPWdSnHkf4EXgJbNyQ4c7ZwpEErE=; b=MHgDfbdcOlxzBgB8dysvk/DH8gB/TGxn6Jaf7xD5y79ozx7RApjrzzoPOKujJqwZCuFVIb 6bDt+pBbuEvB7XMs5Wky9gSAJV+UIoMjlq8FYAFuqti7tMp8FWFK9uyM1fp3R8/Do3qVsN PZD0l0iTHEWsqYoKDhzXMSbxlAIw0Fc= X-MC-Unique: i3Fs6NB1PRWbY5vQPWL5Ow-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 9/9] audio: build spiceaudio as module Date: Wed, 23 Sep 2020 11:10:01 +0200 Message-Id: <20200923091001.20814-10-kraxel@redhat.com> In-Reply-To: <20200923091001.20814-1-kraxel@redhat.com> References: <20200923091001.20814-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kraxel@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 05:08:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann Message-id: 20200916084117.21828-3-kraxel@redhat.com --- audio/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/audio/meson.build b/audio/meson.build index 15c06ba0453b..18a831129ed0 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -7,7 +7,6 @@ softmmu_ss.add(files( 'wavcapture.c', )) =20 -softmmu_ss.add(when: [spice, 'CONFIG_SPICE'], if_true: files('spiceaudio.c= ')) softmmu_ss.add(when: [coreaudio, 'CONFIG_AUDIO_COREAUDIO'], if_true: files= ('coreaudio.c')) softmmu_ss.add(when: [dsound, 'CONFIG_AUDIO_DSOUND'], if_true: files('dsou= ndaudio.c')) softmmu_ss.add(when: ['CONFIG_AUDIO_WIN_INT'], if_true: files('audio_win_i= nt.c')) @@ -18,7 +17,8 @@ foreach m : [ ['CONFIG_AUDIO_OSS', 'oss', oss, 'ossaudio.c'], ['CONFIG_AUDIO_PA', 'pa', pulse, 'paaudio.c'], ['CONFIG_AUDIO_SDL', 'sdl', sdl, 'sdlaudio.c'], - ['CONFIG_AUDIO_JACK', 'jack', jack, 'jackaudio.c'] + ['CONFIG_AUDIO_JACK', 'jack', jack, 'jackaudio.c'], + ['CONFIG_SPICE', 'spice', spice, 'spiceaudio.c'] ] if config_host.has_key(m[0]) module_ss =3D ss.source_set() --=20 2.27.0