From a1802dab763d5031bc26576e45ab1d388a8904fc Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 18 Feb 2023 18:21:14 +0100 Subject: [PATCH] Remove default bit-rate on client side If no bit-rate is passed, let the server use the default value (8Mbps). This avoids to define a default value on both sides, and to pass the default bit-rate as an argument when starting the server. PR #3757 --- app/meson.build | 4 ---- app/scrcpy.1 | 2 +- app/src/cli.c | 2 +- app/src/options.c | 2 +- app/src/server.c | 4 +++- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/meson.build b/app/meson.build index b6a772a9..2ea3b317 100644 --- a/app/meson.build +++ b/app/meson.build @@ -195,10 +195,6 @@ conf.set('PORTABLE', get_option('portable')) conf.set('DEFAULT_LOCAL_PORT_RANGE_FIRST', '27183') conf.set('DEFAULT_LOCAL_PORT_RANGE_LAST', '27199') -# the default video bitrate, in bits/second -# overridden by option --bit-rate -conf.set('DEFAULT_BIT_RATE', '8000000') # 8Mbps - # run a server debugger and wait for a client to be attached conf.set('SERVER_DEBUGGER', get_option('server_debugger')) diff --git a/app/scrcpy.1 b/app/scrcpy.1 index 0f1147da..186d8ad5 100644 --- a/app/scrcpy.1 +++ b/app/scrcpy.1 @@ -23,7 +23,7 @@ Make scrcpy window always on top (above other windows). .BI "\-b, \-\-bit\-rate " value Encode the video at the given bit\-rate, expressed in bits/s. Unit suffixes are supported: '\fBK\fR' (x1000) and '\fBM\fR' (x1000000). -Default is 8000000. +Default is 8M (8000000). .TP .BI "\-\-codec " name diff --git a/app/src/cli.c b/app/src/cli.c index 4f023da0..d7a0a7ae 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -107,7 +107,7 @@ static const struct sc_option options[] = { .argdesc = "value", .text = "Encode the video at the given bit-rate, expressed in bits/s. " "Unit suffixes are supported: 'K' (x1000) and 'M' (x1000000).\n" - "Default is " STR(DEFAULT_BIT_RATE) ".", + "Default is 8M (8000000).", }, { .longopt_id = OPT_CODEC, diff --git a/app/src/options.c b/app/src/options.c index 0854067f..64ec5b3b 100644 --- a/app/src/options.c +++ b/app/src/options.c @@ -28,7 +28,7 @@ const struct scrcpy_options scrcpy_options_default = { .count = 2, }, .max_size = 0, - .bit_rate = DEFAULT_BIT_RATE, + .bit_rate = 0, .max_fps = 0, .lock_video_orientation = SC_LOCK_VIDEO_ORIENTATION_UNLOCKED, .rotation = 0, diff --git a/app/src/server.c b/app/src/server.c index 88e3421f..6bf0eb6e 100644 --- a/app/src/server.c +++ b/app/src/server.c @@ -215,8 +215,10 @@ execute_server(struct sc_server *server, ADD_PARAM("scid=%08x", params->scid); ADD_PARAM("log_level=%s", log_level_to_server_string(params->log_level)); - ADD_PARAM("bit_rate=%" PRIu32, params->bit_rate); + if (params->bit_rate) { + ADD_PARAM("bit_rate=%" PRIu32, params->bit_rate); + } if (!params->audio) { ADD_PARAM("audio=false"); }