-
-
Notifications
You must be signed in to change notification settings - Fork 950
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
fix(macos): fix broken streaming on MacOS #2485
Conversation
@cgutman could you review this since it partially reverts some of your changes? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## nightly #2485 +/- ##
==========================================
+ Coverage 6.99% 7.04% +0.04%
==========================================
Files 87 87
Lines 17679 17697 +18
Branches 8399 8405 +6
==========================================
+ Hits 1237 1246 +9
- Misses 13713 13874 +161
+ Partials 2729 2577 -152
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@ReenigneArcher @cgutman I was using this version privately and noticed hardware encoding wasn't working yet, while now at least software encoding was working, it only fixed the frame being available to the encoder in time. So I went into another investigation and found out that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With AV_CODEC_FLAG_LOW_DELAY flag set , it seems like videotoolbox hevc and h.264 encoders works as expect on M2 Max.
This change should consider enclosed by #ifndef __APPLE__
@TimmyOVO By low delay set, you mean my PR it's working without my last changes and with: If that's the case AV_CODEC_FLAG_LOW_DELAY, works on Apple Silicon, but probably not on Intel macs with AMD dGPUs, it would be nice to have someone with M1 to try it out too and confirm if it's all Apple Silicon vs only M2+... Is currently there a way to check if we are under Apple Silicon vs Intel because |
Actually, is this related AT ALL, with platform and cpu architecture or it's just a GPU/Driver capabilities thing? Because probably we should just retry any codec that failed without AV_CODEC_FLAG_LOW_DELAY... |
As I'm not sure this is platform specific, nor architecture specific, I changed it to retry once for any codec that we try to open and have failed. This seems to me more a capability of certain GPUs than a platform/architecture thing, double checking if this flag is breaking any encoder seems better to me. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@ReenigneArcher I've fixed the release/retains issues using the The most important changes are:
I think this is the definitive version of this PR, if all testing goes well now. |
@Hazer thank you! Could you fix the linting errors? https://github.com/LizardByte/Sunshine/actions/runs/9024488207/job/24799565097?pr=2485#step:5:14 |
Done, but it's a bit uglier now in my opinion haha |
I agree, but it's difficult to change the lint rules without causing conflicts in all the open PRs. |
I agree, this might be related to gpu driver ,cause intel based mac are using different gpu driver than apple silicon one.Now looks good to me. |
015dbfd
to
2c72ac4
Compare
This isn't necessarily related to your changes, but would like to try to figure it out nonetheless. I can't figure out why the flatpak build is failing to checkout the latest commit.
I do see |
I think it failed in my CI too, let's try something, I deleted the tag created in my repo, if you run it now what happens? |
Yep, it was the tag. I'll have to keep that in mind for future cases. |
Description
I have a MacOS 14.4 running with a AMD RX 570, and noticed the mentioned issues, so after discovering version 0.19.1 was working (thanks to @VasylBaran), I decided to try narrowing down the issue.
Solution
Partially revertse535706a09f1849d2799fd72e889e4d7182f7fe5
, this commit changesav_img_t
and how it retains/release the frame buffers, which breaks something with how the frame is available to the encoder when needed and creates the mentioned issues.If someone could help me out fixingav_img_t
without reverting the structure, I would gladly improve this solution. Or if you have even another solution, I can pull and run here on my hardware.Fixes
av_img_t
usage and related structs, while retaining it until the nextav_img_t
is correctly configured. This slightly changes how it retains/release the frame buffers, allowing the frame to be available to the encoder when needed and avoids the mentioned issues.Quoting my discovery journey from #2272:
Screenshot
Issues Fixed
Type of Change
.github/...
)Checklist
Branch Updates
LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.