Avoid resetting pending frame

The function update_texture() calls update_texture_internal() and falls
back to set_pending_frame() if it fails.

When the frame passed is the pending frame, call only the _internal()
version instead.

This will prevent issues with frame reference counts by ensuring the
source and destination frames are never the same.

Refs 6298ef095f
Refs #6357 <https://github.com/Genymobile/scrcpy/issues/6357>
This commit is contained in:
Romain Vimont 2025-09-23 20:17:27 +02:00
commit bfb0872493

View file

@ -181,6 +181,11 @@ sc_display_set_pending_frame(struct sc_display *display, const AVFrame *frame) {
return true;
}
// Forward declaration
static bool
sc_display_update_texture_internal(struct sc_display *display,
const AVFrame *frame);
static bool
sc_display_apply_pending(struct sc_display *display) {
if (display->pending.flags & SC_DISPLAY_PENDING_FLAG_SIZE) {
@ -196,7 +201,8 @@ sc_display_apply_pending(struct sc_display *display) {
if (display->pending.flags & SC_DISPLAY_PENDING_FLAG_FRAME) {
assert(display->pending.frame);
bool ok = sc_display_update_texture(display, display->pending.frame);
bool ok = sc_display_update_texture_internal(display,
display->pending.frame);
if (!ok) {
return false;
}