Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi audio output thread is running 100% and audio playback not working #2

Open
korli opened this issue Jul 11, 2024 · 7 comments
Open
Assignees

Comments

@korli
Copy link

korli commented Jul 11, 2024

this after 6501f16

@diegoroux
Copy link
Owner

This was caused by an unnecessary memset to 0x00, in get_description. Which caused this if to never enter

int32 channels = desc->output_channel_count + desc->input_channel_count;
if (desc->request_channel_count >= channels) {
   create_multi_channel_info(info, desc->channels);
}

and also wiped the allocated channels pointer.

@diegoroux
Copy link
Owner

diegoroux commented Jul 13, 2024

Although, #3 may cause further problems. I'm still trying to fix it

@diegoroux diegoroux self-assigned this Jul 13, 2024
@korli
Copy link
Author

korli commented Jul 21, 2024

I looked a bit at how virtio-sound manages the buffers it received. And it seems it just pushes them to the audio backend, and notifies the virtio driver that they are processed. as the event API isn't implemented also, I don't know any mean to know when a buffer is played. The only workaround I see ATM is the wait for the next period in buffer_exchange() after acquire_sem() succeeded with something like:
snooze_until(stream->real_time + 1000000L / rate * FRAMES_PER_BUFFER, CLOCK_REALTIME);

I also noticed that the default audio frame rate selected by multi_audio is the highest aka 384khz, which means the default buffer size is really small. I used locally:
#define FRAMES_PER_BUFFER (1024 * 16)

diegoroux added a commit that referenced this issue Jul 24, 2024
Fixes #3, implements #2 and #1.

Implements suggestions from korli in mentioned issues.

Recording functionality was added, there's still
work to do, performace is not where it should be.

Signed-off-by: Diego Roux <diegoroux04@protonmail.com>
@korli
Copy link
Author

korli commented Aug 16, 2024

@diegoroux I tried your branch on 64-bit and Qemu 9.0.0, I get a 100% cpu output thread in media_addon_server. Audio is somewhat working crakky. Seems I can't reopen this issue.

@scottmc

@diegoroux
Copy link
Owner

diegoroux commented Aug 16, 2024

Hi, @korli

What I've tried is lowering the output/input bit rate. VirtIO exposes very high bit rates. At our end I could try limiting the max bit rate we use?

QEMU’s VirtIO device publishes high bit rates, regardless of the host.

Or do you have any other ideas?

@diegoroux diegoroux reopened this Aug 16, 2024
@korli
Copy link
Author

korli commented Aug 16, 2024

The buffer size could be made dependent of the audio rate.

@diegoroux
Copy link
Owner

Thanks, I'll try that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants