qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] audio: fix audio recording


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] audio: fix audio recording
Date: Tue, 19 Nov 2019 09:01:28 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

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 <address@hidden>
---
  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...

          if (read < read_len) {
              break;
          }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]