Added Intra Refresh Support #97

Open
TheElixZammuto wants to merge 3 commits from TheElixZammuto/intra-refresh into master
TheElixZammuto commented 2024-11-24 16:12:05 -06:00 (Migrated from github.com)

This a companion PR on the moonlight-common-c project for these PR, the rationale/explanation for the PR can be found in the Sunshine one

Sunshine: https://github.com/LizardByte/Sunshine/pull/3415
Moonlight-Xbox: https://github.com/TheElixZammuto/moonlight-xbox/pull/155

This a companion PR on the moonlight-common-c project for these PR, the rationale/explanation for the PR can be found in the [Sunshine one](https://github.com/LizardByte/Sunshine/pull/3415) **Sunshine**: https://github.com/LizardByte/Sunshine/pull/3415 **Moonlight-Xbox**: https://github.com/TheElixZammuto/moonlight-xbox/pull/155
cgutman (Migrated from github.com) reviewed 2024-11-24 16:12:05 -06:00
cgutman (Migrated from github.com) requested changes 2024-11-26 17:35:31 -06:00
@ -274,1 +274,4 @@
// If set in the video renderer capabilities field, this flag specifies that the renderer
// needs to opt-in to intra refresh, some clients (like the Xbox client with NVEnc) needs it
#define CAPABILITY_INTRA_REFRESH 0x80
cgutman (Migrated from github.com) commented 2024-11-26 17:35:27 -06:00

This collides with CAPABILITY_REFERENCE_FRAME_INVALIDATION_AV1.

This collides with `CAPABILITY_REFERENCE_FRAME_INVALIDATION_AV1`.
TheElixZammuto (Migrated from github.com) reviewed 2024-12-23 09:09:32 -06:00
@ -274,1 +274,4 @@
// If set in the video renderer capabilities field, this flag specifies that the renderer
// needs to opt-in to intra refresh, some clients (like the Xbox client with NVEnc) needs it
#define CAPABILITY_INTRA_REFRESH 0x80
TheElixZammuto (Migrated from github.com) commented 2024-12-23 09:09:32 -06:00

Changed to 0x80

Changed to 0x80
cgutman (Migrated from github.com) reviewed 2025-01-05 16:55:52 -06:00
@ -274,1 +274,4 @@
// If set in the video renderer capabilities field, this flag specifies that the renderer
// needs to opt-in to intra refresh, some clients (like the Xbox client with NVEnc) needs it
#define CAPABILITY_INTRA_REFRESH 0x80
cgutman (Migrated from github.com) commented 2025-01-05 16:55:52 -06:00

Sorry for another nit, can you move this above the special CAPABILITY_SLICES_PER_FRAME macro too?

Sorry for another nit, can you move this above the special `CAPABILITY_SLICES_PER_FRAME` macro too?
cgutman commented 2025-03-26 23:07:21 -05:00 (Migrated from github.com)

@TheElixZammuto did you still want to get this merged or did you end up not needing it?

@TheElixZammuto did you still want to get this merged or did you end up not needing it?
TheElixZammuto commented 2025-09-07 09:46:50 -05:00 (Migrated from github.com)

@cgutman FYI the patch is still needed, I'm using my fork currently, let me know if there are other points that needs to be addressed

@cgutman FYI the patch is still needed, I'm using my fork currently, let me know if there are other points that needs to be addressed
andygrundman commented 2026-02-09 03:22:43 -06:00 (Migrated from github.com)

Yeah it would be good to merge this in, as it's a bit of a hassle to maintain an Xbox branch. I am curious if either of you have any ideas about how to improve on the unfortunate situation of Xbox intra refresh corruption. It happens most often on static or low-complexity content, and does resolve in a short time per the intra refresh settings, but it's just a bad experience. I tell people there's no solution, but is there anything we can do?

I couldn't work out why the Xbox decoder can't work with RFI, but it does crash if you try to enable it. I thought RFI might need changes to the render code around

	ctx->CopySubresourceRegion1(m_VideoTexture.Get(), 0, 0, 0, 0,
	                            (ID3D11Resource *)frame->data[0], (int)(intptr_t)frame->data[1],
	                            nullptr, D3D11_COPY_DISCARD);

so that ffmpeg had more buffers to use or something, but I didn't get very far trying to figure that out.

Yeah it would be good to merge this in, as it's a bit of a hassle to maintain an Xbox branch. I am curious if either of you have any ideas about how to improve on the unfortunate situation of Xbox intra refresh corruption. It happens most often on static or low-complexity content, and does resolve in a short time per the intra refresh settings, but it's just a bad experience. I tell people there's no solution, but is there anything we can do? I couldn't work out why the Xbox decoder can't work with RFI, but it does crash if you try to enable it. I thought RFI might need changes to the render code around ``` ctx->CopySubresourceRegion1(m_VideoTexture.Get(), 0, 0, 0, 0, (ID3D11Resource *)frame->data[0], (int)(intptr_t)frame->data[1], nullptr, D3D11_COPY_DISCARD); ``` so that ffmpeg had more buffers to use or something, but I didn't get very far trying to figure that out.
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'TheElixZammuto/intra-refresh:TheElixZammuto/intra-refresh'
git switch 'TheElixZammuto/intra-refresh'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'master'
git merge --no-ff 'TheElixZammuto/intra-refresh'
git switch 'TheElixZammuto/intra-refresh'
git rebase 'master'
git switch 'master'
git merge --ff-only 'TheElixZammuto/intra-refresh'
git switch 'TheElixZammuto/intra-refresh'
git rebase 'master'
git switch 'master'
git merge --no-ff 'TheElixZammuto/intra-refresh'
git switch 'master'
git merge --squash 'TheElixZammuto/intra-refresh'
git switch 'master'
git merge --ff-only 'TheElixZammuto/intra-refresh'
git switch 'master'
git merge 'TheElixZammuto/intra-refresh'
git push origin 'master'
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-moonlight-stream/moonlight-common-c!97
No description provided.