text
stringlengths
19
585k
label
stringclasses
2 values
category
stringclasses
2 values
language
stringclasses
14 values
repo
stringclasses
932 values
sha
stringlengths
40
40
@@ -209,4 +209,10 @@ private static void setDisplaySurface(IBinder display, Surface surface, Rect dev SurfaceControl.closeTransaction(); } } + + @Override + protected boolean applyNewVideoConstraints(VideoConstraints videoConstraints) {
bad
review
java
Genymobile/scrcpy
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java index 68bddab360..2278beeca3 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java +++ b/server/src/main/java/com/genymobile/scrcpy/video/Scre...
good
review_fixed
java
Genymobile/scrcpy
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
@@ -73,4 +73,14 @@ public Size getMaxCodecPortraitSize() { public int getMinCodecSize() { return minCodecSize; } + + /** + * Return the video constraints with the provided max size. + * + * @param maxSize the max requested size + * @return new video constraints
bad
review
java
Genymobile/scrcpy
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/VideoConstraints.java b/server/src/main/java/com/genymobile/scrcpy/video/VideoConstraints.java index eb3b8887ea..39b28682cf 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/VideoConstraints.java +++ b/server/src/main/java/com/genymobile/scrcpy/v...
good
review_fixed
java
Genymobile/scrcpy
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
@@ -102,11 +106,23 @@ private void streamCapture() throws IOException, ConfigurationException { streamer.writeVideoHeader(); + int retainedResetReasons = 0; + do { int resetReasons = captureControl.consumeReset(); if ((resetReasons & CaptureCont...
bad
review
java
Genymobile/scrcpy
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java b/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java index be022fc97b..1ccb775abc 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/video/S...
good
review_fixed
java
Genymobile/scrcpy
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
@@ -102,11 +106,23 @@ private void streamCapture() throws IOException, ConfigurationException { streamer.writeVideoHeader(); + int retainedResetReasons = 0; + do { int resetReasons = captureControl.consumeReset(); if ((resetReasons & CaptureCont...
bad
review
java
Genymobile/scrcpy
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java b/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java index be022fc97b..1ccb775abc 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceEncoder.java +++ b/server/src/main/java/com/genymobile/scrcpy/video/S...
good
review_fixed
java
Genymobile/scrcpy
5830dedbe4d71ba06d725f3013ce7d34cea6a5a8
@@ -253,6 +254,14 @@ static const struct sc_option options[] = { "Unit suffixes are supported: 'K' (x1000) and 'M' (x1000000).\n" "Default is 8M (8000000).", }, + { + .longopt_id = OPT_BACKGROUND_COLOR, + .longopt = "background-color", + .argdesc = "hexcolo...
bad
review
c
Genymobile/scrcpy
198cc19afb23f5d119318c88084451307faa143a
diff --git a/app/src/cli.c b/app/src/cli.c index 39576d8d20..2cb0d3e23d 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -106,6 +106,7 @@ enum { OPT_MIN_SIZE_ALIGNMENT, OPT_NO_WINDOW_ASPECT_RATIO_LOCK, OPT_KEEP_ACTIVE, + OPT_BACKGROUND_COLOR, }; struct sc_option { @@ -253,6 +254,14 @@ static cons...
good
review_fixed
c
Genymobile/scrcpy
198cc19afb23f5d119318c88084451307faa143a
@@ -253,6 +254,14 @@ static const struct sc_option options[] = { "Unit suffixes are supported: 'K' (x1000) and 'M' (x1000000).\n" "Default is 8M (8000000).", }, + { + .longopt_id = OPT_BACKGROUND_COLOR, + .longopt = "background-color", + .argdesc = "hexcolo...
bad
review
c
Genymobile/scrcpy
198cc19afb23f5d119318c88084451307faa143a
diff --git a/app/src/cli.c b/app/src/cli.c index 39576d8d20..2cb0d3e23d 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -106,6 +106,7 @@ enum { OPT_MIN_SIZE_ALIGNMENT, OPT_NO_WINDOW_ASPECT_RATIO_LOCK, OPT_KEEP_ACTIVE, + OPT_BACKGROUND_COLOR, }; struct sc_option { @@ -253,6 +254,14 @@ static cons...
good
review_fixed
c
Genymobile/scrcpy
198cc19afb23f5d119318c88084451307faa143a
@@ -903,6 +974,46 @@ sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) { sc_input_manager_handle_event(&screen->im, event); } +void +sc_screen_handle_disconnection(struct sc_screen *screen) { + if (!screen->window_shown) { + // No window open, quit immediately + return; +...
bad
review
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/screen.c b/app/src/screen.c index d50b670f89..9f1876ed86 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -184,7 +184,7 @@ compute_content_rect(struct sc_size render_size, struct sc_size content_size, static void sc_screen_update_content_rect(struct sc_screen *screen) { // Only upscal...
good
review_fixed
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
@@ -0,0 +1,89 @@ +#include "disconnect.h" + +#include <assert.h> + +#include "icon.h" +#include "util/log.h" + +static int +run(void *userdata) { + struct sc_disconnect *d = userdata; + + SDL_Surface *icon = sc_icon_load(SC_ICON_FILENAME_DISCONNECTED); + if (icon) { + d->cbs->on_icon_loaded(d, icon, d->...
bad
review
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/disconnect.c b/app/src/disconnect.c new file mode 100644 index 0000000000..d494091b03 --- /dev/null +++ b/app/src/disconnect.c @@ -0,0 +1,88 @@ +#include "disconnect.h" + +#include <assert.h> + +#include "icon.h" +#include "util/log.h" + +static int +run(void *userdata) { + struct sc_disconnect ...
good
review_fixed
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
@@ -0,0 +1,89 @@ +#include "disconnect.h" + +#include <assert.h> + +#include "icon.h" +#include "util/log.h" + +static int +run(void *userdata) { + struct sc_disconnect *d = userdata; + + SDL_Surface *icon = sc_icon_load(SC_ICON_FILENAME_DISCONNECTED); + if (icon) { + d->cbs->on_icon_loaded(d, icon, d->...
bad
review
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/disconnect.c b/app/src/disconnect.c new file mode 100644 index 0000000000..d494091b03 --- /dev/null +++ b/app/src/disconnect.c @@ -0,0 +1,88 @@ +#include "disconnect.h" + +#include <assert.h> + +#include "icon.h" +#include "util/log.h" + +static int +run(void *userdata) { + struct sc_disconnect ...
good
review_fixed
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
@@ -0,0 +1,89 @@ +#include "disconnect.h" + +#include <assert.h> + +#include "icon.h" +#include "util/log.h" + +static int +run(void *userdata) { + struct sc_disconnect *d = userdata; + + SDL_Surface *icon = sc_icon_load(SC_ICON_FILENAME_DISCONNECTED); + if (icon) { + d->cbs->on_icon_loaded(d, icon, d->...
bad
review
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/disconnect.c b/app/src/disconnect.c new file mode 100644 index 0000000000..d494091b03 --- /dev/null +++ b/app/src/disconnect.c @@ -0,0 +1,88 @@ +#include "disconnect.h" + +#include <assert.h> + +#include "icon.h" +#include "util/log.h" + +static int +run(void *userdata) { + struct sc_disconnect ...
good
review_fixed
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
@@ -0,0 +1,89 @@ +#include "disconnect.h" + +#include <assert.h> + +#include "icon.h" +#include "util/log.h" + +static int +run(void *userdata) { + struct sc_disconnect *d = userdata; + + SDL_Surface *icon = sc_icon_load(SC_ICON_FILENAME_DISCONNECTED); + if (icon) { + d->cbs->on_icon_loaded(d, icon, d->...
bad
review
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/disconnect.c b/app/src/disconnect.c new file mode 100644 index 0000000000..d494091b03 --- /dev/null +++ b/app/src/disconnect.c @@ -0,0 +1,88 @@ +#include "disconnect.h" + +#include <assert.h> + +#include "icon.h" +#include "util/log.h" + +static int +run(void *userdata) { + struct sc_disconnect ...
good
review_fixed
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
@@ -903,6 +974,46 @@ sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) { sc_input_manager_handle_event(&screen->im, event); } +void +sc_screen_handle_disconnection(struct sc_screen *screen) { + if (!screen->window_shown) { + // No window open, quit immediately + return; +...
bad
review
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/screen.c b/app/src/screen.c index d50b670f89..9f1876ed86 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -184,7 +184,7 @@ compute_content_rect(struct sc_size render_size, struct sc_size content_size, static void sc_screen_update_content_rect(struct sc_screen *screen) { // Only upscal...
good
review_fixed
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
@@ -14,18 +14,20 @@ enum { SC_EVENT_DEVICE_DISCONNECTED, SC_EVENT_SERVER_CONNECTION_FAILED, SC_EVENT_SERVER_CONNECTED, - SC_EVENT_USB_DEVICE_DISCONNECTED, SC_EVENT_DEMUXER_ERROR, SC_EVENT_RECORDER_ERROR, SC_EVENT_TIME_LIMIT_REACHED, SC_EVENT_CONTROLLER_ERROR, SC_EVENT_AOA_OPEN...
bad
review
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/events.h b/app/src/events.h index 567268ab7f..c82741afe6 100644 --- a/app/src/events.h +++ b/app/src/events.h @@ -14,18 +14,20 @@ enum { SC_EVENT_DEVICE_DISCONNECTED, SC_EVENT_SERVER_CONNECTION_FAILED, SC_EVENT_SERVER_CONNECTED, - SC_EVENT_USB_DEVICE_DISCONNECTED, SC_EVENT_DE...
good
review_fixed
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
@@ -6,9 +6,13 @@ #include "util/thread.h" bool -sc_push_event_impl(uint32_t type, const char *name) { - SDL_Event event; - event.type = type; +sc_push_event_impl(uint32_t type, void* ptr, const char *name) {
bad
review
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/events.c b/app/src/events.c index ca7e4008a6..5269bdbcf8 100644 --- a/app/src/events.c +++ b/app/src/events.c @@ -6,9 +6,13 @@ #include "util/thread.h" bool -sc_push_event_impl(uint32_t type, const char *name) { - SDL_Event event; - event.type = type; +sc_push_event_impl(uint32_t type, vo...
good
review_fixed
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
@@ -645,6 +660,17 @@ sc_screen_destroy(struct sc_screen *screen) { SDL_DestroyWindow(screen->window); sc_fps_counter_destroy(&screen->fps_counter); sc_frame_buffer_destroy(&screen->fb); + + SDL_Event event; + int nevents = SDL_PeepEvents(&event, 1, SDL_GETEVENT, + SC...
bad
review
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/screen.c b/app/src/screen.c index d50b670f89..9f1876ed86 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -184,7 +184,7 @@ compute_content_rect(struct sc_size render_size, struct sc_size content_size, static void sc_screen_update_content_rect(struct sc_screen *screen) { // Only upscal...
good
review_fixed
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
@@ -915,6 +987,54 @@ sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) { sc_input_manager_handle_event(&screen->im, event); } +void +sc_screen_handle_disconnection(struct sc_screen *screen) { + if (!screen->window_shown) { + // No window open, quit immediately + return; +...
bad
review
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/screen.c b/app/src/screen.c index d50b670f89..9f1876ed86 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -184,7 +184,7 @@ compute_content_rect(struct sc_size render_size, struct sc_size content_size, static void sc_screen_update_content_rect(struct sc_screen *screen) { // Only upscal...
good
review_fixed
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
@@ -915,6 +987,54 @@ sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) { sc_input_manager_handle_event(&screen->im, event); } +void +sc_screen_handle_disconnection(struct sc_screen *screen) { + if (!screen->window_shown) { + // No window open, quit immediately + return; +...
bad
review
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
diff --git a/app/src/screen.c b/app/src/screen.c index d50b670f89..9f1876ed86 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -184,7 +184,7 @@ compute_content_rect(struct sc_size render_size, struct sc_size content_size, static void sc_screen_update_content_rect(struct sc_screen *screen) { // Only upscal...
good
review_fixed
c
Genymobile/scrcpy
a4000a14879831bd61f935fccc5af896e3098dfb
@@ -35,45 +35,48 @@ else cd "$DIRNAME" conf=( - --prefix="$INSTALL_DIR/$DIRNAME" + -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR/$DIRNAME" ) if [[ "$HOST" == linux ]] then conf+=( - --enable-video-wayland - --enable-video-x11 + -DSDL_WAYLOAD=ON
bad
review
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/deps/sdl.sh b/app/deps/sdl.sh index f74ccf4124..2219d5c8e5 100755 --- a/app/deps/sdl.sh +++ b/app/deps/sdl.sh @@ -3,9 +3,9 @@ set -ex . $(dirname ${BASH_SOURCE[0]})/_init process_args "$@" -VERSION=2.32.8 +VERSION=3.4.0 URL="https://github.com/libsdl-org/SDL/archive/refs/tags/release-$VERSION.tar....
good
review_fixed
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -282,19 +334,22 @@ sc_display_prepare_texture(struct sc_display *display, struct sc_size size, static bool sc_display_update_texture_internal(struct sc_display *display, const AVFrame *frame) { - int ret = SDL_UpdateYUVTexture(display->texture, NULL, + bool ok = SDL_Update...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/display.c b/app/src/display.c index 15f9a1f19e..3050966cfb 100644 --- a/app/src/display.c +++ b/app/src/display.c @@ -6,14 +6,18 @@ #include <libavutil/pixfmt.h> #include "util/log.h" +#include "util/sdl.h" static bool sc_display_init_novideo_icon(struct sc_display *display, ...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -248,17 +236,35 @@ load_from_path(const char *path) { #endif } - SDL_Palette *palette = surface->format->palette; - assert(palette); - int ret = SDL_SetPaletteColors(palette, colors, 0, 256); - if (ret) { + SDL_Palette *palette = SDL_CreateSurfacePalette(surface); + ...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/icon.c b/app/src/icon.c index 797afc75b3..a1e82a5aea 100644 --- a/app/src/icon.c +++ b/app/src/icon.c @@ -10,7 +10,7 @@ #include <libavutil/avutil.h> #include <libavutil/pixdesc.h> #include <libavutil/pixfmt.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "config.h" #include "util/...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -366,12 +357,19 @@ static void init_sdl_gamepads(void) { // Trigger a SDL_CONTROLLERDEVICEADDED event for all gamepads already
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index aedfdf9cf8..a16bf6a8f1 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -6,7 +6,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #ifdef _WIN32 // not needed here, but winsock2.h must never b...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -26,45 +27,27 @@ get_oriented_size(struct sc_size size, enum sc_orientation orientation) { return oriented_size; } -// get the window size in a struct sc_size -static struct sc_size -get_window_size(const struct sc_screen *screen) { - int width; - int height; - SDL_GetWindowSize(screen->window, &wid...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -236,18 +216,18 @@ sc_screen_render_novideo(struct sc_screen *screen) { // // <https://bugzilla.libsdl.org/show_bug.cgi?id=2077> // <https://stackoverflow.com/a/40693139/1987178> -static int +static bool event_watcher(void *data, SDL_Event *event) { struct sc_screen *screen = data; assert(screen->video...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -26,45 +27,27 @@ get_oriented_size(struct sc_size size, enum sc_orientation orientation) { return oriented_size; } -// get the window size in a struct sc_size -static struct sc_size -get_window_size(const struct sc_screen *screen) { - int width; - int height; - SDL_GetWindowSize(screen->window, &wid...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -712,8 +712,8 @@ void sc_screen_toggle_fullscreen(struct sc_screen *screen) { assert(screen->video); - uint32_t new_mode = screen->fullscreen ? 0 : SDL_WINDOW_FULLSCREEN_DESKTOP; - if (SDL_SetWindowFullscreen(screen->window, new_mode)) { + bool ok = SDL_SetWindowFullscreen(screen->window, !screen->f...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -783,46 +788,38 @@ sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) { } return true; } - case SDL_WINDOWEVENT: - if (!screen->video - && event->window.event == SDL_WINDOWEVENT_EXPOSED) { + case SDL_EVENT_WINDOW_EXP...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -74,10 +74,10 @@ sc_gamepad_processor_process_gamepad_added(struct sc_gamepad_processor *gp, return; } - SDL_GameController* game_controller = - SDL_GameControllerFromInstanceID(event->gamepad_id); + SDL_Gamepad * game_controller =
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/uhid/gamepad_uhid.c b/app/src/uhid/gamepad_uhid.c index c64feb1851..2ae9bb7d44 100644 --- a/app/src/uhid/gamepad_uhid.c +++ b/app/src/uhid/gamepad_uhid.c @@ -3,7 +3,7 @@ #include <assert.h> #include <inttypes.h> #include <string.h> -#include <SDL2/SDL_gamecontroller.h> +#include <SDL3/SDL_gamepa...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -180,34 +187,34 @@ sc_screen_otg_process_mouse_wheel(struct sc_screen_otg *screen, static void sc_screen_otg_process_gamepad_device(struct sc_screen_otg *screen, - const SDL_ControllerDeviceEvent *event) { + const SDL_GamepadDeviceEvent *eve...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/usb/screen_otg.c b/app/src/usb/screen_otg.c index 5c580df994..4fbccfb02a 100644 --- a/app/src/usb/screen_otg.c +++ b/app/src/usb/screen_otg.c @@ -7,14 +7,19 @@ #include "options.h" #include "util/acksync.h" #include "util/log.h" +#include "util/sdl.h" static void sc_screen_otg_render(struct ...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -180,34 +187,34 @@ sc_screen_otg_process_mouse_wheel(struct sc_screen_otg *screen, static void sc_screen_otg_process_gamepad_device(struct sc_screen_otg *screen, - const SDL_ControllerDeviceEvent *event) { + const SDL_GamepadDeviceEvent *eve...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/usb/screen_otg.c b/app/src/usb/screen_otg.c index 5c580df994..4fbccfb02a 100644 --- a/app/src/usb/screen_otg.c +++ b/app/src/usb/screen_otg.c @@ -7,14 +7,19 @@ #include "options.h" #include "util/acksync.h" #include "util/log.h" +#include "util/sdl.h" static void sc_screen_otg_render(struct ...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -180,34 +187,34 @@ sc_screen_otg_process_mouse_wheel(struct sc_screen_otg *screen, static void sc_screen_otg_process_gamepad_device(struct sc_screen_otg *screen, - const SDL_ControllerDeviceEvent *event) { + const SDL_GamepadDeviceEvent *eve...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/usb/screen_otg.c b/app/src/usb/screen_otg.c index 5c580df994..4fbccfb02a 100644 --- a/app/src/usb/screen_otg.c +++ b/app/src/usb/screen_otg.c @@ -7,14 +7,19 @@ #include "options.h" #include "util/acksync.h" #include "util/log.h" +#include "util/sdl.h" static void sc_screen_otg_render(struct ...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -0,0 +1,46 @@ +#ifndef SC_SDL_H +#define SC_SDL_H + +#include "common.h" + +#include <stdint.h> +#include <SDL3/SDL_render.h> +#include <SDL3/SDL_video.h> + +#include "coords.h" + +SDL_Window * +sc_sdl_create_window(const char *title, int64_t x, int64_t y, int64_t width, + int64_t height, int64_t...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/util/sdl.h b/app/src/util/sdl.h new file mode 100644 index 0000000000..78b8319e7e --- /dev/null +++ b/app/src/util/sdl.h @@ -0,0 +1,43 @@ +#ifndef SC_SDL_H +#define SC_SDL_H + +#include "common.h" + +#include <stdint.h> +#include <SDL3/SDL_render.h> +#include <SDL3/SDL_video.h> + +#include "coords....
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -911,31 +906,31 @@ sc_input_manager_process_mouse_wheel(struct sc_input_manager *im, static void sc_input_manager_process_gamepad_device(struct sc_input_manager *im, - const SDL_ControllerDeviceEvent *event) { - if (event->type == SDL_CONTROLLERDEVICEADDED) { - SDL...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/input_manager.c b/app/src/input_manager.c index 3e4dd0f32f..70adf59fbc 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -3,7 +3,7 @@ #include <assert.h> #include <stdlib.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "android/input.h" #incl...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -911,31 +906,31 @@ sc_input_manager_process_mouse_wheel(struct sc_input_manager *im, static void sc_input_manager_process_gamepad_device(struct sc_input_manager *im, - const SDL_ControllerDeviceEvent *event) { - if (event->type == SDL_CONTROLLERDEVICEADDED) { - SDL...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/input_manager.c b/app/src/input_manager.c index 3e4dd0f32f..70adf59fbc 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -3,7 +3,7 @@ #include <assert.h> #include <stdlib.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "android/input.h" #incl...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -911,31 +906,31 @@ sc_input_manager_process_mouse_wheel(struct sc_input_manager *im, static void sc_input_manager_process_gamepad_device(struct sc_input_manager *im, - const SDL_ControllerDeviceEvent *event) { - if (event->type == SDL_CONTROLLERDEVICEADDED) { - SDL...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/input_manager.c b/app/src/input_manager.c index 3e4dd0f32f..70adf59fbc 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -3,7 +3,7 @@ #include <assert.h> #include <stdlib.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "android/input.h" #incl...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -412,10 +409,9 @@ struct sc_touch_event { float pressure; }; -// As documented in <https://wiki.libsdl.org/SDL2/SDL_JoystickID>: -// The ID value starts at 0 and increments from there. The value -1 is an -// invalid ID. -#define SC_GAMEPAD_ID_INVALID UINT32_C(-1) +// As documented in <hhttps://wiki.libsdl.or...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/input_events.h b/app/src/input_events.h index 5cf9f12db9..57ef9b85fc 100644 --- a/app/src/input_events.h +++ b/app/src/input_events.h @@ -6,7 +6,7 @@ #include <assert.h> #include <stdbool.h> #include <stdint.h> -#include <SDL2/SDL_events.h> +#include <SDL3/SDL_events.h> #include "coords.h" ...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -5,8 +5,9 @@ #ifdef HAVE_V4L2 # include <libavdevice/avdevice.h> #endif -#define SDL_MAIN_HANDLED // avoid link error on Linux Windows Subsystem -#include <SDL2/SDL.h> +#define SDL_FUNCTION_POINTER_IS_VOID_POINTER +#include <SDL3/SDL_stdinc.h>
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/main.c b/app/src/main.c index b4897456f6..7b728d7301 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -5,8 +5,7 @@ #ifdef HAVE_V4L2 # include <libavdevice/avdevice.h> #endif -#define SDL_MAIN_HANDLED // avoid link error on Linux Windows Subsystem -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> ...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -63,22 +63,18 @@ scrcpy_otg(struct scrcpy_options *options) { const char *serial = options->serial; - if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1")) { - LOGW("Could not enable linear filtering"); - } - if (!SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1")) { LOGW...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/usb/scrcpy_otg.c b/app/src/usb/scrcpy_otg.c index 1a9cc46ee1..483720f853 100644 --- a/app/src/usb/scrcpy_otg.c +++ b/app/src/usb/scrcpy_otg.c @@ -3,7 +3,7 @@ #include <assert.h> #include <stdbool.h> #include <stdlib.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #ifdef _WIN32 # include "ad...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -799,26 +785,18 @@ sc_screen_handle_event(struct sc_screen *screen, const SDL_Event *event) { sc_screen_render(screen, true); } return true; - case SDL_EVENT_WINDOW_MAXIMIZED: - screen->maximized = true; - return true; - case SDL_EVENT_WI...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -759,15 +750,10 @@ void sc_screen_resize_to_pixel_perfect(struct sc_screen *screen) { assert(screen->video); - if (screen->fullscreen || screen->minimized) { + if (!is_windowed(screen)) { return; } - if (screen->maximized) { - sc_sdl_restore_window(screen->window); - sc...
bad
review
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
diff --git a/app/src/screen.c b/app/src/screen.c index da17df0ed2..4209e22455 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -2,12 +2,13 @@ #include <assert.h> #include <string.h> -#include <SDL2/SDL.h> +#include <SDL3/SDL.h> #include "events.h" #include "icon.h" #include "options.h" #include "util/l...
good
review_fixed
c
Genymobile/scrcpy
dee1fd46a674ec6078da56acc3d577e18b9d65fd
@@ -13,9 +13,9 @@ #ifdef HAVE_USB # include "usb/scrcpy_otg.h" #endif +#include "events.h" #include "util/log.h" #include "util/net.h" -#include "util/thread.h"
bad
review
c
Genymobile/scrcpy
3fcb0108230686a52fc1da2c53026c181f3aa8df
diff --git a/app/src/main.c b/app/src/main.c index 3ab03243f7..7327e07d3e 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -8,6 +8,7 @@ #include <SDL3/SDL.h> #include "cli.h" +#include "events.h" #include "options.h" #include "scrcpy.h" #ifdef HAVE_USB @@ -15,7 +16,6 @@ #endif #include "util/log.h" #includ...
good
review_fixed
c
Genymobile/scrcpy
3fcb0108230686a52fc1da2c53026c181f3aa8df
@@ -23,38 +26,41 @@ sc_push_event_impl(uint32_t type, void *ptr, const char *name) { } bool -sc_post_to_main_thread(sc_runnable_fn run, void *userdata) { - SDL_Event event = { - .user = { - .type = SC_EVENT_RUN_ON_MAIN_THREAD, - .data1 = run, - .data2 = userdata, - ...
bad
review
c
Genymobile/scrcpy
3fcb0108230686a52fc1da2c53026c181f3aa8df
diff --git a/app/src/events.c b/app/src/events.c index 5269bdbcf8..b7a3a7a34a 100644 --- a/app/src/events.c +++ b/app/src/events.c @@ -5,6 +5,9 @@ #include "util/log.h" #include "util/thread.h" +static sc_mutex mutex; +static bool stopped; + bool sc_push_event_impl(uint32_t type, void *ptr, const char *name) { ...
good
review_fixed
c
Genymobile/scrcpy
3fcb0108230686a52fc1da2c53026c181f3aa8df
@@ -13,6 +13,7 @@ #ifdef HAVE_USB # include "usb/scrcpy_otg.h" #endif +#include "events.h"
bad
review
c
Genymobile/scrcpy
3fcb0108230686a52fc1da2c53026c181f3aa8df
diff --git a/app/src/main.c b/app/src/main.c index 3ab03243f7..7327e07d3e 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -8,6 +8,7 @@ #include <SDL3/SDL.h> #include "cli.h" +#include "events.h" #include "options.h" #include "scrcpy.h" #ifdef HAVE_USB @@ -15,7 +16,6 @@ #endif #include "util/log.h" #includ...
good
review_fixed
c
Genymobile/scrcpy
3fcb0108230686a52fc1da2c53026c181f3aa8df
@@ -259,6 +293,9 @@ public void start(TerminationListener listener) { @Override public void stop() { + if (keepActiveThread != null) { + keepActiveThread.interrupt();
bad
review
java
Genymobile/scrcpy
9b2498c852ad61bceb35a6c9b4a90b987b84ba56
diff --git a/server/src/main/java/com/genymobile/scrcpy/control/Controller.java b/server/src/main/java/com/genymobile/scrcpy/control/Controller.java index e1d5387a0c..330eb0ff0f 100644 --- a/server/src/main/java/com/genymobile/scrcpy/control/Controller.java +++ b/server/src/main/java/com/genymobile/scrcpy/control/Contr...
good
review_fixed
java
Genymobile/scrcpy
9b2498c852ad61bceb35a6c9b4a90b987b84ba56
@@ -117,9 +121,11 @@ public void prepare() { displayMonitor.setSessionDisplayProperties(new DisplayProperties(displaySize, displayRotation)); } else { DisplayInfo displayInfo = ServiceManager.getDisplayManager().getDisplayInfo(virtualDisplay.getDisplay().getDisplayId()); - ...
bad
review
java
Genymobile/scrcpy
266e2eaf149771682ddafe0f35c589ed47237a46
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index 254eb9459e..e0ec2141fb 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcp...
good
review_fixed
java
Genymobile/scrcpy
266e2eaf149771682ddafe0f35c589ed47237a46
@@ -83,13 +83,13 @@ public boolean isClosed() { } /** - * Return the video alignment + * Return the video constraints. * <p> * This a power-of-2 value that the video width and height must be multiples of.
bad
review
java
Genymobile/scrcpy
66005e88893f39dc995472def203f0c4bc9aa2b3
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/SurfaceCapture.java index 81da337b77..18633c84af 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/SurfaceCapture.java +++ b/server/src/main/java/com/genymobile/scrcpy/video/S...
good
review_fixed
java
Genymobile/scrcpy
66005e88893f39dc995472def203f0c4bc9aa2b3
@@ -39,24 +39,38 @@ public Size constrain(VideoConstraints constraints) { assert alignment > 0 : "Alignment must be positive"; assert (alignment & (alignment - 1)) == 0 : "Alignment must be a power-of-two"; - int alignedMaxSize = maxSize / alignment * alignment; // round to a multiple of alig...
bad
review
java
Genymobile/scrcpy
66005e88893f39dc995472def203f0c4bc9aa2b3
diff --git a/server/src/main/java/com/genymobile/scrcpy/device/Size.java b/server/src/main/java/com/genymobile/scrcpy/device/Size.java index b684a54e60..36161758ad 100644 --- a/server/src/main/java/com/genymobile/scrcpy/device/Size.java +++ b/server/src/main/java/com/genymobile/scrcpy/device/Size.java @@ -1,5 +1,7 @@ ...
good
review_fixed
java
Genymobile/scrcpy
66005e88893f39dc995472def203f0c4bc9aa2b3
@@ -72,6 +72,15 @@ public Size constrain(VideoConstraints constraints) { assert w <= maxWidth : "The width cannot exceed maxWidth"; assert h <= maxHeight : "The height cannot exceed maxSize"; + // Minimum codec size must be respected (regardless of requested maxSize) + int minCodecSize...
bad
review
java
Genymobile/scrcpy
66005e88893f39dc995472def203f0c4bc9aa2b3
diff --git a/server/src/main/java/com/genymobile/scrcpy/device/Size.java b/server/src/main/java/com/genymobile/scrcpy/device/Size.java index b684a54e60..36161758ad 100644 --- a/server/src/main/java/com/genymobile/scrcpy/device/Size.java +++ b/server/src/main/java/com/genymobile/scrcpy/device/Size.java @@ -1,5 +1,7 @@ ...
good
review_fixed
java
Genymobile/scrcpy
66005e88893f39dc995472def203f0c4bc9aa2b3
@@ -72,6 +72,15 @@ public Size constrain(VideoConstraints constraints) { assert w <= maxWidth : "The width cannot exceed maxWidth"; assert h <= maxHeight : "The height cannot exceed maxHeight"; + // Minimum codec size must be respected (regardless of requested maxSize) + int minCodecSi...
bad
review
java
Genymobile/scrcpy
66005e88893f39dc995472def203f0c4bc9aa2b3
diff --git a/server/src/main/java/com/genymobile/scrcpy/device/Size.java b/server/src/main/java/com/genymobile/scrcpy/device/Size.java index b684a54e60..36161758ad 100644 --- a/server/src/main/java/com/genymobile/scrcpy/device/Size.java +++ b/server/src/main/java/com/genymobile/scrcpy/device/Size.java @@ -1,5 +1,7 @@ ...
good
review_fixed
java
Genymobile/scrcpy
66005e88893f39dc995472def203f0c4bc9aa2b3
@@ -303,7 +303,7 @@ number of sockets, the order in which the sockets must be opened, the data format on the wire…) from version to version. A client must always be run with a matching server version. -This section documents the current protocol in scrcpy v2.1. +This section documents the current protocol in scrcpy...
bad
review
Genymobile/scrcpy
6235289e77411d0a0a4bf67dfdad8ef7adedf5e8
diff --git a/doc/develop.md b/doc/develop.md index 002ec4b9ef..3bf69caa98 100644 --- a/doc/develop.md +++ b/doc/develop.md @@ -29,7 +29,7 @@ Similarly, if audio is enabled, then the server sends a raw audio stream (OPUS by default) of the device audio output (or the microphone if `--audio-source=mic` is specified), w...
good
review_fixed
Genymobile/scrcpy
6235289e77411d0a0a4bf67dfdad8ef7adedf5e8
@@ -352,19 +352,41 @@ Then each socket is used for its intended purpose. ### Video and audio -On the _video_ and _audio_ sockets, the device first sends some [codec -metadata]: - - On the _video_ socket, 12 bytes: - - the codec id (`u32`) (H264, H265 or AV1) - - the initial video width (`u32`) - - the initia...
bad
review
Genymobile/scrcpy
6235289e77411d0a0a4bf67dfdad8ef7adedf5e8
diff --git a/doc/develop.md b/doc/develop.md index 002ec4b9ef..3bf69caa98 100644 --- a/doc/develop.md +++ b/doc/develop.md @@ -29,7 +29,7 @@ Similarly, if audio is enabled, then the server sends a raw audio stream (OPUS by default) of the device audio output (or the microphone if `--audio-source=mic` is specified), w...
good
review_fixed
Genymobile/scrcpy
6235289e77411d0a0a4bf67dfdad8ef7adedf5e8