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

Which version of OBS #21

Closed alphamax closed 8 years ago

alphamax commented 8 years ago

Hello,

Which version of OBS are you using as dll reference ? I am lunching the app & there is "attemp to write memory" problem. My actual version is 0.15.4.

Thanks,

Regards,

image

nobme commented 8 years ago

Have the same issue. (OBS 0.15.4 and libobs-sharp from jul 8.) Have also tried OBS 0.15.0, but it did not help. There is a closed issue with the same unhandled error... Does anything need to be updated for 0.15.4??

alphamax commented 8 years ago

On the other side, we can download an older version of the binaries :) It does not seems to be obvious from me :/

GoaLitiuM commented 8 years ago

It might not work out of the box with regular binaries. The test projects uses the random source which is only present if you have built obs-studio with BUILD_TESTS flag enabled, and it's added by default when the program launches.

I changed the default source in 7b93185d4c51702a852565c03a14c9661fa50c61 to fix this issue.

alphamax commented 8 years ago

I am still not able to run it for demo purpose :/ It creates properly the source but fail on me memory access. I attach you the log if you see what is the problem it would be really helpful !

libobs version: 0.15.4 CPU Name: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz CPU Speed: 2592MHz Physical Cores: 4, Logical Cores: 8 Physical Memory: 16266MB Total, 7124MB Free Windows Version: 10.0 Build 14393 (revision: 0) Running as administrator: false

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

Initializing D3D11.. Available Video Adapters: Adapter 1: Intel(R) HD Graphics 530 Dedicated VRAM: 134217728 Shared VRAM: 4233334784 output 1: pos={0, 0}, size={1920, 1080}, attached=true output 2: pos={-1920, -448}, size={1920, 1080}, attached=true Adapter 2: AMD FirePro W5130M Dedicated VRAM: 2125115392 Shared VRAM: 4233334784 Loading up D3D11 on adapter Intel(R) HD Graphics 530 (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]: CoreAudio AAC encoder not installed on the system or couldn't be loaded

Loading module: image-source.dll

Loading module: obs-ffmpeg.dll

LoadLibrary failed for 'nvEncodeAPI64.dll', error: 126

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: vlc-video.dll

Couldn't find VLC installation, VLC video source disabled

Loading module: win-capture.dll

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 source 'Monitor Capture Source' (monitor_capture) created A first chance exception of type 'System.AccessViolationException' occurred in libobs-sharp.dll The program '[26012] test.vshost.exe: Managed (v4.0.30319)' has exited with code -1073741819 (0xc0000005) 'Access violation'.

alphamax commented 8 years ago

You can take theses lines as an atomic example :

libobs.matrix4 matrix; Vector3 scale = new Vector3(1, 1, 1); libobs.matrix4_scale(out matrix, out matrix, out scale);

The scale always fail in my configuration. If you have any idea :)

GoaLitiuM commented 8 years ago

Where is it crashing exactly? Can you post your stack trace when you trigger the exception?

I did some testing too and found out it's failing at any libobs.vec3_transform calls, but only in 32-bit builds. It looks like the new SIMD instructions in libobs matrix4_transpose fails if the pointer to the matrix memory is not aligned to 16-byte boundaries. Right now I haven't figured it out how to align the pointers manually since I don't have any control over where and how the data is marshalled between libobs-sharp and libobs (or unmanaged and managed contexts).

For now the one workaround is to disable the new SIMD intrinsics by building libobs with NO_INTRINSICS defined, or reimplement libobs.vec3_transform in libobs-sharp.

alphamax commented 8 years ago

I have tried with 32 & 64 bit version. My usecase is to hook a window & get the shared directX texture (or other resource) that allow me to display it in WPF.

image

The call stack :

  at OBS.libobs.obs_sceneitem_get_box_transform(IntPtr item, matrix4& transform)
  at OBS.ObsSceneItem.get_BoxTransform() in c:\libobs-sharp-master\libobs-sharp\src\ObsSceneItem.cs:line 179
  at test.Controls.PreviewPanel.DrawSelectedItem(ObsScene scene, ObsSceneItem item, IntPtr data) in c:\libobs-sharp-master\test\Controls\PreviewPanel.cs:line 501
  at OBS.ObsScene.<>c__DisplayClass1.<EnumItems>b__0(IntPtr s, IntPtr i, IntPtr data) in c:\libobs-sharp-master\libobs-sharp\src\ObsScene.cs:line 107
  at OBS.libobs.obs_scene_enum_items(IntPtr scene, sceneitem_enum_callback callback, IntPtr param)
  at OBS.ObsScene.EnumItems(EnumItemDelegate enumDelegate, IntPtr param) in c:\libobs-sharp-master\libobs-sharp\src\ObsScene.cs:line 109
  at test.Controls.PreviewPanel.RenderSceneEditing(IntPtr data) in c:\libobs-sharp-master\test\Controls\PreviewPanel.cs:line 473
  at test.Controls.PreviewPanel.RenderPreview(IntPtr data, UInt32 cx, UInt32 cy) in c:\libobs-sharp-master\test\Controls\PreviewPanel.cs:line 423