text
stringlengths
19
585k
label
stringclasses
2 values
category
stringclasses
2 values
language
stringclasses
14 values
repo
stringclasses
932 values
sha
stringlengths
40
40
@@ -9,7 +9,9 @@ public enum VideoCodec implements Codec { H264(0x68_32_36_34, "h264", MediaFormat.MIMETYPE_VIDEO_AVC), H265(0x68_32_36_35, "h265", MediaFormat.MIMETYPE_VIDEO_HEVC), @SuppressLint("InlinedApi") // introduced in API 29 - AV1(0x00_61_76_31, "av1", MediaFormat.MIMETYPE_VIDEO_AV1); + AV1...
bad
review
java
Genymobile/scrcpy
0bdd750447b0826039d8c6111c2c21dc10d70af1
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/VideoCodec.java b/server/src/main/java/com/genymobile/scrcpy/video/VideoCodec.java index 5f19603d81..8b9de0ff5d 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/VideoCodec.java +++ b/server/src/main/java/com/genymobile/scrcpy/video/VideoCodec.ja...
good
review_fixed
java
Genymobile/scrcpy
0bdd750447b0826039d8c6111c2c21dc10d70af1
@@ -119,6 +125,20 @@ sc_controller_push_msg(struct sc_controller *controller, return pushed; } +void +sc_controller_resize_display(struct sc_controller *controller, + uint16_t width, uint16_t height) { + assert(width && height); + sc_mutex_lock(&controller->mutex); + bool wa...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/controller.c b/app/src/controller.c index 749de0a501..19e2acb860 100644 --- a/app/src/controller.c +++ b/app/src/controller.c @@ -59,6 +59,9 @@ sc_controller_init(struct sc_controller *controller, sc_socket control_socket, controller->control_socket = control_socket; controller->stopped =...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -201,7 +201,7 @@ public void startNew(Surface surface) { ServiceManager.getWindowManager().setDisplayImePolicy(virtualDisplayId, displayImePolicy); } - displayMonitor.start(virtualDisplayId, this::invalidate); + displayMonitor.start(virtualDisplayId, () -> getCap...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -2,21 +2,34 @@ import android.media.MediaCodec; -import java.util.concurrent.atomic.AtomicBoolean; - public class CaptureControl { - private final AtomicBoolean reset = new AtomicBoolean(); + public static final int RESET_REASON_TERMINATE = 1; + public static final int RESET_REASON_SIZE_CHANGED = 1 ...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/CaptureControl.java b/server/src/main/java/com/genymobile/scrcpy/video/CaptureControl.java new file mode 100644 index 0000000000..7933ea725f --- /dev/null +++ b/server/src/main/java/com/genymobile/scrcpy/video/CaptureControl.java @@ -0,0 +1,42 @@ +package co...
good
review_fixed
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -0,0 +1,43 @@ +package com.genymobile.scrcpy.display; + +import com.genymobile.scrcpy.util.Ln; + +public final class DisplayPropertiesTracker { + private DisplayProperties props; + + public synchronized void setCurrent(DisplayProperties props) { + this.props = props; + } + + /** + * Set the cu...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/display/DisplayPropertiesTracker.java b/server/src/main/java/com/genymobile/scrcpy/display/DisplayPropertiesTracker.java new file mode 100644 index 0000000000..adc606aafe --- /dev/null +++ b/server/src/main/java/com/genymobile/scrcpy/display/DisplayPropertiesTrack...
good
review_fixed
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -41,9 +41,11 @@ struct sc_screen { struct sc_texture tex; struct sc_input_manager im; struct sc_mouse_capture mc; // only used in mouse relative mode - struct sc_frame_buffer fb; struct sc_fps_counter fps_counter; + struct sc_mutex mutex;
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.h b/app/src/screen.h index 68b597d2c8..a8058d9ff7 100644 --- a/app/src/screen.h +++ b/app/src/screen.h @@ -22,6 +22,7 @@ #include "trait/key_processor.h" #include "trait/frame_sink.h" #include "trait/mouse_processor.h" +#include "util/thread.h" #ifdef __APPLE__ # define SC_DISPLAY_FOR...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -88,11 +88,15 @@ public void writePacket(ByteBuffer codecBuffer, MediaCodec.BufferInfo bufferInfo writePacket(codecBuffer, pts, config, keyFrame); } - public void writeSessionMeta(int width, int height) throws IOException { + public void writeSessionMeta(int width, int height, boolean clientRes...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/device/Streamer.java b/server/src/main/java/com/genymobile/scrcpy/device/Streamer.java index a00b0280aa..e793f67b54 100644 --- a/server/src/main/java/com/genymobile/scrcpy/device/Streamer.java +++ b/server/src/main/java/com/genymobile/scrcpy/device/Streamer.java @...
good
review_fixed
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -77,9 +77,9 @@ sc_demuxer_recv_header(struct sc_demuxer *demuxer, // // byte 0 byte 1 byte 2 byte 3 // 10000000 00000000 00000000 00000000 - // ^<--------------------------------> - // | padding - // `- session packet flag + // ^<------------------------------->^ + ...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/demuxer.c b/app/src/demuxer.c index 634b010fc9..f0709424d6 100644 --- a/app/src/demuxer.c +++ b/app/src/demuxer.c @@ -76,10 +76,10 @@ sc_demuxer_recv_header(struct sc_demuxer *demuxer, // which only contains a 12-byte header: // // byte 0 byte 1 byte 2 byte 3 - // 10000000 ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -85,6 +85,7 @@ arguments=( '--record-format=[Force recording format]:format:(mp4 mkv m4a mka opus aac flac wav)' '--record-orientation=[Set the record orientation]:orientation values:(0 90 180 270)' '--render-driver=[Request SDL to use the given render driver]:driver name:(direct3d opengl opengles2 op...
bad
review
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/data/zsh-completion/_scrcpy b/app/data/zsh-completion/_scrcpy index 8896e73839..a6dd68d9a0 100644 --- a/app/data/zsh-completion/_scrcpy +++ b/app/data/zsh-completion/_scrcpy @@ -87,6 +87,7 @@ arguments=( '--record-format=[Force recording format]:format:(mp4 mkv m4a mka opus aac flac wav)' '--...
good
review_fixed
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -778,6 +779,20 @@ static const struct sc_option options[] = { "\"opengles2\", \"opengles\", \"metal\" and \"software\".\n" "<https://wiki.libsdl.org/SDL_HINT_RENDER_DRIVER>", }, + { + .longopt_id = OPT_RENDER_FIT, + .longopt = "render-fit", + .argdesc = ...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/cli.c b/app/src/cli.c index 2cb0d3e23d..dbe264fcba 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -107,6 +107,7 @@ enum { OPT_NO_WINDOW_ASPECT_RATIO_LOCK, OPT_KEEP_ACTIVE, OPT_BACKGROUND_COLOR, + OPT_RENDER_FIT, }; struct sc_option { @@ -501,9 +502,12 @@ static const struct...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -1016,6 +1017,11 @@ static const struct sc_option options[] = { .text = "Set the initial window height.\n" "Default is 0 (automatic).", }, + { + .shortopt = 'x', + .longopt = "flex-display", + .text = "Continuously resize the virtual display to match the window....
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/cli.c b/app/src/cli.c index 2cb0d3e23d..dbe264fcba 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -107,6 +107,7 @@ enum { OPT_NO_WINDOW_ASPECT_RATIO_LOCK, OPT_KEEP_ACTIVE, OPT_BACKGROUND_COLOR, + OPT_RENDER_FIT, }; struct sc_option { @@ -501,9 +502,12 @@ static const struct...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -286,10 +286,27 @@ sc_screen_render(struct sc_screen *screen, bool update_content_rect) { } static void -sc_screen_on_resize(struct sc_screen *screen) { +sc_screen_on_resize(struct sc_screen *screen, const SDL_WindowEvent *event) { // This event can be triggered before the window is shown if (screen->w...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -286,10 +286,27 @@ sc_screen_render(struct sc_screen *screen, bool update_content_rect) { } static void -sc_screen_on_resize(struct sc_screen *screen) { +sc_screen_on_resize(struct sc_screen *screen, const SDL_WindowEvent *event) { // This event can be triggered before the window is shown if (screen->w...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -7,6 +7,7 @@ public class CaptureControl { public static final int RESET_REASON_TERMINATE = 1; public static final int RESET_REASON_SIZE_CHANGED = 1 << 1; public static final int RESET_REASON_CLIENT_RESET = 1 << 2; + public static final int RESET_REASON_CLIENT_RESIZED = 1 << 2;
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/video/CaptureControl.java b/server/src/main/java/com/genymobile/scrcpy/video/CaptureControl.java new file mode 100644 index 0000000000..7933ea725f --- /dev/null +++ b/server/src/main/java/com/genymobile/scrcpy/video/CaptureControl.java @@ -0,0 +1,42 @@ +package co...
good
review_fixed
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -128,7 +128,11 @@ private void streamCapture() throws IOException, ConfigurationException { } else { if (!captureControl.isResetRequested()) { // If a reset is requested during encode(), it will interrupt the encoding by an EOS
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 0333203e4d..be022fc97b 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -79,13 +83,30 @@ public NewDisplayCapture(VirtualDisplayListener vdListener, Options options) { this.angle = options.getAngle(); this.vdDestroyContent = options.getVDDestroyContent(); this.vdSystemDecorations = options.getVDSystemDecorations(); + this.flexDisplay = options.getFlexDi...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -103,16 +124,20 @@ protected void init() { @Override public void prepare() { + VideoConstraints constraints = getVideoConstraints(); + int displayRotation; if (virtualDisplay == null) { - if (!newDisplay.hasExplicitSize()) { + if (displaySize == null) { + ...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -124,8 +149,27 @@ public void prepare() { dpi = displayInfo.getDpi(); displayRotation = displayInfo.getRotation(); - // Align the physical display size to avoid unnecessary mismatches with the output size - displaySize = displayInfo.getSize().align(getVideoConstraint...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -124,8 +149,27 @@ public void prepare() { dpi = displayInfo.getDpi(); displayRotation = displayInfo.getRotation(); - // Align the physical display size to avoid unnecessary mismatches with the output size - displaySize = displayInfo.getSize().align(getVideoConstraint...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -257,4 +302,51 @@ private static int scaleDpi(Size initialSize, int initialDpi, Size size) { int num = size.getMax(); return initialDpi * num / den; } + + public synchronized void resizeDisplay(int width, int height) { + if (!flexDisplay) { + throw new IllegalStateExceptio...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -69,3 +69,25 @@ computer. To disable it: ```bash scrcpy --disable-screensaver ``` + + +## Render fit + +By default, the video stream is rendered in [letterbox] mode: the content fits +the window as best as possible while preserving the aspect ratio. + +For [flex displays], the display is continuously resized to m...
bad
review
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/doc/window.md b/doc/window.md index 9e0a34af39..349326ebe9 100644 --- a/doc/window.md +++ b/doc/window.md @@ -91,3 +91,24 @@ computer. To disable it: ```bash scrcpy --disable-screensaver ``` + + +## Render fit + +By default, the video stream is rendered in [letterbox] mode: the content fits +the window ...
good
review_fixed
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -85,16 +85,16 @@ public Size constrain(VideoConstraints constraints) { } public Size align(int alignment) { - int w = width / alignment * alignment; - int h = height / alignment * alignment; + int w = align(width, alignment); + int h = align(height, alignment);
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/model/Size.java b/server/src/main/java/com/genymobile/scrcpy/model/Size.java index 385597a8a2..63648a9e8f 100644 --- a/server/src/main/java/com/genymobile/scrcpy/model/Size.java +++ b/server/src/main/java/com/genymobile/scrcpy/model/Size.java @@ -32,6 +32,10 @@ pu...
good
review_fixed
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -158,17 +158,28 @@ sc_screen_is_relative_mode(struct sc_screen *screen) { static void compute_content_rect(struct sc_size render_size, struct sc_size content_size, - bool is_icon, SDL_FRect *rect) { - if (is_icon && content_size.width <= render_size.width + bool is_icon...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -192,16 +221,28 @@ public void startNew(Surface surface) { | VIRTUAL_DISPLAY_FLAG_DEVICE_DISPLAY_GROUP; } } - virtualDisplay = ServiceManager.getDisplayManager() + VirtualDisplay vd = ServiceManager.getDisplayManager() ...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -243,7 +284,7 @@ public void release() { if (virtualDisplay != null) { virtualDisplay.release(); - virtualDisplay = null; + setCurrentVirtualDisplay(null); }
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -257,4 +298,39 @@ private static int scaleDpi(Size initialSize, int initialDpi, Size size) { int num = size.getMax(); return initialDpi * num / den; } + + public void requestResize(int width, int height) { + if (!flexDisplay) { + throw new IllegalStateException("Cannot res...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -0,0 +1,73 @@ +package com.genymobile.scrcpy.display; + +import com.genymobile.scrcpy.model.Size; +import com.genymobile.scrcpy.util.Ln; + +public final class DisplayResizeDebouncer { + + private static final long DEBOUNCE_DELAY_MS = 300; + + public interface Callback { + void trigger(Size size); + }...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/display/DisplayResizeDebouncer.java b/server/src/main/java/com/genymobile/scrcpy/display/DisplayResizeDebouncer.java new file mode 100644 index 0000000000..0b961c6947 --- /dev/null +++ b/server/src/main/java/com/genymobile/scrcpy/display/DisplayResizeDebouncer.jav...
good
review_fixed
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -311,7 +318,20 @@ sc_screen_on_resize(struct sc_screen *screen, const SDL_WindowEvent *event) { assert(!(event->data2 & ~0xFFFF)); uint16_t width = event->data1; uint16_t height = event->data2; - sc_screen_request_resize_display(screen, width, height); + + ...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -13,6 +13,43 @@ scrcpy --new-display=/240 # use the main display size and 240 dpi The new virtual display is destroyed on exit. + +## Flex display + +To continuously resize the virtual display to match the window size, enable +"flex display" using `--flex-display` (or `-x`): + +```bash +# Start Android Setti...
bad
review
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/doc/virtual_display.md b/doc/virtual_display.md index 9f962127fd..4dec3e4607 100644 --- a/doc/virtual_display.md +++ b/doc/virtual_display.md @@ -13,6 +13,43 @@ scrcpy --new-display=/240 # use the main display size and 240 dpi The new virtual display is destroyed on exit. + +## Flex display + +To c...
good
review_fixed
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -103,29 +130,35 @@ protected void init() { @Override public void prepare() { + VideoConstraints constraints = getVideoConstraints(); + int displayRotation; if (virtualDisplay == null) { - if (!newDisplay.hasExplicitSize()) { + if (flexDisplay) { + ...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -52,49 +56,64 @@ public Size constrain(VideoConstraints constraints) { maxHeight = maxSize; }
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/server/src/main/java/com/genymobile/scrcpy/model/Size.java b/server/src/main/java/com/genymobile/scrcpy/model/Size.java index 385597a8a2..63648a9e8f 100644 --- a/server/src/main/java/com/genymobile/scrcpy/model/Size.java +++ b/server/src/main/java/com/genymobile/scrcpy/model/Size.java @@ -32,6 +32,10 @@ pu...
good
review_fixed
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -872,6 +997,19 @@ sc_screen_resize_to_fit(struct sc_screen *screen) { return; } + if (screen->render_fit == SC_RENDER_FIT_STRETCHED) { + // nothing to do + return; + } + + if (screen->render_fit == SC_RENDER_FIT_DISABLED) { + set_aspect_ratio(screen, screen->content_size...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -872,6 +997,22 @@ sc_screen_resize_to_fit(struct sc_screen *screen) { return; } + if (screen->render_fit == SC_RENDER_FIT_STRETCHED) { + // nothing to do + return; + } + + if (screen->render_fit == SC_RENDER_FIT_DISABLED) { + struct sc_size content_size = screen->content...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -103,29 +130,43 @@ protected void init() { @Override public void prepare() { + VideoConstraints constraints = getVideoConstraints(); + int displayRotation; if (virtualDisplay == null) { - if (!newDisplay.hasExplicitSize()) { - displaySize = mainDisplaySi...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -103,29 +130,43 @@ protected void init() { @Override public void prepare() { + VideoConstraints constraints = getVideoConstraints(); + int displayRotation; if (virtualDisplay == null) { - if (!newDisplay.hasExplicitSize()) { - displaySize = mainDisplaySi...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -3066,6 +3125,28 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[], return false; } + if (opts->flex_display) { + if (opts->video_source != SC_VIDEO_SOURCE_DISPLAY + || !opts->new_display) { + LOGE("-x/--flex-display can only be applied...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/cli.c b/app/src/cli.c index 2cb0d3e23d..dbe264fcba 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -107,6 +107,7 @@ enum { OPT_NO_WINDOW_ASPECT_RATIO_LOCK, OPT_KEEP_ACTIVE, OPT_BACKGROUND_COLOR, + OPT_RENDER_FIT, }; struct sc_option { @@ -501,9 +502,12 @@ static const struct...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -3066,6 +3125,28 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[], return false; } + if (opts->flex_display) { + if (opts->video_source != SC_VIDEO_SOURCE_DISPLAY + || !opts->new_display) { + LOGE("-x/--flex-display can only be applied...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/cli.c b/app/src/cli.c index 2cb0d3e23d..dbe264fcba 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -107,6 +107,7 @@ enum { OPT_NO_WINDOW_ASPECT_RATIO_LOCK, OPT_KEEP_ACTIVE, OPT_BACKGROUND_COLOR, + OPT_RENDER_FIT, }; struct sc_option { @@ -501,9 +502,12 @@ static const struct...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -139,9 +175,12 @@ public void prepare() { filter.addAngle(angle); Size outputSize = filter.getOutputSize(); - Size filteredSize = outputSize.constrain(getVideoConstraints()); - if (!filteredSize.equals(outputSize)) { - filter.addResize(filteredSize); + + if (!flexD...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -245,42 +244,55 @@ sc_screen_render(struct sc_screen *screen, bool update_content_rect) { SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); sc_sdl_render_clear(renderer); + float scale = SDL_GetWindowPixelDensity(screen->window); + if (scale == 0) { + // Just in case, but in practice the functio...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -221,42 +244,55 @@ sc_screen_render(struct sc_screen *screen, bool update_content_rect) { SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); sc_sdl_render_clear(renderer); + float scale = SDL_GetWindowPixelDensity(screen->window); + if (scale == 0) { + // Just in case, but in practice the functio...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -218,45 +243,48 @@ sc_screen_render(struct sc_screen *screen, bool update_content_rect) { } SDL_Renderer *renderer = screen->renderer; - SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0); + struct sc_screen_bg_color bg = screen->bg; + SDL_SetRenderDrawColor(renderer, bg.r, bg.g, bg.b, 0); sc_sdl...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -257,4 +319,44 @@ private static int scaleDpi(Size initialSize, int initialDpi, Size size) { int num = size.getMax(); return initialDpi * num / den; } + + public void requestResize(int width, int height) { + if (!flexDisplay) { + throw new IllegalStateException("Cannot res...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -150,59 +150,84 @@ get_initial_optimal_size(struct sc_size content_size, uint16_t req_width, return window_size; } +static inline void +sc_screen_track_resize(struct sc_screen *screen, struct sc_size size) { + LOGV("Track resize: %" PRIu16 "x%" PRIu16, size.width, size.height); + screen->resize_tracker...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -866,6 +1011,22 @@ sc_screen_resize_to_fit(struct sc_screen *screen) { return; } + if (screen->render_fit == SC_RENDER_FIT_STRETCHED) { + // nothing to do + return; + } + + if (screen->render_fit == SC_RENDER_FIT_UNSCALED) { + struct sc_size content_size = screen->conten...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -696,11 +828,13 @@ resize_for_content(struct sc_screen *screen, struct sc_size old_content_size, assert(screen->video); struct sc_size window_size = sc_sdl_get_window_size(screen->window);
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -696,11 +828,13 @@ resize_for_content(struct sc_screen *screen, struct sc_size old_content_size, assert(screen->video); struct sc_size window_size = sc_sdl_get_window_size(screen->window); - struct sc_size target_size = { - .width = (uint32_t) window_size.width * new_content_size.width - ...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/screen.c b/app/src/screen.c index b02629d716..5c280c7f1c 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -72,10 +72,10 @@ static bool is_optimal_size(struct sc_size current_size, struct sc_size content_size) { // The size is optimal if we can recompute one dimension of the current ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -257,4 +319,47 @@ private static int scaleDpi(Size initialSize, int initialDpi, Size size) { int num = size.getMax(); return initialDpi * num / den; } + + public void requestResize(int width, int height) { + if (!flexDisplay) { + throw new IllegalStateException("Cannot res...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -257,4 +319,47 @@ private static int scaleDpi(Size initialSize, int initialDpi, Size size) { int num = size.getMax(); return initialDpi * num / den; } + + public void requestResize(int width, int height) { + if (!flexDisplay) { + throw new IllegalStateException("Cannot res...
bad
review
java
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
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 e0ec2141fb..c1038c9302 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
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -76,10 +76,10 @@ sc_demuxer_recv_header(struct sc_demuxer *demuxer, // which only contains a 12-byte header: // // byte 0 byte 1 byte 2 byte 3 - // 10000000 00000000 00000000 00000000 - // ^<--------------------------------> - // | padding - // `- session packet flag ...
bad
review
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/app/src/demuxer.c b/app/src/demuxer.c index 634b010fc9..f0709424d6 100644 --- a/app/src/demuxer.c +++ b/app/src/demuxer.c @@ -76,10 +76,10 @@ sc_demuxer_recv_header(struct sc_demuxer *demuxer, // which only contains a 12-byte header: // // byte 0 byte 1 byte 2 byte 3 - // 10000000 ...
good
review_fixed
c
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
@@ -13,6 +13,43 @@ scrcpy --new-display=/240 # use the main display size and 240 dpi The new virtual display is destroyed on exit. + +## Flex display + +To continuously resize the virtual display to match the window size, enable +"flex display" using `--flex-display` (or `-x`): + +```bash +# Start Android Setti...
bad
review
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34
diff --git a/doc/virtual_display.md b/doc/virtual_display.md index 9f962127fd..4dec3e4607 100644 --- a/doc/virtual_display.md +++ b/doc/virtual_display.md @@ -13,6 +13,43 @@ scrcpy --new-display=/240 # use the main display size and 240 dpi The new virtual display is destroyed on exit. + +## Flex display + +To c...
good
review_fixed
Genymobile/scrcpy
1db8da559fd5b412b02b564e9ad40c2580bb9b34