ffmpeginteropx / FFmpegInteropX

FFmpeg decoding library for Windows 10 UWP and WinUI 3 Apps
Apache License 2.0
212 stars 53 forks source link

Crash in branch `winui-build` #370

Closed softworkz closed 1 year ago

softworkz commented 1 year ago

image

I wasn't able to figure out quickly why it happens. avFormatCtx->metadata is not NULL, but it also doesn't seem to point to a valid dictionary.

When I comment out the title-getting and just set titleStr to an empty string, playback is working..

brabebhin commented 1 year ago

If you run without debugger, does the application actually crash? Or if you untick the break on exception? Sometimes the native debugger gets hanged over some exception that is thrown and handled gracefully.

If it does crash you can share the file so I can take a look.

softworkz commented 1 year ago

If you run without debugger, does the application actually crash?

Yes, even when I debug with managed code only it dies.

If it does crash you can share the file so I can take a look.

It's a locally served m3u for hls streaming, but I have a few public test streams. Let me check first whether it reproduces with them.

Thanks

softworkz commented 1 year ago

This is the situation inside the ffmpeg code where it actually throws:

image

softworkz commented 1 year ago

It reproduces with the HLS stream below. Setup goes roughly like this:

this.FfmpegMss = await FFmpegMediaSource.CreateFromUriAsync("https://softworkz.github.io/hlstestfiles/fetch_glitches/media.m3u8");
this.PlaybackItem = this.FfmpegMss.CreateMediaPlaybackItem();
player.AutoPlay = true;
player.Source = this.PlaybackItem;
player.Play();
brabebhin commented 1 year ago

Nice beer advert. I tried that using the samples and it works fine.

lukasf commented 1 year ago

I already assumed that this has to do with your ffmpeg build. You said somewhere that you use a heavily customized ffmpeg build. Do you base your modified build on official releases, or do you base it on master branch? I always recommend to stick exclusively with official ffmpeg builds. Using ffmpeg master branch has a high risk of running into random bugs. I saw that myself already, and we also got some error reports here, which turned out to come from devs using custom ffmpeg master branch builds.

So if you currently use ffmpeg master branch plus your changes applied, I'd recommend you consider using an official release instead (n6.0 is latest right now) and apply your patches on that instead of master.

softworkz commented 1 year ago

You said somewhere that you use a heavily customized ffmpeg build.

Yes, but customizations are rather in avfilter, avcoded and avformat than in avutil.

Do you base your modified build on official releases, or do you base it on master branch

It's based on 5.1 official release. And it is working fine with your main branch, the error appears in the winui-build branch only.

But I thought it would have pulled "your" ffmpeg package for the test because I had built the UWP package from the winui-build branch, but now I've seen that I had an explicit nuget reference to "our" ffmpeg package. After removing that, the error doesn't occur any longer.

Since I don't need the title and we'll be rebasing to 6.0 soon, I'll stick to my current workaround.

Thank you!