LibVLCSharp issueshttps://code.videolan.org/videolan/LibVLCSharp/-/issues2023-06-26T07:19:26Zhttps://code.videolan.org/videolan/LibVLCSharp/-/issues/616Log callback interop for Android simulator2023-06-26T07:19:26ZwinkmichaelLog callback interop for Android simulator### Summary
Xamarin Forms app, running _libVLC.Log += LibVLC_Log; overload which contains nothing will crash. private void LibVLC_Log(object sender, LogEventArgs e) {} The overload contains no code.
### Minimal project and steps to re...### Summary
Xamarin Forms app, running _libVLC.Log += LibVLC_Log; overload which contains nothing will crash. private void LibVLC_Log(object sender, LogEventArgs e) {} The overload contains no code.
### Minimal project and steps to reproduce
https://github.com/winkmichael/LogTestlibVLC
Immediately crashes once initialized, no errors.
Remove _libVLC.Log += LibVLC_Log; and there is no crash.
Same issue occurs with; private void OnLogReceived(object sender, LogEventArgs e)
### What is the current *bug* behavior?
Crashes the Android App.
### What is the expected *correct* behavior?
Log overload should allow log handling by application.
### Does it work on other plaforms? Does it work with the official VLC apps?
[libc] Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x30 in tid 23185 (e.logtestlibvlc), pid 23185 (e.logtestlibvlc)
That is the only log.
### Relevant LibVLC logs and/or screenshots
N/A
### Environment
Android Pixel 5 - API 30 Emulator
LibVLCSharp.Forms 3.7.0
VideoLAN.LibVLC.Android 3.5.3
### Possible fixes
No ideahttps://code.videolan.org/videolan/LibVLCSharp/-/issues/558Does setvideoformatcallbacks in vlcsharp support i420 decoding2022-05-30T09:32:37Z王熙Does setvideoformatcallbacks in vlcsharp support i420 decodingThe pitches and lines in libvlcvideoformatcb in setvideoformatcallbacks need to set YUV three plane parameters, but does the official uint type support this operation?
![image](/uploads/78f13783d5e6ba8ce8330ca39972dc2c/image.png)
If you ...The pitches and lines in libvlcvideoformatcb in setvideoformatcallbacks need to set YUV three plane parameters, but does the official uint type support this operation?
![image](/uploads/78f13783d5e6ba8ce8330ca39972dc2c/image.png)
If you can, can you give me an example?https://code.videolan.org/videolan/LibVLCSharp/-/issues/543LibVLC ExitCallback not firing on master2022-03-15T08:31:01ZMartin FinkelLibVLC ExitCallback not firing on master### Summary
The libvlc exit callback allows to run some arbitrary code on libvlc exit. This is not currently working on LVS master (dunno for 3.x).
### Minimal project and steps to reproduce
Run `SetExitHandler` unit test on master.
...### Summary
The libvlc exit callback allows to run some arbitrary code on libvlc exit. This is not currently working on LVS master (dunno for 3.x).
### Minimal project and steps to reproduce
Run `SetExitHandler` unit test on master.
### What is the current *bug* behavior?
Test pass.
### What is the expected *correct* behavior?
The ExitCallback is never called.
### Possible fixes
```diff
protected override void Dispose(bool disposing)
{
if (disposing)
{
UnsetDialogHandlers();
Native.LibVLCLogUnset(NativeReference);
+ //_gcHandle.Free();
+ //_exitCallback = null;
_log = null;
}
base.Dispose(disposing);
}
```https://code.videolan.org/videolan/LibVLCSharp/-/issues/406Using SetDialogHandlers later results in a segmentation fault on Android x86/...2021-12-22T15:01:28ZRobert GouletUsing SetDialogHandlers later results in a segmentation fault on Android x86/x64 only### Summary
Using SetDialogHandlers to override "Question" for the case of overriding the dialog for insecure HTTPS connections results in a segmentation fault.
### Minimal project and steps to reproduce
1. Open "LibVLCSharp.Android.S...### Summary
Using SetDialogHandlers to override "Question" for the case of overriding the dialog for insecure HTTPS connections results in a segmentation fault.
### Minimal project and steps to reproduce
1. Open "LibVLCSharp.Android.Sample" in the Samples directory.
2. Add the call to SetDialogHandlers in the code. The example below should be good enough to repro the problem.
````
....
_libVLC = new LibVLC(enableDebugLogs: true);
_libVLC.SetDialogHandlers((title, text) => Task.CompletedTask,
(dialog, title, text, username, store, token) => Task.CompletedTask,
(dialog, title, text, type, canceltext, firstactiontext, secondactiontext, token) => Task.CompletedTask,
(dialog, title, text, indeterminate, position, canceltext, token) => Task.CompletedTask,
(dialog, position, text) => Task.CompletedTask);
_mediaPlayer = new MediaPlayer(_libVLC)
{
EnableHardwareDecoding = true
};
....
````
3. Change the URL to point to a "https" site that has a certificate that is not signed by a trusted CA. You don't have to have it actually serve up any media file because it never gets that far. This example should work without having to stand up a web server:
````
using var media = new Media(_libVLC, new Uri("https://self-signed.badssl.com/"));
````
### What is the current *bug* behavior?
Segmentation fault occurs
### What is the expected *correct* behavior?
No crash. If I put a breakpoint on the lambda I'd expect to hit that. I can't override the function to accept the dialog because it crashes.
### Does it work on other plaforms? Does it work with the official VLC apps?
I have only tested on Android. This is likely only applicable to libvlcsharp. The official VLC app works fine.
### Relevant logs and/or screenshots
````
11-15 06:33:02.629 D/VLC (19867): [d39e3030/4d9b] libvlc input: Creating an input for '(null)'
11-15 06:33:02.632 D/VLC (19867): [d39e3030/4db1] libvlc input: using timeshift granularity of 50 MiB
11-15 06:33:02.632 D/VLC (19867): [d39e3030/4db1] libvlc input: using default timeshift path
11-15 06:33:02.632 D/VLC (19867): [d39e3030/4db1] libvlc input: `https://self-signed.badssl.com/' gives access `https' demux `any' path `self-signed.badssl.com/'
11-15 06:33:02.632 D/VLC (19867): [e80e2830/4db1] libvlc input source: creating demux: access='https' demux='any' location='self-signed.badssl.com/' file='(null)'
11-15 06:33:02.632 D/VLC (19867): [e80e28d0/4db1] libvlc demux: looking for access_demux module matching "https": 6 candidates
11-15 06:33:02.633 D/VLC (19867): [e80e28d0/4db1] libvlc demux: no access_demux modules matched
11-15 06:33:02.633 D/VLC (19867): [e80e2970/4db1] libvlc stream: creating access: https://self-signed.badssl.com/
11-15 06:33:02.634 D/VLC (19867): [e80e2970/4db1] libvlc stream: looking for access module matching "https": 24 candidates
11-15 06:33:02.634 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: looking for tls client module matching "any": 1 candidates
11-15 06:33:02.634 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: using GnuTLS version 3.5.19
11-15 06:33:02.638 D/Mono (19867): DllImport searching in: 'libvlc' ('libvlc.so').
11-15 06:33:02.638 D/Mono (19867): Searching for 'libvlc_media_release'.
11-15 06:33:02.638 D/Mono (19867): Probing 'libvlc_media_release'.
11-15 06:33:02.639 D/Mono (19867): Found as 'libvlc_media_release'.
11-15 06:33:02.666 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: loaded 137 trusted CAs from system
11-15 06:33:02.666 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: using tls client module "gnutls"
11-15 06:33:02.667 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: resolving self-signed.badssl.com ...
11-15 06:33:02.738 D/HostConnection(19867): HostConnection::get() New Host Connection established 0xe9aa1370, tid 19890
11-15 06:33:02.745 D/HostConnection(19867): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2
11-15 06:33:02.755 I/ConfigStore(19867): android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
11-15 06:33:02.756 I/ConfigStore(19867): android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
11-15 06:33:02.757 I/OpenGLRenderer(19867): Initialized EGL, version 1.4
11-15 06:33:02.757 D/OpenGLRenderer(19867): Swap behavior 1
11-15 06:33:02.765 D/eglCodecCommon(19867): setVertexArrayObject: set vao to 0 (0) 0 0
11-15 06:33:02.765 D/EGL_emulation(19867): eglCreateContext: 0xe9a854e0: maj 2 min 0 rcv 2
11-15 06:33:02.767 D/EGL_emulation(19867): eglMakeCurrent: 0xe9a854e0: ver 2 0 (tinfo 0xe9a83c30)
11-15 06:33:02.803 D/HostConnection(19867): createUnique: call
11-15 06:33:02.804 D/HostConnection(19867): HostConnection::get() New Host Connection established 0xe9aa15f0, tid 19890
11-15 06:33:02.808 D/HostConnection(19867): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2
11-15 06:33:02.808 E/eglCodecCommon(19867): GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1
11-15 06:33:02.816 D/EGL_emulation(19867): eglMakeCurrent: 0xe9a854e0: ver 2 0 (tinfo 0xe9a83c30)
11-15 06:33:02.828 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: TLS handshake: Resource temporarily unavailable, try again.
11-15 06:33:02.878 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: TLS handshake: Success.
=================================================================
Native Crash Reporting
=================================================================
Got a SEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
No native Android stacktrace (see debuggerd output).
=================================================================
Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0xf0e4833c):
11-15 06:33:02.878 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: - safe renegotiation (RFC5746) enabled
11-15 06:33:02.878 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: - false start (RFC7918) enabled
0xf0e4832c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0xf0e4833c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0xf0e4834c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0xf0e4835c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................11-15 06:33:02.878 E/VLC (19867): [d3890eb0/4db1] libvlc tls client: Certificate verification failure: The certificate is NOT trusted. The certificate issuer is unknown.
11-15 06:33:02.879 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: 1 certificate(s) in the list
11-15 06:33:02.879 D/VLC (19867): [d3890eb0/4db1] libvlc tls client: no known certificates for self-signed.badssl.com
11-15 06:33:02.886 F/libc (19867): Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xf0e4833c in tid 19889 (config_GetGener), pid 19867 (ompanyname.app2)
````
### Environment
- OS: Android
- Version Pie 9.0
- Device: Android TV (Emulator in Visual Studio)
- LibVLC version and architecture LibVLC.Android 3.2.0
- LibVLCSharp version 3.4.9
### Possible fixes
Unknownhttps://code.videolan.org/videolan/LibVLCSharp/-/issues/365LibVLC loading refactoring for macOS2020-09-08T15:40:42ZMartin FinkelLibVLC loading refactoring for macOS### Problem to solve
To be able to use libvlc builds from official releases, we need to be able to load and P/Invoke dynamic libvlc macOS builds.
Currently, it's all statically linked together in a `libvlc.dylib` binary. The libvlc bui...### Problem to solve
To be able to use libvlc builds from official releases, we need to be able to load and P/Invoke dynamic libvlc macOS builds.
Currently, it's all statically linked together in a `libvlc.dylib` binary. The libvlc builds from vlc.dmg are organized similarly to the libvlc windows ones (plugins folder, lib folder, share folder).
### Intended users
macOS users.
### Proposal
There are a few challenges...
- We need to perform this refactoring while not breaking existing platforms (netcore and mono).
- We need to perform this refactoring while keeping the current platform versions number supported (i.e. any netcore version).
mono/cocoa support is fine, issue is with netcore.
Problems are two fold:
- To be able to re-use the current P/Invoke code, we need to keep the dllimport statements as they are currently. In theory, one could load manually the dylib, and all further dllimport calls would look at the currently loaded dynamic librairies before trying a new dlopen to perform the dlsym. That's the theory anyway https://github.com/libgit2/libgit2sharp/blob/7fc4be5193dbdd08538b4b150332b5a73770e0f6/LibGit2Sharp/Core/NativeMethods.cs#L40
However, that's not what I observe. And for the netstandard/netcore build, that means the dlopen call argument is different on mac and windows (`@rpath/libvlc`/`libvlc`) and it should not.
- Even when using the non standard `@rpath/libvlc` dlopen argument and setting the correct `VLC_PLUGIN_PATH`, `libvlc_new` returns null.
https://github.com/mfkl/libvlcsharp/commits/mac-libvlc-loading
https://github.com/mfkl/libvlc-nuget/blob/mac-loading-rework/build/VideoLAN.LibVLC.Mac.targets
### Documentation
Just the cherrypicking enabling whenever this works.https://code.videolan.org/videolan/LibVLCSharp/-/issues/360VLC plugin framework for dotnet2020-12-24T06:30:37ZMartin FinkelVLC plugin framework for dotnet### Problem to solve
Some dotnet users would like lower access to the VLC core.
### Intended users
dotnet libvlcsharp users who want advanced customization.
### Proposal
With dotnet 5's official support for [native exports](https://...### Problem to solve
Some dotnet users would like lower access to the VLC core.
### Intended users
dotnet libvlcsharp users who want advanced customization.
### Proposal
With dotnet 5's official support for [native exports](https://github.com/AaronRobinsonMSFT/DNNE), it would be possible in theory to build a VLC plugin in dotnet, that can be loaded and called from the VLC Core. Once that's done, we could provide a framework/bootstrapper nuget that'd allow users to write their own VLC plugin _easily_.
- https://wiki.videolan.org/Hacker_Guide/How_To_Write_a_Module/
- https://wiki.videolan.org/OutOfTreeCompile/
### Documentation
Lots I guess.https://code.videolan.org/videolan/LibVLCSharp/-/issues/359Start using PtrToStringUTF8 wherever possible2020-06-30T09:35:47ZMartin FinkelStart using PtrToStringUTF8 wherever possible### Problem to solve
Refactor existing code to use https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.ptrtostringutf8 whenever targets permit
### Intended users
libvlcsharp devs.### Problem to solve
Refactor existing code to use https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.ptrtostringutf8 whenever targets permit
### Intended users
libvlcsharp devs.https://code.videolan.org/videolan/LibVLCSharp/-/issues/345Consider using unsafe C# for perf sensitive APIs2022-02-25T06:29:14ZMartin FinkelConsider using unsafe C# for perf sensitive APIs### Problem to solve
Performance could likely be improved for LibVLC APIs that have callbacks interop.
To make sure of this, we first need to setup benchmarkdotnet and write some tests to have numbers. https://code.videolan.org/videola...### Problem to solve
Performance could likely be improved for LibVLC APIs that have callbacks interop.
To make sure of this, we first need to setup benchmarkdotnet and write some tests to have numbers. https://code.videolan.org/videolan/LibVLCSharp/-/issues/8
Only then could we be assured that it'd provide an improvement, by comparing numbers from both implementations (and by how much).
Some perf sensitive APIs I can think of:
```
libvlc_audio_set_callbacks
libvlc_media_new_callbacks
libvlc_video_set_callbacks
libvlc_video_set_format_callbacks
libvlc_video_set_output_callbacks <- especially this one
StreamMediaInput <- especially this one
```
### Intended users
All
### Proposal
Have a look on how to integrate the latest improvements from C# 9 and BCL. Would likely be a net5.0 target.
### Documentation
Samples would be a good start.https://code.videolan.org/videolan/LibVLCSharp/-/issues/288LibVLCSharp 42023-03-01T07:10:45ZMartin FinkelLibVLCSharp 4### Problem to solve
Add libvlcsharp support.
### Intended users
All.
### Proposal
List all API changes to be implemented here, and implement them.
Need to push LibVLC 4 builds for all platforms.
These will be pre-release packages...### Problem to solve
Add libvlcsharp support.
### Intended users
All.
### Proposal
List all API changes to be implemented here, and implement them.
Need to push LibVLC 4 builds for all platforms.
These will be pre-release packages for now.
### Documentation
Should not change much.LibVLCSharp 4Martin FinkelMartin Finkelhttps://code.videolan.org/videolan/LibVLCSharp/-/issues/256Use stackalloc for log callback alloc when possible2020-06-02T13:25:20ZMartin FinkelUse stackalloc for log callback alloc when possible### Problem to solve
Improve memory/perf for log callback
### Intended users
Anyone that listens to log events
### Proposal
Replace heap alloc calls by stack alloc calls when possible. Depending on process size and needed buffer siz...### Problem to solve
Improve memory/perf for log callback
### Intended users
Anyone that listens to log events
### Proposal
Replace heap alloc calls by stack alloc calls when possible. Depending on process size and needed buffer size to allocate, notably.
https://code.videolan.org/videolan/LibVLCSharp/blob/3.x/LibVLCSharp/Shared/Helpers/MarshalUtils.cs#L84
https://code.videolan.org/videolan/LibVLCSharp/blob/3.x/LibVLCSharp/Shared/Helpers/MarshalUtils.cs#L107
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/stackalloc
Would be curious to see the result of both versions with benchmarkdotnet.
### Documentation
Nonehttps://code.videolan.org/videolan/LibVLCSharp/-/issues/123Fatal error when I subscribe to the MediaPlayer.Vout event2020-02-10T02:45:58ZStéphane MitermiteFatal error when I subscribe to the MediaPlayer.Vout eventHello,
If I subscribe to the MediaPlayer.Vout event, when the end of the video is reached (or if I call the MediaPlayer.Stop() method), I get a fatal error that kills my app.
You can test with [this project](https://github.com/kakone/L...Hello,
If I subscribe to the MediaPlayer.Vout event, when the end of the video is reached (or if I call the MediaPlayer.Stop() method), I get a fatal error that kills my app.
You can test with [this project](https://github.com/kakone/LibVLCSharp.Forms.MediaPlayerElement). When the end is reached, the app explode :)
Cordially,
Stephane.https://code.videolan.org/videolan/LibVLCSharp/-/issues/122Raise event user callbacks from different thread2022-03-01T02:41:52ZMartin FinkelRaise event user callbacks from different threadhttps://forum.videolan.org/viewtopic.php?t=106174https://forum.videolan.org/viewtopic.php?t=106174LibVLCSharp 4Martin FinkelMartin Finkel