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

V4L2 Plugin Crash #184

Closed
voice06 opened this issue Jul 16, 2014 · 9 comments
Closed

V4L2 Plugin Crash #184

voice06 opened this issue Jul 16, 2014 · 9 comments

Comments

@voice06
Copy link

voice06 commented Jul 16, 2014

Whenever I attempt to add a webcam source OBS-Studio locks up, running it through GDB shows a segmentation fault:

(gdb) run
Starting program: /usr/local/bin/obs 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe6eb7700 (LWP 6959)]
Attempted path: share/obs/obs-studio/locale/en-US.ini
Attempted path: /usr/local/share/obs/obs-studio/locale/en-US.ini
Attempted path: share/obs/obs-studio/locale.ini
Attempted path: /usr/local/share/obs/obs-studio/locale.ini
Attempted path: share/obs/obs-studio/license/gplv2.txt
Attempted path: /usr/local/share/obs/obs-studio/license/gplv2.txt
[New Thread 0x7fffe4f32700 (LWP 6961)]
QObject::connect: invalid null parameter
info: OBS 0.4.0-5-g07ac02e-modified (linux)
info: X and Y: 909 480
Backbuffers: 2
Color Format: 3
ZStencil Format: 0
Adapter: 0

info: OpenGL version: 3.2.0 NVIDIA 331.89

info: Created new platform data
info: Attempting path: share/obs/libobs/default.effect

info: Attempting path: /usr/local/share/obs/libobs/default.effect

info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: Attempting path: share/obs/libobs/solid.effect

info: Attempting path: /usr/local/share/obs/libobs/solid.effect

info: Attempting path: share/obs/libobs/format_conversion.effect

info: Attempting path: /usr/local/share/obs/libobs/format_conversion.effect

info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: video settings reset:
    base resolution:   1440x900
    output resolution: 960x600
    fps:               60/1
[New Thread 0x7fffdf13d700 (LWP 6962)]
[New Thread 0x7fffddaf2700 (LWP 6963)]
info: audio settings reset:
    samples per sec: 44100
    speakers:        2
    buffering (ms):  1000

[New Thread 0x7fffdd2f1700 (LWP 6964)]
info: Attempting path: ../../obs-plugins/64bit/libimage-source.so

info: Attempting path: /usr/local/lib/obs-plugins/libimage-source.so

info: Attempting path: share/obs/obs-plugins/image-source/locale/en-US.ini

info: Attempting path: /usr/local/share/obs/obs-plugins/image-source/locale/en-US.ini

info: Attempting path: ../../obs-plugins/64bit/libobs-ffmpeg.so

info: Attempting path: /usr/local/lib/obs-plugins/libobs-ffmpeg.so

info: Attempting path: share/obs/obs-plugins/obs-ffmpeg/locale/en-US.ini

info: Attempting path: /usr/local/share/obs/obs-plugins/obs-ffmpeg/locale/en-US.ini

info: Attempting path: ../../obs-plugins/64bit/libobs-libfdk.so

info: Attempting path: /usr/local/lib/obs-plugins/libobs-libfdk.so

info: Attempting path: share/obs/obs-plugins/obs-libfdk/locale/en-US.ini

info: Attempting path: /usr/local/share/obs/obs-plugins/obs-libfdk/locale/en-US.ini

info: Attempting path: ../../obs-plugins/64bit/libobs-x264.so

info: Attempting path: /usr/local/lib/obs-plugins/libobs-x264.so

info: Attempting path: share/obs/obs-plugins/obs-x264/locale/en-US.ini

info: Attempting path: /usr/local/share/obs/obs-plugins/obs-x264/locale/en-US.ini

info: Attempting path: ../../obs-plugins/64bit/libobs-outputs.so

info: Attempting path: /usr/local/lib/obs-plugins/libobs-outputs.so

info: Attempting path: share/obs/obs-plugins/obs-outputs/locale/en-US.ini

info: Attempting path: /usr/local/share/obs/obs-plugins/obs-outputs/locale/en-US.ini

info: Attempting path: ../../obs-plugins/64bit/librtmp-services.so

info: Attempting path: /usr/local/lib/obs-plugins/librtmp-services.so

info: Attempting path: share/obs/obs-plugins/rtmp-services/locale/en-US.ini

info: Attempting path: /usr/local/share/obs/obs-plugins/rtmp-services/locale/en-US.ini

info: Attempting path: ../../obs-plugins/64bit/liblinux-xshm.so

info: Attempting path: /usr/local/lib/obs-plugins/liblinux-xshm.so

info: Attempting path: share/obs/obs-plugins/linux-xshm/locale/en-US.ini

info: Attempting path: /usr/local/share/obs/obs-plugins/linux-xshm/locale/en-US.ini

info: Attempting path: ../../obs-plugins/64bit/liblinux-xcomposite.so

info: Attempting path: /usr/local/lib/obs-plugins/liblinux-xcomposite.so

info: Xcomposite capture plugin loaded
info: Attempting path: share/obs/obs-plugins/linux-xcomposite/locale/en-US.ini

info: Attempting path: /usr/local/share/obs/obs-plugins/linux-xcomposite/locale/en-US.ini

info: Attempting path: ../../obs-plugins/64bit/liblinux-pulseaudio.so

info: Attempting path: /usr/local/lib/obs-plugins/liblinux-pulseaudio.so

info: Attempting path: share/obs/obs-plugins/linux-pulseaudio/locale/en-US.ini

info: Attempting path: /usr/local/share/obs/obs-plugins/linux-pulseaudio/locale/en-US.ini

info: Attempting path: ../../obs-plugins/64bit/liblinux-v4l2.so

info: Attempting path: /usr/local/lib/obs-plugins/liblinux-v4l2.so

info: Attempting path: share/obs/obs-plugins/linux-v4l2/locale/en-US.ini

info: Attempting path: /usr/local/share/obs/obs-plugins/linux-v4l2/locale/en-US.ini

info: output 'default_file_output' (flv_output) created
info: output 'default_stream' (rtmp_output) created
info: encoder 'default_h264' (obs_x264) created
info: encoder 'default_aac' (libfdk_aac) created
info: service 'default_service' (rtmp_custom) created
[New Thread 0x7fffd1a88700 (LWP 6965)]
[Thread 0x7fffd1a88700 (LWP 6965) exited]
[New Thread 0x7fffd1a88700 (LWP 6966)]
info: pulse-input: Server name: 'pulseaudio 4.0'
info: pulse-input: Audio format: s16le, 44100 Hz, 2 channels
info: pulse-input: Started recording from 'alsa_output.pci-0000_00_1b.0.analog-stereo.monitor'
info: source 'Desktop Audio' (pulse_output_capture) created
info: source 'Scene 1' (scene) created
error: Source 'random' not found
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: pulse-input: Failed to get timing info !
error: xcompcap: XCompositeRedirectWindow failed: BadWindow (invalid Window parameter)
info: source 'Xcomposite capture' (xcomposite_input) created
warning: [scene_load_item] Source 20x20 Random Pixel Texture Source (Test) not found!
[New Thread 0x7fffd0c4f700 (LWP 6967)]
[New Thread 0x7fffc3ffe700 (LWP 6968)]
info: Update check: latest version is: 0.4.0
info: source 'Xcomposite capture' destroyed
[New Thread 0x7fffc3752700 (LWP 6969)]
info: source 'Video Capture Device (V4L2)' (v4l2_input) created

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffc3752700 (LWP 6969)]
0x00007ffff5087e3e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt full
#0  0x00007ffff5087e3e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
#1  0x00007ffff7bb0e86 in memcpy (__len=<optimized out>, __src=<optimized out>, __dest=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/string3.h:51
No locals.
#2  copy_frame_data_line (y=396, plane=0, src=0x7fffc3751d20, dst=0x7fffb80008e0) at /media/rsnvoice/obs-studio/libobs/obs-source.c:1259
        pos_src = <optimized out>
        pos_dst = <optimized out>
        bytes = <optimized out>
#3  copy_frame_data_plane (lines=<optimized out>, plane=<optimized out>, src=<optimized out>, dst=<optimized out>) at /media/rsnvoice/obs-studio/libobs/obs-source.c:1267
        y = 396
#4  copy_frame_data (src=0x7fffc3751d20, dst=0x7fffb80008e0) at /media/rsnvoice/obs-studio/libobs/obs-source.c:1305
No locals.
#5  cache_video (frame=0x7fffc3751d20) at /media/rsnvoice/obs-studio/libobs/obs-source.c:1315
No locals.
#6  obs_source_output_video (source=0xc6e620, frame=0x7fffc3751d20) at /media/rsnvoice/obs-studio/libobs/obs-source.c:1333
        output = <optimized out>
#7  0x00007fffd1e8b41b in v4l2_thread (vptr=0xc6d6e0) at /media/rsnvoice/obs-studio/plugins/linux-v4l2/v4l2-input.c:254
        fds = {__fds_bits = {536870912, 0 <repeats 15 times>}}
        tv = {tv_sec = 0, tv_usec = 846099}
        buf = {index = 0, type = 1, bytesused = 8009, flags = 1, field = 1, timestamp = {tv_sec = 12355, tv_usec = 166061}, timecode = {type = 0, flags = 0, frames = 0 '\000', 
            seconds = 0 '\000', minutes = 0 '\000', hours = 0 '\000', userbits = "\000\000\000"}, sequence = 0, memory = 1, m = {offset = 0, userptr = 0, planes = 0x0, fd = 0}, 
          length = 233472, reserved2 = 0, reserved = 0}
        r = <optimized out>
        out = {data = {0x7fffd000d000 <error: Cannot access memory at address 0x7fffd000d000>, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, linesize = {640, 0, 0, 0, 0, 0, 0, 0}, 
          width = 640, height = 480, timestamp = 12355166061000, format = VIDEO_FORMAT_YUY2, color_matrix = {1.16438401, 0, 1.79274094, -0.972944975, 1.16438401, -0.213248998, 
            -0.532908976, 0.301483005, 1.16438401, 2.11240196, 0, -1.13340199, 0, 0, 0, 1}, full_range = false, color_range_min = {0.0627451017, 0.0627451017, 0.0627451017}, 
          color_range_max = {0.921568632, 0.941176474, 0.941176474}, flip = false}
        data = 0xc6d6e0
#8  0x00007ffff30db182 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
No symbol table info available.
#9  0x00007ffff50ea30d in clone () from /lib/x86_64-linux-gnu/libc.so.6
No symbol table info available.
@fryshorts
Copy link
Contributor

Does your camera work with other programs ? It would be nice if you could check with the qv4l2 test utility if it is able to access the camera via the "Memory mapped I/O" capture method, or whether it uses a different option.

@voice06
Copy link
Author

voice06 commented Jul 16, 2014

I'm able to access the camera in qv4l2 via Memory mapped I/O and read(), VLC is also able to access the camera.

@bazukas
Copy link
Contributor

bazukas commented Jul 16, 2014

Hello, could you pastebin output of this command:
v4l2-ctl -d /dev/video0 --list-formats-ext

Replace "/dev/video0" with your device.

@voice06
Copy link
Author

voice06 commented Jul 16, 2014

lsusb output, camera:
Bus 005 Device 002: ID 06f8:3008 Guillemot Corp. 

sudo v4l2-ctl -d /dev/bus/usb/005/002 --list-formats-ext
VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device
ioctl: VIDIOC_ENUM_FMT

v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
    Index       : 0
    Type        : Video Capture
    Pixel Format: 'JPEG' (compressed)
    Name        : JPEG
        Size: Discrete 160x120
        Size: Discrete 320x240
        Size: Discrete 640x480

@bazukas
Copy link
Contributor

bazukas commented Jul 16, 2014

Sorry, that pixel format is not supported yet. Still need to fix the crash though.

@voice06
Copy link
Author

voice06 commented Jul 30, 2014

Just tested 0.4.2-90-g254b50f-modified with v4l2. It did not crash when I selected the camera so it appears that for now that issue is resolved. Only remaining item would be the lack of JPEG Pixel Format support but I would say thats not as pressing, probably wouldn't hurt to get a new webcam anyways. Closing out the bug report.

@voice06 voice06 closed this as completed Jul 30, 2014
@fryshorts
Copy link
Contributor

Thats good to hear, although the patches merged were supposed to fix the missing JPEG support by providing on the fly transcoding via libv4l2.
If you could post a current log that would be much appreciated.

@voice06
Copy link
Author

voice06 commented Jul 31, 2014

Starting program: /usr/local/bin/obs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe6e9e700 (LWP 4743)]
Attempted path: share/obs/obs-studio/locale/en-US.ini
Attempted path: /usr/local/share/obs/obs-studio/locale/en-US.ini
Attempted path: share/obs/obs-studio/locale.ini
Attempted path: /usr/local/share/obs/obs-studio/locale.ini
Attempted path: share/obs/obs-studio/license/gplv2.txt
Attempted path: /usr/local/share/obs/obs-studio/license/gplv2.txt
[New Thread 0x7fffe6082700 (LWP 4744)]
QObject::connect: invalid null parameter
info: OBS 0.4.2-90-g254b50f-modified (linux)
info: Processor: 8 logical cores
info: Processor: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
info: Physical Memory: 15993MB Total
info: Kernel Version: Linux 3.11.0-12-generic
info: Distribution: "Ubuntu" "14.04"
info: audio settings reset:
samples per sec: 44100
speakers: 2
buffering (ms): 1000

[New Thread 0x7fffdffff700 (LWP 4745)]
info: X and Y: 909 480
Backbuffers: 2
Color Format: 3
ZStencil Format: 0
Adapter: 0

info: OpenGL version: 3.2.0 NVIDIA 331.89

info: Created new platform data
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: convert_sampler_info: 1 <= max_anisotropy <= 16 violated, selected: 0, set: 1
info: video settings reset:
base resolution: 1440x900
output resolution: 960x600
fps: 60/1
[New Thread 0x7fffdf1fe700 (LWP 4746)]
[New Thread 0x7fffddbb3700 (LWP 4747)]
error: Required module function 'obs_module_set_pointer' in module '/usr/local/lib/obs-plugins/libimage-source.so' not found, loading of module failed
error: Required module function 'obs_module_set_pointer' in module '/usr/local/lib/obs-plugins/liblinux-pulseaudio.so' not found, loading of module failed
error: Required module function 'obs_module_set_pointer' in module '/usr/local/lib/obs-plugins/liblinux-v4l2.so' not found, loading of module failed
error: Required module function 'obs_module_set_pointer' in module '/usr/local/lib/obs-plugins/liblinux-xcomposite.so' not found, loading of module failed
error: Required module function 'obs_module_set_pointer' in module '/usr/local/lib/obs-plugins/liblinux-xshm.so' not found, loading of module failed
error: Required module function 'obs_module_set_pointer' in module '/usr/local/lib/obs-plugins/libobs-ffmpeg.so' not found, loading of module failed
error: Required module function 'obs_module_set_pointer' in module '/usr/local/lib/obs-plugins/libobs-libfdk.so' not found, loading of module failed
error: Required module function 'obs_module_set_pointer' in module '/usr/local/lib/obs-plugins/libobs-outputs.so' not found, loading of module failed
error: Required module function 'obs_module_set_pointer' in module '/usr/local/lib/obs-plugins/libobs-x264.so' not found, loading of module failed
error: Required module function 'obs_module_set_pointer' in module '/usr/local/lib/obs-plugins/librtmp-services.so' not found, loading of module failed
error: Required module function 'obs_module_set_pointer' in module '/usr/local/lib/obs-plugins/libtest-input.so' not found, loading of module failed
info: Xcomposite capture plugin loaded
info: output 'default_file_output' (flv_output) created
info: output 'default_stream' (rtmp_output) created
info: encoder 'default_h264' (obs_x264) created
info: encoder 'default_aac' (libfdk_aac) created
info: service 'default_service' (rtmp_custom) created
[New Thread 0x7fffcbfff700 (LWP 4748)]
[Thread 0x7fffcbfff700 (LWP 4748) exited]
[New Thread 0x7fffcbfff700 (LWP 4749)]
info: pulse-input: Server name: 'pulseaudio 4.0'
info: pulse-input: Audio format: s16le, 44100 Hz, 2 channels
info: pulse-input: Started recording from 'alsa_output.pci-0000_00_1b.0.analog-stereo.monitor'
info: source 'Desktop Audio' (pulse_output_capture) created
info: source 'Scene 1' (scene) created
info: v4l2-input: Start capture from /dev/video0
info: v4l2-input: Resolution: 640x480
info: v4l2-input: Linesize: 640 Bytes
info: v4l2-input: Framerate: 30.00 fps
[New Thread 0x7fffcb7fe700 (LWP 4750)]
info: source 'Video Capture Device (V4L2)' (v4l2_input) created
[New Thread 0x7fffca60b700 (LWP 4752)]
[New Thread 0x7fffc9e0a700 (LWP 4753)]
info: Update check: latest version is: 0.4.0
info: v4l2-input: Found device 'USB camera' at /dev/video0
info: v4l2-input: Pixelformat: JPEG (unavailable)
info: v4l2-input: Pixelformat: RGB3 (Emulated) (unavailable)
info: v4l2-input: Pixelformat: BGR3 (Emulated) (unavailable)
info: v4l2-input: Pixelformat: YU12 (Emulated) (available)
info: v4l2-input: Pixelformat: YV12 (Emulated) (available)
info: v4l2-input: Stepwise and Continuous framerates are currently hardcoded
info: v4l2-input: Stepwise and Continuous framerates are currently hardcoded
info: v4l2-input: Stepwise and Continuous framerates are currently hardcoded

NOTE: There was a recent motherboard/cpu change as well, that could have resolved the segault issue.

@voice06
Copy link
Author

voice06 commented Jul 31, 2014

....and now its working. I swear I come across some of the weirdest issues.

Gol-D-Ace pushed a commit to Gol-D-Ace/obs-studio that referenced this issue Feb 20, 2021
Fix a data race when user manually stopped stream during connecting to a RTMP server.

This is caused by a data race in `obs_output_destroy` method, which call `rtmp_stream_destroy` method before output became active. In such case, the `rtmp_stream_destroy` method will detach `end_data_capture` thread, thus it will result in a potential crash. In order to avoid this, the thread which destroys output should wait till `end_data_capture` will be finished.
palana pushed a commit to amazon-contributing/upstreaming-to-obs-studio that referenced this issue Mar 15, 2024
…tions_fixes

libobs: Support for multitrack, av1, and hevc captions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants