90394fe1 | 21-Jan-2023 |
Volker Rümelin <vr_qemu@t-online.de> |
audio: don't show unnecessary error messages
Let the audio_pcm_create_voice_pair_* functions handle error reporting. This avoids an additional error message in case the guest selected an unimplement
audio: don't show unnecessary error messages
Let the audio_pcm_create_voice_pair_* functions handle error reporting. This avoids an additional error message in case the guest selected an unimplemented sample rate.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20230121094735.11644-2-vr_qemu@t-online.de>
show more ...
|
7a92a857 | 23-Jan-2023 |
Daniel P. Berrangé <berrange@redhat.com> |
qapi, audio: Make introspection reflect build configuration more closely
Currently the -audiodev accepts any audiodev type regardless of what is built in to QEMU. An error only occurs later at runti
qapi, audio: Make introspection reflect build configuration more closely
Currently the -audiodev accepts any audiodev type regardless of what is built in to QEMU. An error only occurs later at runtime when a sound device tries to use the audio backend.
With this change QEMU will immediately reject -audiodev args that are not compiled into the binary. The QMP schema will also be introspectable to identify what is compiled in.
This also helps to avoid compiling code that is not required in the binary. Note: When building the audiodevs as modules, the patch only compiles out code for modules that we don't build at all.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> [thuth: Rebase, take sndio and dbus devices into account] Message-Id: <20230123083957.20349-3-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
show more ...
|
c551fb0b | 29-Sep-2022 |
Claudio Fontana <cfontana@suse.de> |
module: add Error arguments to module_load and module_load_qom
improve error handling during module load, by changing:
bool module_load(const char *prefix, const char *lib_name); void module_load_q
module: add Error arguments to module_load and module_load_qom
improve error handling during module load, by changing:
bool module_load(const char *prefix, const char *lib_name); void module_load_qom(const char *type);
to:
int module_load(const char *prefix, const char *name, Error **errp); int module_load_qom(const char *type, Error **errp);
where the return value is:
-1 on module load error, and errp is set with the error 0 on module or one of its dependencies are not installed 1 on module load success 2 on module load success (module already loaded or built-in)
module_load_qom_one has been introduced in:
commit 28457744c345 ("module: qom module support"), which built on top of module_load_one, but discarded the bool return value. Restore it.
Adapt all callers to emit errors, or ignore them, or fail hard, as appropriate in each context.
Replace the previous emission of errors via fprintf in _some_ error conditions with Error and error_report, so as to emit to the appropriate target.
A memory leak is also fixed as part of the module_load changes.
audio: when attempting to load an audio module, report module load errors. Note that still for some callers, a single issue may generate multiple error reports, and this could be improved further. Regarding the audio code itself, audio_add() seems to ignore errors, and this should probably be improved.
block: when attempting to load a block module, report module load errors. For the code paths that already use the Error API, take advantage of those to report module load errors into the Error parameter. For the other code paths, we currently emit the error, but this could be improved further by adding Error parameters to all possible code paths.
console: when attempting to load a display module, report module load errors.
qdev: when creating a new qdev Device object (DeviceState), report load errors. If a module cannot be loaded to create that device, now abort execution (if no CONFIG_MODULE) or exit (if CONFIG_MODULE).
qom/object.c: when initializing a QOM object, or looking up class_by_name, report module load errors.
qtest: when processing the "module_load" qtest command, report errors in the load of the module.
Signed-off-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220929093035.4231-4-cfontana@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
61ddafbc | 12-Oct-2022 |
Helge Konetzka <hk@zapateado.de> |
audio: improve out.voices test
Improve readability of audio out.voices test: If 1 is logged and set after positive test, 1 should be tested.
Signed-off-by: Helge Konetzka <hk@zapateado.de> Reviewed
audio: improve out.voices test
Improve readability of audio out.voices test: If 1 is logged and set after positive test, 1 should be tested.
Signed-off-by: Helge Konetzka <hk@zapateado.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20221012114925.5084-3-hk@zapateado.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
a7b7802b | 12-Oct-2022 |
Helge Konetzka <hk@zapateado.de> |
audio: fix in.voices test
Calling qemu with valid -audiodev ...,in.voices=0 results in an obsolete warning: audio: Bogus number of capture voices 0, setting to 0 This patch fixes the in.voices tes
audio: fix in.voices test
Calling qemu with valid -audiodev ...,in.voices=0 results in an obsolete warning: audio: Bogus number of capture voices 0, setting to 0 This patch fixes the in.voices test.
Signed-off-by: Helge Konetzka <hk@zapateado.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20221012114925.5084-2-hk@zapateado.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
b6d93282 | 23-Sep-2022 |
Volker Rümelin <vr_qemu@t-online.de> |
audio: prevent an integer overflow in resampling code
There are corner cases where rate->opos can overflow. For example, if QEMU is started with -audiodev pa,id=audio0, out.frequency=11025 -device i
audio: prevent an integer overflow in resampling code
There are corner cases where rate->opos can overflow. For example, if QEMU is started with -audiodev pa,id=audio0, out.frequency=11025 -device ich9-intel-hda -device hda-duplex, audiodev=audio0 and the guest plays audio with a sampling frequency of 44100Hz, rate->opos will overflow after 27.05h and the audio stream will be silent for a long time.
To prevent a rate->opos and also a rate->ipos overflow, both are wrapped around after a short time. The wrap around point rate->ipos >= 0x10001 is an arbitrarily selected value and can be any small value, 0 and 1 included.
The comment that an ipos overflow will result in an infinite loop has been removed, because in this case the resampling code only generates no more output samples and the audio stream stalls. However, there is no infinite loop.
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20220923183640.8314-12-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
b73ef11f | 23-Sep-2022 |
Volker Rümelin <vr_qemu@t-online.de> |
audio: fix sw->buf size for audio recording
The calculation of the buffer size needed to store audio samples after resampling is wrong for audio recording. For audio recording sw->ratio is calculate
audio: fix sw->buf size for audio recording
The calculation of the buffer size needed to store audio samples after resampling is wrong for audio recording. For audio recording sw->ratio is calculated as
sw->ratio = frontend sample rate / backend sample rate.
From this follows
frontend samples = frontend sample rate / backend sample rate * backend samples frontend samples = sw->ratio * backend samples
In 2 of 3 places in the audio recording code where sw->ratio is used in a calculation to get the number of frontend frames, the calculation is wrong. Fix this. The 3rd formula in audio_pcm_sw_read() is correct.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/71 Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220923183640.8314-11-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
0724c579 | 23-Sep-2022 |
Volker Rümelin <vr_qemu@t-online.de> |
audio: refactor audio_get_avail()
Split out the code in audio_get_avail() that calculates the buffer size that the audio frontend can read. This is similar to the code changes in audio_get_free().
audio: refactor audio_get_avail()
Split out the code in audio_get_avail() that calculates the buffer size that the audio frontend can read. This is similar to the code changes in audio_get_free().
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220923183640.8314-10-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
c4e59264 | 23-Sep-2022 |
Volker Rümelin <vr_qemu@t-online.de> |
audio: rename audio_sw_bytes_free()
Rename and refactor audio_sw_bytes_free(). This function is not limited to calculate the free audio buffer size. The renamed function returns the number of frames
audio: rename audio_sw_bytes_free()
Rename and refactor audio_sw_bytes_free(). This function is not limited to calculate the free audio buffer size. The renamed function returns the number of frames instead of bytes.
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220923183640.8314-9-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
613fe02b | 23-Sep-2022 |
Volker Rümelin <vr_qemu@t-online.de> |
audio: swap audio_rate_get_bytes() function parameters
Swap the rate and info parameters of the audio_rate_get_bytes() function to align the parameter order with the rest of the audio_rate_*() funct
audio: swap audio_rate_get_bytes() function parameters
Swap the rate and info parameters of the audio_rate_get_bytes() function to align the parameter order with the rest of the audio_rate_*() functions.
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220923183640.8314-8-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
70ded68b | 23-Sep-2022 |
Volker Rümelin <vr_qemu@t-online.de> |
spiceaudio: update comment
Replace a comment with a question with the answer.
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Messag
spiceaudio: update comment
Replace a comment with a question with the answer.
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220923183640.8314-7-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
90320051 | 23-Sep-2022 |
Volker Rümelin <vr_qemu@t-online.de> |
spiceaudio: add a pcm_ops buffer_get_free function
It seems there is a demand [1] for low latency playback over SPICE. Add a pcm_ops buffer_get_free function to reduce the playback latency. The mixi
spiceaudio: add a pcm_ops buffer_get_free function
It seems there is a demand [1] for low latency playback over SPICE. Add a pcm_ops buffer_get_free function to reduce the playback latency. The mixing engine buffer becomes a temporary buffer.
[1] https://lists.nongnu.org/archive/html/qemu-devel/2022-01/msg01644.html
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220923183640.8314-6-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
02732641 | 23-Sep-2022 |
Volker Rümelin <vr_qemu@t-online.de> |
audio: add more audio rate control functions
The next patch needs two new rate control functions. The first one returns the bytes needed at call time to maintain the selected rate. The second one ad
audio: add more audio rate control functions
The next patch needs two new rate control functions. The first one returns the bytes needed at call time to maintain the selected rate. The second one adjusts the bytes actually sent.
Split the audio_rate_get_bytes() function into these two functions and reintroduce audio_rate_get_bytes().
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220923183640.8314-5-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
5a9d7ae2 | 23-Sep-2022 |
Volker Rümelin <vr_qemu@t-online.de> |
alsaaudio: reduce playback latency
Change the buffer_get_free pcm_ops function to report the free ALSA playback buffer. The generic buffer becomes a temporary buffer and is empty after a call to aud
alsaaudio: reduce playback latency
Change the buffer_get_free pcm_ops function to report the free ALSA playback buffer. The generic buffer becomes a temporary buffer and is empty after a call to audio_run_out().
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220923183640.8314-4-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
dd052dbf | 23-Sep-2022 |
Volker Rümelin <vr_qemu@t-online.de> |
audio: run downstream playback queue unconditionally
Run the downstream playback queue even if the emulated audio device didn't write new samples. There still may be buffered audio samples downstrea
audio: run downstream playback queue unconditionally
Run the downstream playback queue even if the emulated audio device didn't write new samples. There still may be buffered audio samples downstream.
This is for the -audiodev out.mixing-engine=off case. Commit a8a98cfd42 ("audio: run downstream playback queue uncondition- ally") fixed the out.mixing-engine=on case.
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220923183640.8314-3-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
7099a6a2 | 23-Sep-2022 |
Volker Rümelin <vr_qemu@t-online.de> |
audio: fix GUS audio playback with out.mixing-engine=off
Fix GUS audio playback with out.mixing-engine=off.
The GUS audio device needs to know the amount of samples to produce in advance.
To repro
audio: fix GUS audio playback with out.mixing-engine=off
Fix GUS audio playback with out.mixing-engine=off.
The GUS audio device needs to know the amount of samples to produce in advance.
To reproduce start qemu with -parallel none -device gus,audiodev=audio0 -audiodev pa,id=audio0,out.mixing-engine=off
and start the cartoon.exe demo in a FreeDOS guest. The demo file is available on the download page of the GUSemu32 author.
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20220923183640.8314-2-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|
0cbc8bd4 | 17-Sep-2022 |
Volker Rümelin <vr_qemu@t-online.de> |
audio: remove abort() in audio_bug()
Commit ab32b78cd1 "audio: Simplify audio_bug() removing old code" introduced abort() in audio_bug() for regular builds.
audio_bug() was never meant to abort QEM
audio: remove abort() in audio_bug()
Commit ab32b78cd1 "audio: Simplify audio_bug() removing old code" introduced abort() in audio_bug() for regular builds.
audio_bug() was never meant to abort QEMU for the following reasons.
- There's code in audio_bug() that expects audio_bug() gets called more than once with error condition true. The variable 'shown' is only 0 on first error.
- All call sites test the return code of audio_bug(), print an error context message and handle the errror.
- The abort() in audio_bug() enables a class of guest-triggered aborts similar to the Launchpad Bug #1910603 at https://bugs.launchpad.net/bugs/1910603.
Fixes: ab32b78cd1 "audio: Simplify audio_bug() removing old code" Buglink: https://bugs.launchpad.net/bugs/1910603 Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20220917131626.7521-2-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
show more ...
|