freezy / dmd-extensions

A toolbox for virtual pinball dot matrix displays.
GNU General Public License v2.0
120 stars 52 forks source link

Dmdext error when destination is network #448

Closed uronito closed 2 months ago

uronito commented 7 months ago

hi,

when i launch dmdext with destination network alwways give this error.

dmdext test -d network --url ws://127.0.0.1:80/dmd or dmdext play -f "prueba.png" -d network --url ws://127.0.0.1:80/dmd

dmdext test -d network --url ws://127.0.0.1:80/dmd
 [1] 2023/12/04 09:49:52.296  INFO | Launching console tool v2.2.1
 [1] 2023/12/04 09:49:53.475  INFO | Attempting to connect to WebSocket at ws://127.0.0.1/dmd
 [1] 2023/12/04 09:49:53.535  INFO | Connected to WebSocket at ws://127.0.0.1/dmd
 [1] 2023/12/04 09:49:53.535  INFO | Sent dimensions to socket 128x32.
 [1] 2023/12/04 09:49:53.549  INFO | Added websocket client renderer.
 [1] 2023/12/04 09:49:53.580  INFO | Sent dimensions to socket 128x32.
 [1] 2023/12/04 09:49:53.603  INFO | Setting up Render Graph for 1 destination(s) [ Network Stream ]
 [1] 2023/12/04 09:49:53.614  INFO |   -> Connecting Image Source to Network Stream (Bitmap -> Rgb24)
 [1] 2023/12/04 09:49:53.647  INFO | Press CTRL+C to close.
[13] 2023/12/04 09:49:53.658 ERROR | The calling thread cannot access this object because a different thread owns it.
[13] 2023/12/04 09:49:53.658 ERROR | System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
   at System.Windows.Threading.Dispatcher.VerifyAccess()
   at System.Windows.Media.Imaging.BitmapSource.get_PixelWidth()
   at LibDmd.Common.ImageUtil.ConvertToRgb24(BitmapSource bmp, Int32 offset, Double lum)
   at LibDmd.Frame.BmpFrame.ConvertToRgb24()
   at LibDmd.RenderGraph.<>c__DisplayClass62_0.<Connect>b__14(BmpFrame frame)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Reactive.Stubs.<.cctor>b__1(Exception ex)
   at System.Reactive.AnonymousSafeObserver`1.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
   at System.Reactive.ScheduledObserver`1.Dispatch(ICancelable cancel)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Excepción no controlada: System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
   at System.Windows.Threading.Dispatcher.VerifyAccess()
   at System.Windows.Media.Imaging.BitmapSource.get_PixelWidth()
   at LibDmd.Common.ImageUtil.ConvertToRgb24(BitmapSource bmp, Int32 offset, Double lum)
   at LibDmd.Frame.BmpFrame.ConvertToRgb24()
   at LibDmd.RenderGraph.<>c__DisplayClass62_0.<Connect>b__14(BmpFrame frame)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Reactive.Stubs.<.cctor>b__1(Exception ex)
   at System.Reactive.AnonymousSafeObserver`1.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
   at System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
   at System.Reactive.ScheduledObserver`1.Dispatch(ICancelable cancel)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at `System.Threading.ThreadHelper.ThreadStart()`
freezy commented 2 months ago

Should be fixed now. Here's a build to test.