GoaLitiuM / libobs-sharp

[not maintained] C# wrapper for libobs 0.15.4 (part of obs-studio, multiplatform rewrite of Open Broadcaster Software)
GNU General Public License v2.0
52 stars 33 forks source link

System.AccessViolationException in libobs-sharp.dll #19

Closed luntino closed 8 years ago

luntino commented 8 years ago

I've tried to get the test application and a brand new application working with the libobs-sharp.dll but keep running into this error when attempting to create a scene.

Any ideas on what I'm doing wrong - is it an architecture issue between x32 and x64?

libobs version: 0.15.0 CPU Name: Intel(R) Core(TM) i7-4712HQ CPU @ 2.30GHz CPU Speed: 2295MHz Physical Cores: 4, Logical Cores: 8 Physical Memory: 16287MB Total, 5784MB Free Windows Version: 10.0 Build 10586 (revision: 0)

Aero is Enabled (Aero is always on for windows 8 and above)

Initializing D3D11.. Available Video Adapters: Adapter 1: Intel(R) HD Graphics 4600 Dedicated VRAM: 117964800 Shared VRAM: 4244142080 output 1: pos={0, 0}, size={1638, 922}, attached=true output 2: pos={2048, 0}, size={1440, 900}, attached=true output 3: pos={3488, 0}, size={1920, 1080}, attached=true Adapter 2: NVIDIA Quadro K1100M Dedicated VRAM: 2089680896 Shared VRAM: 4244142080 Loading up D3D11 on adapter Intel(R) HD Graphics 4600 (0)

D3D11 loaded sucessfully, feature level used: 45056

video settings reset: base resolution: 1280x720 output resolution: 1280x720 fps: 30000/1001

format: RGBA

audio settings reset: samples per sec: 44100

speakers: 2

Loading module: coreaudio-encoder.dll [CoreAudio encoder]: Failed loading library 'CoreAudioToolbox.dll'

[CoreAudio encoder]: Couldn't load CoreAudio AAC encoder

Loading module: image-source.dll

Loading module: obs-ffmpeg.dll

NVENC supported

Loading module: obs-filters.dll

Loading module: obs-outputs.dll

Loading module: obs-qsv11.dll

Loading module: obs-transitions.dll

Loading module: obs-x264.dll

Loading module: rtmp-services.dll

Loading module: text-freetype2.dll

Loading module: win-capture.dll

load_graphics_offsets: Failed to start 'get-graphics-offsets32.exe'

Loading module: win-decklink.dll No blackmagic support

Failed to start search for DeckLink devices

Loading module: win-dshow.dll

Loading module: win-mf.dll

[Media Foundation encoder]: Adding Media Foundation AAC Encoder

Loading module: win-wasapi.dll source 'test scene (1)' (scene) created Exception thrown: 'System.AccessViolationException' in libobs-sharp.dll The program '[25160] test.vshost.exe' has exited with code 0 (0x0).

GoaLitiuM commented 8 years ago

Are you running it against latest obs-studio binaries? I haven't really maintained this project for some time so some of the outgoing API changes in obs-studio might be the main cause for this.

luntino commented 8 years ago

Yes I'm running it against latest obs-studio -libobs version: 0.15.0.

The code that throws the AccessViolation is from source.cs as below

[DllImport(importLibrary, CallingConvention = importCall, CharSet = importCharSet)] public static extern obs_source_t obs_source_create(obs_source_type type, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8StringMarshaler))] string id, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8StringMarshaler))] string name, obs_data_t settings, obs_data_t hotkey_data);

I have obs-studio compiling and running fine - how would I go about debugging what changes have been made in the API from Visual Studio - would adding in HandleProcessCorruptedStateExceptions to the C# application give me more info or will I need to get into the C/C++ of obs.dll itself?

Alternatively if you can make the obs-studio source version you used to build the wrapper available I guess I could use that instead?

GoaLitiuM commented 8 years ago

I'm updating the wrapper bindings for 0.15.0 in a minute or two. The signature for obs_source_create changed few months ago so that's most likely what's throwing the exception for you.

luntino commented 8 years ago

That's great thanks - if there is anything I can do to help let me know

GoaLitiuM commented 8 years ago

:+1: