exeldro / obs-media-controls

GNU General Public License v2.0
71 stars 9 forks source link

Crash when add media source with srt or udp url #24

Open ogmkp opened 1 year ago

ogmkp commented 1 year ago

Opened in the obs-studio project first and closed https://github.com/obsproject/obs-studio/issues/8386 tested without media controls and no crash

Other OS Debian 11 Bullseye

OBS Studio Version 29.0.2

OBS Studio Log URL https://obsproject.com/logs/KfNeZ5QLoL659Zrl

Expected Behavior No segfault with media source

Current Behavior Crash on segfault when add a srt or udp in studio mode Reproduced on OBS 27.2.4

Steps to Reproduce Put OBS in studio mode Add media source Uncheck local file and add udp://:5050 on url Press OK Immediatly delete this media source Crash ... Anything else we should know? gdb back trace

[Thread 0x7fff24d3b700 (LWP 90412) exited]
info: Switched to Preview/Program mode
info: ------------------------------------------------
info: [Media Source 'Source média']: settings:
    input:                   
    input_format:            (null)
    speed:                   100
    is_looping:              no
    is_linear_alpha:         no
    is_hw_decoding:          no
    is_clear_on_media_end:   yes
    restart_on_activate:     yes
    close_when_inactive:     no
    ffmpeg_options:          
info: User added source 'Source média' (ffmpeg_source) to scene 'Scène'
[New Thread 0x7fff24d3b700 (LWP 90454)]
info: [Media Source 'Source média']: settings:
    input:                   udp://:5050
    input_format:            
    speed:                   100
    is_looping:              no
    is_linear_alpha:         no
    is_hw_decoding:          no
    is_clear_on_media_end:   yes
    restart_on_activate:     yes
    close_when_inactive:     no
    ffmpeg_options:          
info: Set FFmpeg options: 
[udp @ 0x7fff98001b40] attempted to set receive buffer to size 2097152 but it only ended up set as 425984
[New Thread 0x7fff2553c700 (LWP 90455)]
info: User Removed source 'Source média' (ffmpeg_source) from scene 'Scène'
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 15419, resource id: 13542419, major code: 40 (TranslateCoords), minor code: 0
--Type <RET> for more, q to quit, c to continue without paging--q
Quit
(gdb) tr
No default breakpoint address now.
(gdb) bt
#0  futex_wait_cancelable (private=0, expected=0, futex_word=0x7fffffffd028) at ../sysdeps/nptl/futex-internal.h:186
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555559d3018, cond=0x7fffffffd000) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=0x7fffffffd000, mutex=0x5555559d3018) at pthread_cond_wait.c:638
#3  0x00007fffef3f5edf in  () at /lib/x86_64-linux-gnu/libxcb.so.1
#4  0x00007fffef3f7d7f in  () at /lib/x86_64-linux-gnu/libxcb.so.1
#5  0x00007fffef3f7e91 in xcb_wait_for_reply () at /lib/x86_64-linux-gnu/libxcb.so.1
#6  0x00007fffeb32beaa in QXcbConnection::sync() () at /lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#7  0x00007fffeb342ea3 in  () at /lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#8  0x00007fffeb3432c0 in  () at /lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#9  0x00007ffff50edabe in QBackingStore::beginPaint(QRegion const&) () at /lib/x86_64-linux-gnu/libQt5Gui.so.5
#10 0x00007ffff590b6a2 in  () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007ffff593b6d7 in QWidget::event(QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007ffff58fb15f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#13 0x00007ffff4b52fca in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007ffff4b55a01 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007ffff4baae93 in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#16 0x00007ffff2c54e6b in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007ffff2c55118 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007ffff2c551cf in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007ffff4baa51f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007ffff4b5198b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#21 0x00007ffff4b59c00 in QCoreApplication::exec() () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#22 0x00005555555de044 in main ()
(gdb) 
ogmkp commented 1 year ago

Perhaps a continuation of https://github.com/exeldro/obs-media-controls/issues/10

ogmkp commented 1 year ago

So after uprading to QT6 without any plugins and with an erased configuration, the issue persists. I ask the obs-studio project to reopen https://github.com/obsproject/obs-studio/issues/8386

ogmkp commented 1 year ago

@exeldro after taking the problem on the wrong way, the obs-studio project told me how to do a good backtrace, here is the result of gdb, it seems that it is media-controls that causes the crash, what do you think about it ?

info: User added source 'Source média' (ffmpeg_source) to scene 'Scène'
[New Thread 0x7fff6d9ff700 (LWP 72679)]
info: Set FFmpeg options: 
info: [Media Source 'Source média']: settings:
    input:                   udp://:5050
    input_format:            
    speed:                   100
    is_looping:              no
    is_linear_alpha:         no
    is_hw_decoding:          no
    is_clear_on_media_end:   yes
    restart_on_activate:     yes
    close_when_inactive:     no
    ffmpeg_options:          
[udp @ 0x7fff44000c40] attempted to set receive buffer to size 2097152 but it only ended up set as 425984
[New Thread 0x7fff51dfc700 (LWP 72680)]
info: User Removed source 'Source média' (ffmpeg_source) from scene 'Scène'
--Type <RET> for more, q to quit, c to continue without paging--

Thread 44 "mp_media_thread" received signal SIG32, Real-time event 32.
[Switching to Thread 0x7fff51dfc700 (LWP 72680)]
0x00007ffff7e6c3da in __libc_recvfrom (fd=36, buf=0x7fff440054d0, len=65536, flags=0, addr=..., addrlen=0x7fff51dfb12c) at ../sysdeps/unix/sysv/linux/recvfrom.c:27
27  ../sysdeps/unix/sysv/linux/recvfrom.c: Aucun fichier ou dossier de ce type.
(gdb) 
(gdb) c
Continuing.
[Thread 0x7fff51dfc700 (LWP 72680) exited]
warning: MP: Failed to open media: 'udp://:5050'

Thread 43 "mp_media_thread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff6d9ff700 (LWP 72679)]
0x000055555770b240 in ?? ()
(gdb) bt
#0  0x000055555770b240 in  ()
#1  0x00007ffff4338323 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) ()
    at /lib/x86_64-linux-gnu/libQt6Core.so.6
#2  0x00007fff8254c1f3 in QMetaObject::invokeMethod(QObject*, char const*, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument)
    (val9=..., val8=..., val7=..., val6=..., val5=..., val4=..., val3=..., val2=..., val1=..., val0=..., member=0x7fff8254f6e2 "SetRestartState", obj=<optimized out>) at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs.h:287
#3  MediaControl::OBSMediaStopped(void*, calldata*) (data=<optimized out>, calldata=<optimized out>)
    at /home/runner/work/obs-media-controls/obs-media-controls/UI/frontend-plugins/media-controls/media-control.cpp:158
#4  0x00007ffff678a4fb in signal_handler_signal () at /usr/local/lib/libobs.so.0
#5  0x00007ffff6781572 in obs_source_media_ended () at /usr/local/lib/libobs.so.0
#6  0x00007fff9536fc1d in  () at /usr/local//lib/obs-plugins/obs-ffmpeg.so
#7  0x00007ffff7e61ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#8  0x00007ffff3e16a2f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)
ogmkp commented 1 year ago

Hi @exeldro any reading about this ?

exeldro commented 1 year ago

can you test if https://github.com/exeldro/obs-media-controls/commit/aaa7240d65f996f5d60b15d359f0bda976d3b3fa fixes it for you?

ogmkp commented 1 year ago

can you test if aaa7240 fixes it for you?

Thanks, I'll get back to you tomorrow.

exeldro commented 1 year ago

@ogmkp have you been able to test it yet?

ogmkp commented 1 year ago

@ogmkp have you been able to test it yet?

Unfortunatly not yet, no time at this time, maybe soon.

ogmkp commented 1 year ago

Hi @exeldro thanks for your waiting. Can you build the https://github.com/exeldro/obs-media-controls/commit/aaa7240d65f996f5d60b15d359f0bda976d3b3fa commit for linux please ? For testing an already binary.

exeldro commented 1 year ago

Here is a new build you can test: https://github.com/exeldro/obs-media-controls/actions/runs/5949673125

ogmkp commented 1 year ago

Sorry, crash persists with this build :

info: [Media Source 'Source média 2']: settings:
    input:                   udp://:5050
    input_format:            
    speed:                   100
    is_looping:              no
    is_linear_alpha:         no
    is_hw_decoding:          yes
    is_clear_on_media_end:   no
    restart_on_activate:     no
    close_when_inactive:     no
    full_decode:             no
[New Thread 0x7fff076fc6c0 (LWP 160558)]
    ffmpeg_options:          
info: User Removed source 'Source média 2' (ffmpeg_source) from scene 'Scène 4'
warning: MP: Failed to open media: 'udp://:5050'
[Thread 0x7fff076fc6c0 (LWP 160558) exited]

Thread 85 "mp_media_thread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff07efd6c0 (LWP 160557)]
0x00000000000000e0 in ?? ()
(gdb) bt
#0  0x00000000000000e0 in  ()
#1  0x00007ffff4531bfc in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) () at /lib/x86_64-linux-gnu/libQt6Core.so.6
#2  0x00007fff883a51e3 in QMetaObject::invokeMethod(QObject*, char const*, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) (val9=..., val8=..., val7=..., val6=..., val5=..., val4=..., val3=..., val2=..., val1=..., val0=..., member=0x7fff883a86e2 "SetRestartState", obj=<optimized out>)
    at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs.h:287
#3  MediaControl::OBSMediaStopped(void*, calldata*) (data=<optimized out>, calldata=<optimized out>) at /home/runner/work/obs-media-controls/obs-media-controls/UI/frontend-plugins/media-controls/media-control.cpp:158
#4  0x00007ffff6798df6 in signal_handler_signal () at /usr/local/lib/libobs.so.0
#5  0x00007ffff678fabc in obs_source_media_ended () at /usr/local/lib/libobs.so.0
#6  0x00007fffc803acd8 in  () at /usr/local//lib/obs-plugins/obs-ffmpeg.so
#7  0x00007ffff42a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#8  0x00007ffff43285fc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
(gdb) q
exeldro commented 1 year ago

ok, new attempt: https://github.com/exeldro/obs-media-controls/actions/runs/5964320588

ogmkp commented 1 year ago

Forgot to say I'm in OBS 29.1.3 on Debian 12 with QT6 (but no difference, same crash). Crash with this new attempt:

info: User added source 'Source média 2' (ffmpeg_source) to scene 'Scène 4'
info: [Media Source 'Source média 2']: settings:
    input:                   udp://:5050
    input_format:            
    speed:                   100
    is_looping:              no
    is_linear_alpha:         no
    is_hw_decoding:          no
    is_clear_on_media_end:   yes
    restart_on_activate:     no
    close_when_inactive:     yes
    full_decode:             no
    ffmpeg_options:          
[New Thread 0x7fff067496c0 (LWP 164267)]
[udp @ 0x7fffa4148c80] attempted to set receive buffer to size 2097152 but it only ended up set as 425984
[New Thread 0x7fff05f486c0 (LWP 164268)]
info: User Removed source 'Source média 2' (ffmpeg_source) from scene 'Scène 4'
warning: MP: Failed to open media: 'udp://:5050'
[Thread 0x7fff05f486c0 (LWP 164268) exited]

Thread 82 "mp_media_thread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff067496c0 (LWP 164267)]
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in  ()
#1  0x00007ffff4531bfc in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) () at /lib/x86_64-linux-gnu/libQt6Core.so.6
#2  0x00007fff980e2333 in QMetaObject::invokeMethod(QObject*, char const*, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument)
    (val9=..., val8=..., val7=..., val6=..., val5=..., val4=..., val3=..., val2=..., val1=..., val0=..., member=0x7fff980e5736 "SetRestartState", obj=<optimized out>)
    at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs.h:287
#3  MediaControl::OBSMediaStopped(void*, calldata*) (data=<optimized out>, calldata=<optimized out>)
    at /home/runner/work/obs-media-controls/obs-media-controls/UI/frontend-plugins/media-controls/media-control.cpp:176
#4  0x00007ffff6798df6 in signal_handler_signal () at /usr/local/lib/libobs.so.0
#5  0x00007ffff678fabc in obs_source_media_ended () at /usr/local/lib/libobs.so.0
#6  0x00007fffc803acd8 in  () at /usr/local//lib/obs-plugins/obs-ffmpeg.so
#7  0x00007ffff42a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#8  0x00007ffff43285fc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
(gdb)