Skip to content

Add experimental session replay capturing on Linux - #1428

Merged
tustanivsky merged 2 commits into
mainfrom
feat/session-replay-linux
Jun 11, 2026
Merged

Add experimental session replay capturing on Linux#1428
tustanivsky merged 2 commits into
mainfrom
feat/session-replay-linux

Conversation

@tustanivsky

@tustanivsky tustanivsky commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

This PR adds an opt-in session replay feature for Linux allowing the SDK to continuously record the last several seconds of gameplay into a MP4 file and attach it to crash reports.

Example crash event with Session Replay attached (Linux)

Key Changes

  • The desktop recorder lifecycle (initialization, crash-time attachment, teardown, and replay path) is now consolidated into FGenericPlatformSentrySubsystem, the shared sentry-native base. All native desktop backends (Windows, Linux and the macOS Native backend) now use this unified path for Session Replay, and the duplicated implementations have been removed from FWindowsSentrySubsystem and the Native branch of FMacSentrySubsystem. The Cocoa backend retains its own implementation as it lives in a separate class hierarchy (FAppleSentrySubsystem).

  • FSentryBackBufferCapture now selects the encoder input texture interop flag at runtime based on the active RHI type - External for Vulkan (Linux, or Windows with -vulkan) and Shared for D3D - aligning with how the engine’s FVideoResourceRHI::Create chooses the appropriate flag per RHI.

Engine Dependencies

In addition to AVCodecsCore, Linux builds require the experimental NVCodecs plugin (which provides the NVENC encoder, available on Win64/Linux from UE 5.2+). Both must be enabled in the project for USE_SENTRY_SESSION_REPLAY to be defined (guards session replay code), and the platform must be Win64, Mac, or Linux.

Other Considerations

  • Vulkan → CUDA external-memory interop: On Linux the RHI is Vulkan, and AVCodecs has no native Vulkan H.264 encoder - NVENC is reached through CUDA. The encoder imports the capture texture's GPU allocation via an external-memory handle (OPAQUE_FD on Linux), which requires the texture to be created with TexCreate_External rather than the D3D-oriented TexCreate_Shared. The capture path now picks the flag per RHI so the Vulkan allocation exposes a shareable handle; with the wrong flag the resource has no shareable handle and the encoder rejects every frame.

Known Limitations

  • Currently works only with NVIDIA GPUs (driver 530.41 or newer)

Documentation

Related items:

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against d511222

@tustanivsky
tustanivsky marked this pull request as ready for review June 11, 2026 08:19

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d511222. Configure here.

Comment thread plugin-dev/Source/Sentry/Sentry.Build.cs

@JoshuaMoelans JoshuaMoelans left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice consolidation work! (also cool that Linux is way less additional work than macOS 😁 )

tustanivsky added a commit to getsentry/sentry-docs that referenced this pull request Jun 11, 2026
This PR adds Linux-specific details to the Session Replay docs for
Unreal SDK.

Related items:
- getsentry/sentry-unreal#1428
@tustanivsky
tustanivsky merged commit 0dbf67d into main Jun 11, 2026
142 of 144 checks passed
@tustanivsky
tustanivsky deleted the feat/session-replay-linux branch June 11, 2026 10:53
inventarSarah pushed a commit to getsentry/sentry-docs that referenced this pull request Jun 15, 2026
This PR adds Linux-specific details to the Session Replay docs for
Unreal SDK.

Related items:
- getsentry/sentry-unreal#1428
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

Successfully merging this pull request may close these issues.

2 participants