Position and size the window on first frame

The optimal initial size was computed from the expected dimensions, sent
immediately by the server before encoding any video frame.

However, the actual frame size may be different, for example when the
device encoder does not support the requested size.

To always handle this case properly, position and size the window only
once the first frame size is known.

PR #2947 <https://github.com/Genymobile/scrcpy/pull/2947>
This commit is contained in:
Romain Vimont
2022-01-16 15:46:37 +01:00
parent fa30f9806a
commit 75c5dc6859
2 changed files with 36 additions and 23 deletions

View File

@@ -28,6 +28,15 @@ struct sc_screen {
struct sc_video_buffer vb;
struct fps_counter fps_counter;
// The initial requested window properties
struct {
int16_t x;
int16_t y;
uint16_t width;
uint16_t height;
bool fullscreen;
} req;
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Texture *texture;