qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 7a4ede: audio/oss: fix buffer pos calculation


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 7a4ede: audio/oss: fix buffer pos calculation
Date: Fri, 07 Feb 2020 07:15:13 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 7a4ede0047a8613b0e3b72c9d351038f013dd357
      
https://github.com/qemu/qemu/commit/7a4ede0047a8613b0e3b72c9d351038f013dd357
  Author: Gerd Hoffmann <address@hidden>
  Date:   2020-01-31 (Fri, 31 Jan 2020)

  Changed paths:
    M audio/ossaudio.c

  Log Message:
  -----------
  audio/oss: fix buffer pos calculation

Fixes: 3ba4066d085f ("ossaudio: port to the new audio backend api")
Reported-by: ziming zhang <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>


  Commit: d3ed0996712900161ef2ae7fab6b41616086ad30
      
https://github.com/qemu/qemu/commit/d3ed0996712900161ef2ae7fab6b41616086ad30
  Author: Volker Rümelin <address@hidden>
  Date:   2020-01-31 (Fri, 31 Jan 2020)

  Changed paths:
    M audio/audio.c

  Log Message:
  -----------
  audio: fix audio_generic_write

The pcm_ops function put_buffer_out expects the returned pointer
of function get_buffer_out as argument. Fix this.

Signed-off-by: Volker Rümelin <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 4da58faa5b5d014ede0839b606bed5ea91e321f7
      
https://github.com/qemu/qemu/commit/4da58faa5b5d014ede0839b606bed5ea91e321f7
  Author: Volker Rümelin <address@hidden>
  Date:   2020-01-31 (Fri, 31 Jan 2020)

  Changed paths:
    M audio/audio.c

  Log Message:
  -----------
  audio: fix audio_generic_read

It seems the function audio_generic_read started as a copy of
function audio_generic_write and some necessary changes were
forgotten. Fix the mixed up source and destination pointers and
rename misnamed variables.

Signed-off-by: Volker Rümelin <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: a76e6b8794727ae777e33856e1ccd2b410d0bde2
      
https://github.com/qemu/qemu/commit/a76e6b8794727ae777e33856e1ccd2b410d0bde2
  Author: Volker Rümelin <address@hidden>
  Date:   2020-01-31 (Fri, 31 Jan 2020)

  Changed paths:
    M audio/paaudio.c

  Log Message:
  -----------
  paaudio: remove unused variables

The unused variables were last used before commit 49ddd7e122
"paaudio: port to the new audio backend api".

Fixes: 49ddd7e122
Signed-off-by: Volker Rümelin <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 69ac07863205ec281bcd2f2e6571202da0c315f7
      
https://github.com/qemu/qemu/commit/69ac07863205ec281bcd2f2e6571202da0c315f7
  Author: Volker Rümelin <address@hidden>
  Date:   2020-01-31 (Fri, 31 Jan 2020)

  Changed paths:
    M audio/audio.c

  Log Message:
  -----------
  audio: prevent SIGSEGV in AUD_get_buffer_size_out

With audiodev parameter out.mixing-engine=off hw->mix_buf is
NULL. This leads to a segmentation fault in
AUD_get_buffer_size_out. This patch reverts a small part of
dc88e38fa7 "audio: unify input and output mixeng buffer
management".

To reproduce the problem start qemu with
-soundhw adlib -audiodev pa,id=audio0,out.mixing-engine=off

Signed-off-by: Volker Rümelin <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: fdc8c5f4717f42f4b19b733ada30da2ba92a3ad1
      
https://github.com/qemu/qemu/commit/fdc8c5f4717f42f4b19b733ada30da2ba92a3ad1
  Author: Volker Rümelin <address@hidden>
  Date:   2020-01-31 (Fri, 31 Jan 2020)

  Changed paths:
    M audio/alsaaudio.c
    M audio/audio.c
    M audio/audio_int.h
    M audio/coreaudio.c
    M audio/noaudio.c
    M audio/ossaudio.c
    M audio/sdlaudio.c
    M audio/wavaudio.c

  Log Message:
  -----------
  audio: fix bug 1858488

The combined generic buffer management code and buffer run out
code in function audio_generic_put_buffer_out has a problematic
behaviour. A few hundred milliseconds after playback starts the
mixing buffer and the generic buffer are nearly full and the
following pattern can be seen.

On first call of audio_pcm_hw_run_out the buffer run code in
audio_generic_put_buffer_out writes some data to the audio
hardware but the generic buffer will fill faster and is full
when audio_pcm_hw_run_out returns. This is because emulated
audio devices can produce playback data at a higher rate than
the audio backend hardware consumes this data.

On next call of audio_pcm_hw_run_out the buffer run code in
audio_generic_put_buffer_out writes some data to the audio
hardware but no audio data is transferred to the generic buffer
because the buffer is already full.

Then the pattern repeats. For the emulated audio device this
looks like the audio timer period has doubled.

This patch splits the combined generic buffer management code
and buffer run out code and calls the buffer run out code after
buffer management code to break this pattern.

The bug report is for the wav audio backend. But the problem is
not limited to this backend. All audio backends which use the
audio_generic_put_buffer_out function show this problem.

Buglink: https://bugs.launchpad.net/qemu/+bug/1858488
Signed-off-by: Volker Rümelin <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 3e0c1bbab52d124231f56bdaa99b6d0e4a6e3fa6
      
https://github.com/qemu/qemu/commit/3e0c1bbab52d124231f56bdaa99b6d0e4a6e3fa6
  Author: Volker Rümelin <address@hidden>
  Date:   2020-01-31 (Fri, 31 Jan 2020)

  Changed paths:
    M audio/ossaudio.c

  Log Message:
  -----------
  ossaudio: prevent SIGSEGV in oss_enable_out

With audiodev parameter out.mixing-engine=off hw->mix_buf is
NULL. This patch reverts a small part of dc88e38fa7 "audio:
unify input and output mixeng buffer management".

To reproduce the problem start qemu with
-audiodev oss,id=audio0,try-mmap=on,out.mixing-engine=off

Signed-off-by: Volker Rümelin <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: f03cd06814ab282196165808c01d4433773a6e0f
      
https://github.com/qemu/qemu/commit/f03cd06814ab282196165808c01d4433773a6e0f
  Author: Volker Rümelin <address@hidden>
  Date:   2020-01-31 (Fri, 31 Jan 2020)

  Changed paths:
    M audio/ossaudio.c

  Log Message:
  -----------
  ossaudio: disable poll mode can't be reached

Currently there is no way to disable poll mode in
oss_enable_out and oss_enable_in when it was enabled before.
The enable code path always resets the poll mode state variable.

Fixes: b027a538c6 "oss: Remove unused error handling of qemu_set_fd_handler"
Signed-off-by: Volker Rümelin <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 599eac4e5a41e828645594097daee39373acc3c0
      
https://github.com/qemu/qemu/commit/599eac4e5a41e828645594097daee39373acc3c0
  Author: Volker Rümelin <address@hidden>
  Date:   2020-01-31 (Fri, 31 Jan 2020)

  Changed paths:
    M audio/audio.c

  Log Message:
  -----------
  audio: audio_generic_get_buffer_in should honor *size

The function generic_get_buffer_in currently ignores the *size
parameter and may return a buffer larger than *size.

As a result the variable samples in function
audio_pcm_hw_run_in may underflow. The while loop then most
likely will never termiate.

Buglink: http://bugs.debian.org/948658
Signed-off-by: Volker Rümelin <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: fb35c2cec58985f0b8d2733f1b91927542eeb3fd
      
https://github.com/qemu/qemu/commit/fb35c2cec58985f0b8d2733f1b91927542eeb3fd
  Author: Kővágó, Zoltán <address@hidden>
  Date:   2020-02-06 (Thu, 06 Feb 2020)

  Changed paths:
    M audio/audio.c
    M audio/dsound_template.h
    M audio/dsoundaudio.c

  Log Message:
  -----------
  audio/dsound: fix invalid parameters error

Windows (unlike wine) bails out when IDirectSoundBuffer8::Lock is called
with zero length.  Also, hw->pos_emul handling was incorrect when
calling this function for the first time.

Signed-off-by: Kővágó, Zoltán <address@hidden>
Reported-by: KJ Liew <address@hidden>
Tested-by: Howard Spoelstra <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 180b044ffde2cdd4a7209c727b5a8ce93d36741f
      
https://github.com/qemu/qemu/commit/180b044ffde2cdd4a7209c727b5a8ce93d36741f
  Author: Volker Rümelin <address@hidden>
  Date:   2020-02-06 (Thu, 06 Feb 2020)

  Changed paths:
    M audio/audio_template.h
    M audio/coreaudio.c
    M audio/mixeng.c
    M audio/mixeng.h

  Log Message:
  -----------
  coreaudio: fix coreaudio playback

There are reports that since commit 2ceb8240fa "coreaudio: port
to the new audio backend api" audio playback with CoreAudio is
broken. This patch reverts some parts the commit.

Because of changes in the audio subsystem the audio clip
function in v4.1.0 of coreaudio.c had to be moved to mixeng.c
and the generic buffer management code needed a hint about the
size of the float type.

This patch is based on a patch from Zoltán Kővágó found at
https://lists.nongnu.org/archive/html/qemu-devel/2020-01/msg02142.html.

Fixes: 2ceb8240fa "coreaudio: port to the new audio backend api"

Signed-off-by: Volker Rümelin <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: ed2a4a794184df3dbd5ee4cc06e86fe220663faf
      
https://github.com/qemu/qemu/commit/ed2a4a794184df3dbd5ee4cc06e86fe220663faf
  Author: Kővágó, Zoltán <address@hidden>
  Date:   2020-02-06 (Thu, 06 Feb 2020)

  Changed paths:
    M audio/alsaaudio.c
    M audio/audio.c
    M audio/audio_int.h
    M audio/audio_template.h
    M audio/coreaudio.c
    M audio/mixeng.c
    M audio/mixeng.h
    M audio/paaudio.c
    M audio/sdlaudio.c
    M qapi/audio.json

  Log Message:
  -----------
  audio: proper support for float samples in mixeng

This adds proper support for float samples in mixeng by adding a new
audio format for it.

Limitations: only native endianness is supported.  None of the virtual
sound cards support float samples (it looks like most of them only
support 8 and 16 bit, only hda supports 32 bit), it is only used for the
audio backends (i.e. host side).

Signed-off-by: Kővágó, Zoltán <address@hidden>
Acked-by: Markus Armbruster <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: b6bef1147f0f4edb7d8aac1e26d9511898ae854d
      
https://github.com/qemu/qemu/commit/b6bef1147f0f4edb7d8aac1e26d9511898ae854d
  Author: Peter Maydell <address@hidden>
  Date:   2020-02-07 (Fri, 07 Feb 2020)

  Changed paths:
    M audio/alsaaudio.c
    M audio/audio.c
    M audio/audio_int.h
    M audio/audio_template.h
    M audio/coreaudio.c
    M audio/dsound_template.h
    M audio/dsoundaudio.c
    M audio/mixeng.c
    M audio/mixeng.h
    M audio/noaudio.c
    M audio/ossaudio.c
    M audio/paaudio.c
    M audio/sdlaudio.c
    M audio/wavaudio.c
    M qapi/audio.json

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/kraxel/tags/audio-20200207-pull-request' into staging

audio: bugfixes, mostly audio backend rewrite fallout

# gpg: Signature made Fri 07 Feb 2020 07:45:44 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <address@hidden>" [full]
# gpg:                 aka "Gerd Hoffmann <address@hidden>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <address@hidden>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/audio-20200207-pull-request:
  audio: proper support for float samples in mixeng
  coreaudio: fix coreaudio playback
  audio/dsound: fix invalid parameters error
  audio: audio_generic_get_buffer_in should honor *size
  ossaudio: disable poll mode can't be reached
  ossaudio: prevent SIGSEGV in oss_enable_out
  audio: fix bug 1858488
  audio: prevent SIGSEGV in AUD_get_buffer_size_out
  paaudio: remove unused variables
  audio: fix audio_generic_read
  audio: fix audio_generic_write
  audio/oss: fix buffer pos calculation

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/346ed3151f1c...b6bef1147f0f



reply via email to

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