mmatyas / pegasus-frontend

A cross platform, customizable graphical frontend for launching emulators and managing your game collection.
http://pegasus-frontend.org
Other
1.19k stars 106 forks source link

Crash after launch, related to gstreamer? #973

Closed barolo closed 2 years ago

barolo commented 2 years ago

The issue

Crash upon launch with following error: `[i] Metafiles: Finished searching in 20ms [i] Media: Finished searching in 0ms [i] Logiqx: Finished searching in 0ms [i] Skraper Assets: 0 assets found [i] Skraper Assets: Finished searching in 0ms [i] Favorites: Finished searching in 0ms [i] Playtime: Finished searching in 2ms [i] Game list post-processing took 1ms [i] 124 games found [i] Gamepad: Connected device 0x0 (Nintendo Switch Pro Controller)

(pegasus-fe:13090): GStreamer-GL-CRITICAL **: 02:14:13.158: gst_gl_context_new_wrapped: assertion 'available_apis != GST_GL_API_ANY' failed [w] Could not create wrappped context for platform: 2 [1] 13090 segmentation fault ./pegasus-fe `

System info

Linux Gentoo with the latest packages, the only significant change from the time I remember it working is switching to pipewire from pulseaudio.

Pegasus version

Few of the latest weeklies, and one built from source.

mmatyas commented 2 years ago

Hm the message comes from Qt, so I looked into the source code and the error is caused by, it seems, an API break in a GStreamer function. Here you can see the last official Qt 5 release calls gst_gl_context_new_wrapped with GST_GL_API_ANY as its last parameter. But GStreamer's current documentation explicitly tells to not do that. The issue is fixed in Qt 6.3, here.

So what I think you can do is either use an older GStreamer, build Qt without the gstreamer-gl feature, or backport the fix to your Qt; the significant lines are these:

    GstGLAPI glApi = QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL ? GST_GL_API_OPENGL : GST_GL_API_GLES2;
    GstGLContext *appContext = gst_gl_context_new_wrapped(display, (guintptr)nativeContext, glPlatform, glApi);
barolo commented 2 years ago

This is problematic, Gentoo doesn't carry Qt 6 even in its testing repos. Wouldn't static builds from here mitigate this, though, at least on the Qt side? I have downgraded gstreamer from 1.20.1 to 1.18.6, which seems to have fixed things.

mmatyas commented 2 years ago

I'm not sure I can do something about this. The builds link to GStreamer dynamically, so if there's an API break in the latest GStreamer, then my change would break Pegasus with the older GStreamer versions. I haven't found yet whether this change was introduced in 1.20, or only the assert was added recently; if it's safe to backport the fix, I can try it.

barolo commented 2 years ago

Are you building against Qt6?

mmatyas commented 2 years ago

I'm still using Qt 5, but the fix seems to be possible on that too.

mmatyas commented 2 years ago

Ok, if this was the problem, it should be now fixed in the latest release. Give it a try!

barolo commented 2 years ago

Ok, if this was the problem, it should be now fixed in the latest release. Give it a try!

It works now, thanks!