ffmpeginteropx / FFmpegInteropX

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

FFmpegMediaSource.CreateFromStreamAsync throw winrt::hresult_error 0x80070490 #366

Closed HHaoWang closed 1 year ago

HHaoWang commented 1 year ago

I'm using winui3 and Windows.Storage.StorageFile to open a local media file and then put it into mediaPlayerBackItem by using FFmpegMediaSource.CreateMediaPlaybackItem. Everything is OK except it will throw an exception as showing below: image And VS output this:

0x00007FFC36454FFC (KernelBase.dll)处(位于 FreeKTV.exe 中)引发的异常: 0x40080202: WinRT transform error (参数: 0x000000008000000B, 0x0000000080070490, 0x0000000000000008, 0x00000004BA77CB50)。
0x00007FFC36454FFC (KernelBase.dll)处(位于 FreeKTV.exe 中)引发的异常: WinRT originate error - 0x80070490 : 'Windows.Graphics.Display: GetForCurrentView must be called on a thread that is associated with a CoreWindow.'。
onecoreuap\windows\wgi\winrt\display\displayinformation.cpp(73)\Windows.Graphics.dll!00007FFC27B6A10A: (caller: 00007FFC27B6A240) ReturnHr(1) tid(7268) 80070490 找不到元素。
0x00007FFC36454FFC 处(位于 FreeKTV.exe 中)引发的异常: Microsoft C++ 异常: winrt::hresult_error,位于内存位置 0x00000004BA77D110 处。

After I click the continue button in VS, program will works well just like noting happens. It seems that I'm using it in ViewModel related to a page and it can not get current view. But if that why I can continue run it and it works well? Please help me, thanks!

lukasf commented 1 year ago

Don't worry, this is just a "first-chance exception". That means an exception is thrown internally, but we catch that exception, so your app runs fine. Our current lib is mainly a UWP build. It does run on WinUI as well, but it is not a true WinUI build. What you see is this: We try to get get the display's HDR capabilities using UWP APIs, but that call fails on WinUI. So we will not output HDR image when using the current lib on WinUI.

You can just use the checkboxes below the error message to ignore it. We are working on full WInUI support. This will come in the next major version 2.0, maybe by end of the year (no promises though).

HHaoWang commented 1 year ago

I got and thanks for your works😀