Coder Social home page Coder Social logo

Video capture hang about mmalsharp HOT 3 CLOSED

techyian avatar techyian commented on May 26, 2024
Video capture hang

from mmalsharp.

Comments (3)

techyian avatar techyian commented on May 26, 2024

As an update on this one:

This issue manifested itself in multiple ways, sometimes MMALSharp would simply freeze following disabling of a processing port, and other times it would throw an exception due to running into an invalid buffer (null). I didn't notice this during my time with a Pi 2 (who's CSI port is now broken) funnily enough.

As a workaround, I've had to regrettably add a Thread.Sleep(1000) call in when disabling ports. I suspect there may be something happening natively where my timings are off slightly and is causing MMAL itself to hang. I've done some extensive testing over the past few days and this final fix appears to resolve the issue. I didn't really want to introduce any blocking of the main thread, but as the MMALPortBase class is unsafe, async calls are out of the question.

As a result, I'll be releasing a new version to Nuget and if anyone happens to run into this following upgrading, please let me know and I'll see what I can do.

Thanks,
Ian

from mmalsharp.

techyian avatar techyian commented on May 26, 2024

I'm also looking at possibly moving the wait to the ProcessAsync method prior to disabling ports using an async delay call instead of Thread.Sleep. Doing some testing before committing any more work on this. I'm aware of speed implications but a short wait before disabling ports is more desirable than a freeze. Will see how short I can realistically get the wait before issues start happening again - 1s may be too generous.

from mmalsharp.

techyian avatar techyian commented on May 26, 2024

Added an async delay instead which I think is more suitable. I've dropped the delay to 100ms, this is per processing port, so the more ports you have enabled, the longer the disabling process will take. For general use cases (image/video encoder with 1 output port), this will just be a single 100ms delay, but when using the splitter component, this delay will obviously grow.

I've given this change a good stress test and haven't ran into the problems relating to this bug. Hoping there won't be any further issues around this area.

from mmalsharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.