qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Volker Rümelin" <vr_qemu@t-online.de>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Kővágó, Zoltán" <DirtY.iCE.hu@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] audio: fix audio recording
Date: Tue, 19 Nov 2019 20:43:59 +0100	[thread overview]
Message-ID: <780a707e-f80f-e83f-7fe5-31360050fdb0@linaro.org> (raw)
In-Reply-To: <a9ed793b-ebe7-b9da-3181-af246e16a59a@redhat.com>

On 11/19/19 9:01 AM, Philippe Mathieu-Daudé wrote:
> Cc'ing Zoltán.
> 
> On 11/19/19 7:58 AM, Volker Rümelin wrote:
>> With current code audio recording with all audio backends
>> except PulseAudio and DirectSound is broken. The generic audio
>> recording buffer management forgot to update the current read
>> position after a read.
>>
>> Fixes: ff095e5231 "audio: api for mixeng code free backends"
>>
>> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
>> ---
>>   audio/audio.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/audio/audio.c b/audio/audio.c
>> index 7fc3aa9d16..56fae55047 100644
>> --- a/audio/audio.c
>> +++ b/audio/audio.c
>> @@ -1390,6 +1390,7 @@ void *audio_generic_get_buffer_in(HWVoiceIn *hw, size_t
>> *size)
>>           size_t read = hw->pcm_ops->read(hw, hw->buf_emul + hw->pos_emul,
>>                                           read_len);
>>           hw->pending_emul += read;
>> +        hw->pos_emul = (hw->pos_emul + read) % hw->size_emul;
> 
> Anyway since read() can return a negative value, both previous assignments
> should go after this if/break check...

This isn't read(2).

    size_t (*read)    (HWVoiceIn *hw, void *buf, size_t size);

Since this isn't ssize_t, no negative return value possible.


r~


  reply	other threads:[~2019-11-19 19:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19  6:58 [PATCH] audio: fix audio recording Volker Rümelin
2019-11-19  8:01 ` Philippe Mathieu-Daudé
2019-11-19 19:43   ` Richard Henderson [this message]
2019-11-20  0:40     ` Zoltán Kővágó
2019-11-20  0:36 ` Zoltán Kővágó
2019-11-20  8:12 ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=780a707e-f80f-e83f-7fe5-31360050fdb0@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=DirtY.iCE.hu@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vr_qemu@t-online.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).