Accept texture failures

When the scrcpy window is minimized on Windows with D3D9, texture
creation and update fail.

In that case, do not terminate scrcpy. Instead, store the pending size
or frame to update, to attempt again during the next update or
rendering.

Fixes #3947 <https://github.com/Genymobile/scrcpy/issues/3947>
This commit is contained in:
Romain Vimont
2023-05-08 18:16:38 +02:00
parent 7d33798b40
commit 6298ef095f
3 changed files with 147 additions and 21 deletions

View File

@@ -24,6 +24,20 @@ struct sc_display {
#endif
bool mipmaps;
struct {
#define SC_DISPLAY_PENDING_FLAG_SIZE 1
#define SC_DISPLAY_PENDING_FLAG_FRAME 2
int8_t flags;
struct sc_size size;
AVFrame *frame;
} pending;
};
enum sc_display_result {
SC_DISPLAY_RESULT_OK,
SC_DISPLAY_RESULT_PENDING,
SC_DISPLAY_RESULT_ERROR,
};
bool
@@ -32,13 +46,13 @@ sc_display_init(struct sc_display *display, SDL_Window *window, bool mipmaps);
void
sc_display_destroy(struct sc_display *display);
bool
enum sc_display_result
sc_display_set_texture_size(struct sc_display *display, struct sc_size size);
bool
enum sc_display_result
sc_display_update_texture(struct sc_display *display, const AVFrame *frame);
bool
enum sc_display_result
sc_display_render(struct sc_display *display, const SDL_Rect *geometry,
unsigned rotation);