Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MJPEG stream crash on capture while livestream #403

Open
JoachimVeulemans opened this issue Mar 14, 2023 · 1 comment
Open

MJPEG stream crash on capture while livestream #403

JoachimVeulemans opened this issue Mar 14, 2023 · 1 comment

Comments

@JoachimVeulemans
Copy link

JoachimVeulemans commented Mar 14, 2023

Hi

I am having issues with the live stream in the browser not working anymore when capturing an image.

Steps:

  1. Open CameraControl.exe
  2. Execute CameraControlRemoteCmd.exe /c do LiveViewWnd_Show
  3. Go to URL http://127.0.0.1:5514/live in the browser (working)
  4. Execute CameraControlRemoteCmd.exe /c do LiveView_Capture
  5. URL is not working anymore, not even with a refresh

Logs:

2023-03-14 22:12:28,385 [22]DEBUG DCC [(null)] - Window command received :LiveView_Capture
2023-03-14 22:12:28,387 [27]DEBUG DCC [(null)] - LiveView: Capture started
2023-03-14 22:12:28,688 [27]DEBUG DCC [(null)] - EOS capture start
2023-03-14 22:12:29,745 [27]DEBUG DCC [(null)] - EOS capture end
2023-03-14 22:12:29,745 [27]DEBUG DCC [(null)] - LiveView: Capture Initialization Done
2023-03-14 22:12:30,458 [4]DEBUG DCC [(null)] - Picture taken event received typeCanon.Eos.Framework.Eventing.EosMemoryImageEventArgs
2023-03-14 22:12:30,463 [4]DEBUG DCC [(null)] - Transferring captured image...
2023-03-14 22:12:30,465 [4]DEBUG DCC [(null)] - Pointer file transfer started
2023-03-14 22:12:30,622 [4]DEBUG DCC [(null)] - Camera.PauseLiveview();
2023-03-14 22:12:30,623 [4]DEBUG DCC [(null)] - TransportAsFileName
2023-03-14 22:12:30,708 [4]DEBUG DCC [(null)] - TransportAsFileName DONE
2023-03-14 22:12:30,709 [4]DEBUG DCC [(null)] - Camera.ResumeLiveview(); DONE
2023-03-14 22:12:30,709 [4]DEBUG DCC [(null)] - Transfer time : ,245 Speed :8,13 Mb/s
2023-03-14 22:12:30,738 [4]DEBUG DCC [(null)] - Window command received :Select_Image
2023-03-14 22:12:30,739 [4]DEBUG DCC [(null)] - Photo transfer done.
2023-03-14 22:12:30,775 [14]DEBUG DCC [(null)] - LiveView: Liveview started
2023-03-14 22:12:31,132 [14]DEBUG DCC [(null)] - LiveView: Liveview start done
2023-03-14 22:12:32,146 [1]DEBUG DCC [(null)] - Window command received :Zoom_Image_Fit
2023-03-14 22:15:16,810 [30]DEBUG DCC [(null)] - LiveView: Liveview stopping
2023-03-14 22:15:16,829 [1]DEBUG DCC [(null)] - Window command received :LiveViewWnd_Hide
2023-03-14 22:15:24,897 [33]DEBUG DCC [(null)] - LiveView: Liveview started
2023-03-14 22:15:25,190 [33]DEBUG DCC [(null)] - LiveView: Liveview start done
2023-03-14 22:15:25,213 [1]DEBUG DCC [(null)] - Window command received :LiveViewWnd_Show

I am also seeing another issue when the livestream is opened, closed an re-opened.

Steps:

  1. Open CameraControl.exe
  2. Execute CameraControlRemoteCmd.exe /c do LiveViewWnd_Show
  3. Go to URL http://127.0.0.1:5514/live in the browser (working)
  4. Execute CameraControlRemoteCmd.exe /c do LiveViewWnd_Hide
  5. Execute CameraControlRemoteCmd.exe /c do LiveViewWnd_Show
  6. URL is not working anymore, not even with a refresh

Logs:

2023-03-14 22:26:52,369 [36]DEBUG DCC [(null)] - LiveView: Liveview started
2023-03-14 22:26:52,652 [36]DEBUG DCC [(null)] - LiveView: Liveview start done
2023-03-14 22:26:52,687 [31]DEBUG DCC [(null)] - Window command received :LiveViewWnd_Show
2023-03-14 22:26:52,994 [1]DEBUG DCC [(null)] - Window command received :Zoom_Image_Fit
2023-03-14 22:27:05,155 [40]DEBUG DCC [(null)] - LiveView: Liveview stopping
2023-03-14 22:27:05,163 [31]DEBUG DCC [(null)] - Window command received :LiveViewWnd_Hide
2023-03-14 22:27:06,906 [42]DEBUG DCC [(null)] - LiveView: Liveview started
2023-03-14 22:27:07,179 [42]DEBUG DCC [(null)] - LiveView: Liveview start done
2023-03-14 22:27:07,195 [39]ERROR DCC [(null)] - MJpeg server error Cannot access a disposed object.
Object name: System.Net.Sockets.Socket.
2023-03-14 22:27:07,204 [41]DEBUG DCC [(null)] - Window command received :LiveViewWnd_Show
2023-03-14 22:27:09,302 [40]DEBUG DCC [(null)] - LiveView: Liveview stopping
2023-03-14 22:27:09,310 [41]DEBUG DCC [(null)] - Window command received :LiveViewWnd_Hide

This problem can be resolved by a code fix in the dependency 'LibThreadedSockets'. A Pull Request was created by me. If this PR is ever completed, the dependency should be updated to the lastest version and a new version of digicamControl can be released.

Many thanks!

@MarcusWichelmann
Copy link

MarcusWichelmann commented Mar 15, 2023

Hi,

LibThreadedSockets and LibMJPEGServer are two completely unmainteined libraries by me from many years ago that I do not plan to further maintain. They are written very inefficiently at some places and could need a lot of optimization and updating, before anyone should continue using them.

I'd highly recommend, to switch away from these libraries and instead implement the MJPEG support yourself, it's not that hard. Maybe even use https://libjpeg-turbo.org/ then, which will make things a lot faster and more CPU-efficient than my implementation.

Here you can see, how TurboJPEG can be used in C#: https://github.com/MarcusWichelmann/MarcusW.VncClient/blob/master/src/MarcusW.VncClient/Protocol/Implementation/Services/Communication/TurboJpegDecoder.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants