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

Qt Audio plugin freeze/crash conditions #1473

Open
mschwendt opened this issue Sep 26, 2024 · 4 comments
Open

Qt Audio plugin freeze/crash conditions #1473

mschwendt opened this issue Sep 26, 2024 · 4 comments
Labels
Bug Something isn't working

Comments

@mschwendt
Copy link

In two corner-case situations, the Qt 6 based "QtMultimedia Output" plugin either freezes or crashes Audacious 4.4.1.

  1. Start playback using an output plugin other than QtMultimedia.
  2. While audio is playing, switch to QtMultimedia output. Playback continues.
  3. While audio is still playing, return from QtMultimedia output to a different output plugin. Audacious freezes.

Or with an alternative step 3:

  1. While audio is still playing, don't return from QtMultimedia output to a different output plugin, but simply stop playback. Audacious crashes.
    QObject::killTimer: Timers cannot be stopped from another thread
    QObject::~QObject: Timers cannot be stopped from another thread
    Segmentation fault (core dumped)
@mschwendt mschwendt added the Bug Something isn't working label Sep 26, 2024
@radioactiveman
Copy link
Member

I can't reproduce this, neither the freeze nor the crash.
What is your Qt 6 version and does this occur also when compiling Audacious for Qt 5?

@mschwendt
Copy link
Author

mschwendt commented Sep 28, 2024

$ rpm -qa|grep -i ^qt6|sort qt6-filesystem-6.7.2-3.fc41.x86_64 qt6-qtbase-6.7.2-6.fc41.x86_64 qt6-qtbase-common-6.7.2-6.fc41.noarch qt6-qtbase-gui-6.7.2-6.fc41.x86_64 qt6-qtdeclarative-6.7.2-3.fc41.x86_64 qt6-qtmultimedia-6.7.2-2.fc41.x86_64 qt6-qtquick3d-6.7.2-3.fc41.x86_64 qt6-qtquicktimeline-6.7.2-2.fc41.x86_64 qt6-qtshadertools-6.7.2-2.fc41.x86_64 qt6-qtsvg-6.7.2-2.fc41.x86_64 qt6-qttranslations-6.7.2-2.fc41.noarch qt6-qtwayland-6.7.2-4.fc41.x86_64 qt6-srpm-macros-6.7.2-3.fc41.noarch

Current testbed is Fedora 41 beta (x86_64).

Simplified test-case for the freeze is:

  1. Start Audacious.
  2. Select Qt Multimedia Output.
  3. Start playback.
  4. Select any other audio output.
  5. Total freeze.

@radioactiveman
Copy link
Member

I don't know if this might be related, but with a Ubuntu VM and Qt 6 I could reproduce lagging/stuttering audio output when seeking intensively. Like when moving the time slider fast and a lot. On my main setup with Arch Linux it works fine though.

This patch helps for this case. Can you please try it as well @mschwendt?

diff --git a/src/qtaudio/qtaudio.cc b/src/qtaudio/qtaudio.cc
index ee7c0f002..7428adca8 100644
--- a/src/qtaudio/qtaudio.cc
+++ b/src/qtaudio/qtaudio.cc
@@ -92,7 +92,7 @@ const char * const QtAudioOutput::defaults[] = {
     nullptr
 };
 
-static const timespec fifty_ms = {0, 50000000};
+static const timespec ten_ms = {0, 10000000};
 
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
@@ -248,7 +248,7 @@ void QtAudioOutput::period_wait ()
 
     while (output_instance->bytesFree () == 0)
     {
-        timespec ts = calc_abs_time (fifty_ms);
+        timespec ts = calc_abs_time (ten_ms);
         pthread_cond_timedwait (& cond, & mutex, & ts);
     }
 
@@ -274,7 +274,7 @@ void QtAudioOutput::drain ()
 
     while (output_instance->bytesFree () < output_instance->bufferSize ())
     {
-        timespec ts = calc_abs_time (fifty_ms);
+        timespec ts = calc_abs_time (ten_ms);
         pthread_cond_timedwait (& cond, & mutex, & ts);
     }

@mschwendt
Copy link
Author

Seeking is instant here. Can't break it in any way.

I don't use the Qt output plugin normally, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants