GithubHelp home page GithubHelp logo

OS X Port Bugs about memento HOT 3 CLOSED

ripose-jp avatar ripose-jp commented on June 5, 2024
OS X Port Bugs

from memento.

Comments (3)

ripose-jp avatar ripose-jp commented on June 5, 2024

The biggest obstacle to porting Memento is macOS it how macOS handles fullscreening applications.

When Memento is fullscreened on macOS and video is playing, the whole system will hang for about 30 seconds before finally entering a functional fullscreen. This is completely unique to macOS and happens no other platform. After extensive messing around, I've discovered that MpvWidget is likely rendering frames on the UI thread. I came to this conclusion after I experienced the same behavior in libmpv's qt_opengl example, code which Memento uses with almost no modification. Interestingly, I did not experience this issue in libmpv's qml example, at least not with the same frequency. After reading Qt's documentation on QQuickFramebufferObject, I found that QQuickFramebufferObject renders everything off the UI thread, while QOpenGLWidget renders everything on the UI thread.

My first attempt to solve this problem was to try and hack together a way to have mpv render frames off the UI thread and then send them to MpvWidget when they were done. I have no knowledge of graphics programming or OpenGL, so I found trying to figure out multithreading OpenGL rendering next to impossible. I was able to get Memento to not outright crash after following this StackOverflow post, but was unable to get mpv to render any frames. Rather, it just kept spitting out mpv_render_context_render() not being called or stuck while returning 0 for every frame it was called.

Having given up on the widgets approach at that point, I changed the render to use QML/Quick instead, which was something I really didn't want to do. You can see the results of this on the qml branch. While this did show some improvement, it still did not work 100% of the time, which is something it needs to do if I want to be able to releases a macOS version.

Pausing mpv before entering fullscreen on macOS does seem to work, but since Qt events like window changes are asynchronous, it doesn't work 100% of the time, and works 0% of the time if the maximize button is used instead of keystrokes.

At this point, I'm at a loss for what to do. If there's anyone with good ideas or any motivation to fix this, please leave a comment. I'd like to figure it out as well.

from memento.

ripose-jp avatar ripose-jp commented on June 5, 2024

I was able to solve the freezing problem by creating an Objective-C++ class that monitors the NSNotification for entering and exiting fullscreen and pausing mpv from there. It seems to have a 100% success rate. While it would be nice to have mutltithreaded rendering, it's no longer necessary.

from memento.

ripose-jp avatar ripose-jp commented on June 5, 2024

There are no longer substantial bugs present in the macOS port.

from memento.

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.