-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
VideoStreamPlayer causes game to crash upon playing video #102982
Comments
CC @berarma |
I can't reproduce it on Linux. The MRP works well here. I'll try it on a machine with Windows 11. In the mean time if someone could get a crash backtrace it may speed things up. Does it crash before displaying anything or when the video is already playing? |
Can't reproduce on macOS (using provided videoplayerbug project). Godot v4.4.beta4 - macOS Sequoia (15.3.1) - Multi-window, 2 monitors - Metal (Forward+) - integrated Apple M1 Pro (Apple7) - Apple M1 Pro (10 threads) |
Can replicate this on Windows 11, will provide a stacktrace soon |
I can't confirm it on a custom build on the same branch, so unsure what is different between the two versions here, so can't provide a stacktrace as it won't occur in a debug build |
What compiler and compiler version are you using? What compiler does the official beta use? |
Thanks for testing it.
Looking at the build scripts it seems to be built using |
Testing a production build currently, using MSVC in both cases, so might be MinGW specific, if it doesn't happen on a production MSVC build someone would need to build using MinGW to test (I don't have an editor build for that set up so it'd be easier if someone using it already can test to avoid the build time) |
It's actually mingw-gcc 14.2.1 from Fedora 41 for x86_64 and x86_32, and llvm-mingw for arm64 only. Also relevant, official builds are made with GCC LTO ( |
Doesn't happen in a |
GCC and Windows specific. I've been able to reproduce the issue on a Windows 10 VM using the official build, tested that beta3 works on the same VM. Now I'm trying to build a custom version for Windows with D3D12 support but it doesn't run on the same VM because it requries OpenGL3.3 or D3D11. It looks like I haven't built with D3D12 support although I've followed the instructions. |
You probably need to build with ANGLE to be able to run on that VM. https://docs.godotengine.org/en/stable/contributing/development/compiling/compiling_for_windows.html#compiling-with-angle-support |
I've made a custom build with the command Now I'm building with |
This is the backtrace and this is the build command:
Is this an exception handler crash? |
Not sure why the crash handler backtrace is like this, it's probably a separate issue we need to keep looking into @bruvzg. I ran the reproduction project through gdb and got a more helpful backtrace:
Here's how I did it for the record, which might be helpful for @berarma to debug further from Linux:
|
I discussed this with @hpvb who had a hunch that it might be related to another GCC LTO bug we're currently debugging in #102867. The flags suggested in #102867 (comment) seem to solve this crash indeed in my test. |
@akien-mga, I got the same backtrace as you. The process was a bit different since I'm on Debian, but I just had to translate your steps. There seems to be a gap in the backtrace, I'm not directly calling In my tests, setting LTO and default optimization triggered the crash, but it wasn't always the case. Since I couldn't get a good backtrace I put several If I could get the debug symbols to work I could investigate more, without this, I'm out of ideas to try. I'll test a build with the flags suggested in #102867 to confirm your results and follow your work there. |
Confirmed it doesn't crash with the flags in #102867 (comment). Tested also adding I've resorted to reading the assembly to find out the line, and this is the line that causes the segmentation fault: godot/thirdparty/libtheora/huffdec.c Line 482 in e567f49
The second argument (_tree) to the function godot/thirdparty/libtheora/decode.c Line 319 in e567f49
And this is where the array is defined: godot/thirdparty/libtheora/decode.c Line 309 in e567f49
There are several calls to this function in this file, but since I don't have a complete backtrace I can't tell which one is causing the crash. Most of them use these static arrays, while some others use arrays read from the video headers. I've tried building with
|
Amended first paragraph in my last comment which didn't make any sense. Had a mental lapse between long builds. |
…gram` - Works around and closes godotengine#102867. - Works around and closes godotengine#102982. Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
Could someone who reproduces the issue test these builds from #103077 to confirm that it's fixing the bug? |
I tested the 64-bit version, and it fixes the crash for me. However, the new build has some odd lag spikes in the video that weren't present in beta3. I'm unsure if this is related to the new build flags. I'll try to make a custom build of beta3 with these flags to confirm if they are the cause. |
Does this happen with the MRP? Do they play correctly in Videos encoded with FFmpeg could be incorrectly encoded, although they should play the same in FFmpeg has already been fixed, but you will need a very recent build. |
Yes, specifically for the MRP above, on my Windows 11 machine (with RTX3070): beta3 produces smooth video output; rc.1 produces lag spikes. This behavior is repeatable. The video in the MRP was encoded with |
Yes, there were a couple of bugs in FFmpeg that have been recently fixed in their static daily builds. Please, re-encode the videos from the source with the newest version to make sure it is not due to those bugs. |
Re-encoded with version Same issue. beta3 has smooth video playback while rc.1 has lag spikes. I set up beta3 with #103077 to see if the flags are the issue, but it's still compiling. Update: Not reproducible in both beta3 and beta3 with #103077 . |
I can't reproduce on Linux. There are some frame skips on both beta3 and beta4, but that's to be expected on my computer when playing a 1920x1080/144fps video on a decoder without GPU acceleration. Can you paste the FPS log for both versions? |
Both versions show 144fps consistently for me. I tried setting max fps to 30 and it actually makes the issue worse (the entire video appears to slow down). Here's a recording of the playback on RC.1 for me: 2025-02-20.15-45-39.mp4 |
Can you create a new issue with the new MRP and this information? I'm going to investigate it. Thanks! |
The issue of videos playing with lag spikes has been submitted as #103106. |
…gram` - Works around and closes godotengine#102867. - Works around and closes godotengine#102982. Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
…gram` - Works around and closes godotengine#102867. - Works around and closes godotengine#102982. Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
Tested versions
The only VideoStreamPlayer-related commit I saw in beta4 was #101958, so I think it is a likely cause of this issue.
System information
Windows 11 - both Forward+ and Compatibility - both with and without dedicated GPU
Issue description
Game closes without displaying any in-editor error messages upon playing a VideoStreamPlayer in 4.4 beta4.
Steps to reproduce
Play an Ogg Theora stream through a VideoStreamPlayer, either with
autoplay=true
orplay()
. Seems to affect both Forward+ and Compatibility renderers (haven't tested Mobile).Minimal reproduction project (MRP)
videoplayerbug.zip
The main scene can be played to reproduce the issue. In beta3, this works as expected and a blue box moves across the screen. In beta4, the game exits immediately.
The text was updated successfully, but these errors were encountered: