libgdx / gdx-video

A libGDX cross platform video rendering extension
Apache License 2.0
145 stars 50 forks source link

Native Crash in VideoDecoder destructor #52

Open maximiliancsuk opened 6 years ago

maximiliancsuk commented 6 years ago

Hi,

i stumbled upon a nasty bug that happens quite often when calling VideoPlayer.dispose() (or VideoPlayer.stop()), on desktop (Mac). I traced the error down to the VideoDecoder destructor where it seems like something is deallocated a second time or was never allocated (pointer being freed was not allocated, see crash report below). I couldn't debug any further because I wasn't able to (re)compile the native libs. I am using the prebuilt ones you offered in another issue.

Here's the crash report:

[snip]
System Integrity Protection: enabled

Crashed Thread:        34  Java: LWJGL Application

Exception Type:        EXC_BAD_ACCESS (SIGABRT)
Exception Codes:       KERN_INVALID_ADDRESS at 0x000000000000000c
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0xc:
--> 
    __TEXT                 0000000102795000-00000001027a7000 [   72K] r-x/rwx SM=COW  /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/bin/java

Application Specific Information:
abort() called
*** error for object 0x1044df2f0: pointer being freed was not allocated

[snip]

Thread 33 Crashed:: Java: LWJGL Application
0   libsystem_kernel.dylib          0x00007fffa0409f06 __pthread_kill + 10
1   libsystem_pthread.dylib         0x00007fff922db4ec pthread_kill + 90
2   libsystem_c.dylib               0x00007fff8ce426df abort + 129
3   libjvm.dylib                    0x0000000102a8536f os::abort(bool) + 25
4   libjvm.dylib                    0x0000000102baa472 VMError::report_and_die() + 2304
5   libjvm.dylib                    0x0000000102a86f9a JVM_handle_bsd_signal + 1131
6   libjvm.dylib                    0x0000000102a831ff signalHandler(int, __siginfo*, void*) + 47
7   libsystem_platform.dylib        0x00007fff8d2a452a _sigtramp + 26
8   ???                             0x00007f87c0f1d790 0 + 140221034387344
9   libgdx-video-desktop64.dylib    0x000000012ec95bbf VideoDecoder::~VideoDecoder() + 15
10  ???                             0x00000001035b6c64 0 + 4351290468
11  ???                             0x000000010359f33d 0 + 4351193917
12  ???                             0x000000010359f33d 0 + 4351193917
13  ???                             0x000000010359f33d 0 + 4351193917
14  ???                             0x000000010359f382 0 + 4351193986
15  ???                             0x000000010359f0c0 0 + 4351193280
16  ???                             0x000000010359f0c0 0 + 4351193280
17  ???                             0x000000010359f0c0 0 + 4351193280
18  ???                             0x000000010359f33d 0 + 4351193917
19  ???                             0x0000000103e17da4 0 + 4360076708
20  ???                             0x000000010445e21c 0 + 4366656028

Any idea?

RBogie commented 6 years ago

Haven't experienced this crash myself. It probably is something OSX specific since I never had the chance of testing on OSX. With a lot of trouble I only managed to compile.

The next time I have OSX available again, I will try to debug it

maximiliancsuk commented 6 years ago

Thanks a lot for looking into it! I figured it would be Mac specific. :(

Are there any instructions how to build the lib? I'd try myself, but without documentation I'm a bit lost.

RBogie commented 6 years ago

Good question. I was looking in the repository, but for some reason, the build-ffmpeg-macosx*.xml files are missing. If you feel adventurous, you can do the following:

in build-ffmpeg.xml you can see how first ffmpeg is downloaded and unpacked. You can do this manually in a folder.

The steps will be as follows:

  1. Download/unpack ffmpeg as can be seen in build-ffmpeg.xml
  2. Configure and compile ffmpeg library as seen in the build-ffmpeg-linux64.xml file (You might need some small adjustments for the arguments to configure).
  3. Put the resulting libraries in the correct folder (You can see the folder in which they are expected in build-macosx64.xml)
  4. Build the jni library by using ant -f build-macosx64.xml
  5. Manually put it in gdx-video-desktop-natives.jar

Good luck!

maximiliancsuk commented 6 years ago

I tried but failed miserably :( It seems my homebrew installed libraries get in the way of a clean compilation... I might try another time, but I'm not sure if I can do it.

It'd be awesome if somebody else tries and succeeds! :1st_place_medal: