Scrcpy: How to compile with -Dskip_frames=false?

Created on 29 May 2019  Â·  24Comments  Â·  Source: Genymobile/scrcpy

I saw on https://github.com/Genymobile/scrcpy/issues/244 there is a flag to disable the skipping of frames. However, when I use the command meson x -Dskip_frames=false and then compile, the resulting exe still skips frames. I also tried cd x and then ninja as well as meson x --reconfigure to no avail. Am I missing something obvious or does that no longer work? I am trying to compile the latest dev build for the lost focus bug fix if that makes a difference.

Most helpful comment

Between 1 and 5, with the occasional 6 or 7.

On Mon, 3 Jun 2019 at 16:31, Romain Vimont notifications@github.com wrote:
>

How many frames were skipped each second with skip_frames enabled?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

All 24 comments

the resulting exe still skips frames

How do you see that? If you show fps with Ctrl+i, does it still print "skipped frames" (sometimes)?

Yes, it still shows up as (+2 frames skipped). I assume I am missing something obvious and misconfiguring before compilation.

Do I need to do anything specific after running meson x -Dskip_frames=false

@BaconCatBug
Just ninja -Cx then ./run x to execute.

Ok I just compiled the latest dev build and I am still getting the +x Frames Skipped message when I press Control+i

I am running on windows and cross compiling on my Ubuntu laptop, both the 32 and 64 bit ones have the skipped frames.

This is very weird, I cannot reproduce.

If I pass -Dskip_frames=true or nothing, I have (+x frames skipped). If I pass -Dskip_frames=false, I don't.

What is the result of meson configure x?

https://pastebin.com/0ZbxBrHn

bcb@BCB-Laptop:~/Desktop/dev2$ meson x -Dskip_frames=false
The Meson build system
Version: 0.50.1
Source dir: /home/bcb/Desktop/dev2
Build dir: /home/bcb/Desktop/dev2/x
Build type: native build
Project name: scrcpy
Project version: 1.8
Native C compiler: cc (gcc 7.4.0 "cc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29.1)
Dependency libavformat found: YES 57.83.100
Dependency libavcodec found: YES 57.107.100
Dependency libavutil found: YES 55.78.100
Dependency sdl2 found: YES 2.0.8
Configuring config.h using configuration
Program ./scripts/build-wrapper.sh found: YES (/home/bcb/Desktop/dev2/server/./scripts/build-wrapper.sh)
DEPRECATION: build_always is deprecated. Combine build_by_default and build_always_stale instead.
Build targets in project: 7
Found ninja-1.8.2 at /usr/bin/ninja
bcb@BCB-Laptop:~/Desktop/dev2$ meson configure x
Core properties:
  Source dir /home/bcb/Desktop/dev2
  Build dir  /home/bcb/Desktop/dev2/x

Core options:
  Option          Current Value Possible Values                                          Description                                             
  ------          ------------- ---------------                                          -----------                                             
  auto_features   auto          [enabled, disabled, auto]                                Override value of all 'auto' features                   
  backend         ninja         [ninja, vs, vs2010, vs2015, vs2017, vs2019, xcode]       Backend to use                                          
  buildtype       debug         [plain, debug, debugoptimized, release, minsize, custom] Build type to use                                       
  debug           true          [true, false]                                            Debug                                                   
  default_library shared        [shared, static, both]                                   Default library type                                    
  install_umask   0022          [preserve, 0000-0777]                                    Default umask to apply on permissions of installed files
  layout          mirror        [mirror, flat]                                           Build directory layout                                  
  optimization    0             [0, g, 1, 2, 3, s]                                       Optimization level                                      
  strip           false         [true, false]                                            Strip targets on install                                
  unity           off           [on, off, subprojects]                                   Unity build                                             
  warning_level   1             [0, 1, 2, 3]                                             Compiler warning level to use                           
  werror          false         [true, false]                                            Treat warnings as errors                                
  wrap_mode       default       [default, nofallback, nodownload, forcefallback]         Wrap mode                                               

Backend options:
  Option            Current Value Possible Values Description                                                
  ------            ------------- --------------- -----------                                                
  backend_max_links 0             >=0             Maximum number of linker processes to run or 0 for no limit

Base options:
  Option      Current Value Possible Values                                               Description                                   
  ------      ------------- ---------------                                               -----------                                   
  b_asneeded  true          [true, false]                                                 Use -Wl,--as-needed when linking              
  b_colorout  always        [auto, always, never]                                         Use colored output                            
  b_coverage  false         [true, false]                                                 Enable coverage tracking.                     
  b_lto       false         [true, false]                                                 Use link time optimization                    
  b_lundef    true          [true, false]                                                 Use -Wl,--no-undefined when linking           
  b_ndebug    false         [true, false, if-release]                                     Disable asserts                               
  b_pch       true          [true, false]                                                 Use precompiled headers                       
  b_pgo       off           [off, generate, use]                                          Use profile guided optimization               
  b_pie       false         [true, false]                                                 Build executables as position independent     
  b_sanitize  none          [none, address, thread, undefined, memory, address,undefined] Code sanitizer to use                         
  b_staticpic true          [true, false]                                                 Build static libraries as position independent

Compiler options:
  Option      Current Value Possible Values                            Description                             
  ------      ------------- ---------------                            -----------                             
  c_args      []                                                       Extra arguments passed to the C compiler
  c_link_args []                                                       Extra arguments passed to the C linker  
  c_std       c11           [none, c89, c99, c11, gnu89, gnu99, gnu11] C language standard to use              

Directories:
  Option         Current Value        Description                            
  ------         -------------        -----------                            
  bindir         bin                  Executable directory                   
  datadir        share                Data file directory                    
  includedir     include              Header file directory                  
  infodir        share/info           Info page directory                    
  libdir         lib/x86_64-linux-gnu Library directory                      
  libexecdir     libexec              Library executable directory           
  localedir      share/locale         Locale data directory                  
  localstatedir  /var/local           Localstate data directory              
  mandir         share/man            Manual page directory                  
  prefix         /usr/local           Installation prefix                    
  sbindir        sbin                 System executable directory            
  sharedstatedir /var/local/lib       Architecture-independent data directory
  sysconfdir     etc                  Sysconf data directory                 

Project options:
  Option               Current Value Possible Values Description                                     
  ------               ------------- --------------- -----------                                     
  build_app            true          [true, false]   Build the client                                
  build_server         true          [true, false]   Build the server                                
  crossbuild_windows   false         [true, false]   Build for Windows from Linux                    
  hidpi_support        true          [true, false]   Enable High DPI support                         
  override_server_path                               Hardcoded path to find the server at runtime    
  prebuilt_server                                    Path of the prebuilt server                     
  skip_frames          false         [true, false]   Always display the most recent frame            
  windows_noconsole    false         [true, false]   Disable console on Windows (pass -mwindows flag)

Testing options:
  Option    Current Value Possible Values Description                                 
  ------    ------------- --------------- -----------                                 
  errorlogs true          [true, false]   Whether to print the logs from failing tests
  stdsplit  true          [true, false]   Split stdout and stderr in test logs        
bcb@BCB-Laptop:~/Desktop/dev2$

What is the result of:

ninja -Cx

and

cat x/app/config.h

?

https://pastebin.com/0PxUUVdV

bcb@BCB-Laptop:~/Desktop/dev2$ ninja -Cx
ninja: Entering directory `x'
[1/1] Generating scrcpy-server with a custom command.
> Task :server:preBuild UP-TO-DATE
> Task :server:preDebugBuild
> Task :server:compileDebugAidl
> Task :server:compileDebugRenderscript
> Task :server:checkDebugManifest
> Task :server:generateDebugBuildConfig
> Task :server:prepareLintJar UP-TO-DATE
> Task :server:generateDebugSources
> Task :server:javaPreCompileDebug
> Task :server:mainApkListPersistenceDebug
> Task :server:generateDebugResValues
> Task :server:generateDebugResources
> Task :server:mergeDebugResources
> Task :server:createDebugCompatibleScreenManifests
> Task :server:processDebugManifest
> Task :server:processDebugResources
> Task :server:compileDebugJavaWithJavac
> Task :server:compileDebugNdk NO-SOURCE
> Task :server:compileDebugSources
> Task :server:mergeDebugShaders
> Task :server:compileDebugShaders
> Task :server:generateDebugAssets
> Task :server:mergeDebugAssets
> Task :server:mergeExtDexDebug
> Task :server:mergeLibDexDebug
> Task :server:transformClassesWithDexBuilderForDebug
> Task :server:mergeProjectDexDebug
> Task :server:validateSigningDebug
> Task :server:signingConfigWriterDebug
> Task :server:mergeDebugJniLibFolders
> Task :server:transformNativeLibsWithMergeJniLibsForDebug
> Task :server:processDebugJavaRes NO-SOURCE
> Task :server:transformResourcesWithMergeJavaResForDebug
> Task :server:packageDebug
> Task :server:assembleDebug

BUILD SUCCESSFUL in 2s
27 actionable tasks: 26 executed, 1 up-to-date
bcb@BCB-Laptop:~/Desktop/dev2$ cat x/app/config.h
/*
 * Autogenerated by the Meson build system.
 * Do not edit, your changes will be lost.
 */

#pragma once

#define BUILD_DEBUG

#define DEFAULT_BIT_RATE 8000000

#define DEFAULT_LOCAL_PORT 27183

#define DEFAULT_MAX_SIZE 0

#define HIDPI_SUPPORT

#undef OVERRIDE_SERVER_PATH

#define PREFIX "/usr/local"

#define PREFIXED_SERVER_PATH "/share/scrcpy/scrcpy-server.jar"

#define SCRCPY_VERSION "1.8"

#undef SKIP_FRAMES

#undef WINDOWS_NOCONSOLE

bcb@BCB-Laptop:~/Desktop/dev2$
#undef SKIP_FRAMES

config.h is correctly included in fps_counter.h:
https://github.com/Genymobile/scrcpy/blob/8c8649cfcd710859ce18eab557ed2af8cedb9a42/app/src/fps_counter.h#L7

The code which prints (+x frames skipped) is in a #ifdef SKIP_FRAMES block:
https://github.com/Genymobile/scrcpy/blob/8c8649cfcd710859ce18eab557ed2af8cedb9a42/app/src/fps_counter.c#L31-L36

So it should not be executed (or even compiled) in your binary. The only reason I can think of is that you don't execute the correct binary. What command do you type to execute?

I run scrcpy -c 1080:1920:0:120 -m 1024 -b 20M on Windows 8.1 after compiling with make -f Makefile.CrossWindows

after compiling with make -f Makefile.CrossWindows

This generates the Windows release in dist/.

Yes, I know. I then transfer the zip to my windows machine and extract it, then run scrcpy.exe I am not running scrcpy on my Ubuntu laptop, although I will test it now actually to see if the linux version skips frames or not.

From the right directory? Do you have another scrcpy.exe somewhere accessible from your PATH?

What if you execute .\scrcpy.exe from your release directory?

I do not have any other scrcpy.exe in my path (scrcpy is not recognised).
Using the exe from the scrcpy-win64 folder instead of the zip is the same result, skipped frames.
The linux version works, no skipped frames.

Oh, ok, I get it. meson x/ninja -Cx is just for your local build.

Makefile.CrossWindows generates the release with its own build dir and configuration.

diff --git a/Makefile.CrossWindows b/Makefile.CrossWindows
index 0f7b14a..1e59969 100644
--- a/Makefile.CrossWindows
+++ b/Makefile.CrossWindows
@@ -57,6 +57,7 @@ build-win32: prepare-deps-win32
                        --buildtype release --strip -Db_lto=true \
                        -Dcrossbuild_windows=true \
                        -Dbuild_server=false \
+                       -Dskip_frames=false \
                        -Doverride_server_path=scrcpy-server.jar )
        ninja -C "$(WIN32_BUILD_DIR)"

@@ -67,6 +68,7 @@ build-win32-noconsole: prepare-deps-win32
                        --buildtype release --strip -Db_lto=true \
                        -Dcrossbuild_windows=true \
                        -Dbuild_server=false \
+                       -Dskip_frames=false \
                        -Dwindows_noconsole=true \
                        -Doverride_server_path=scrcpy-server.jar )
        ninja -C "$(WIN32_NOCONSOLE_BUILD_DIR)"
@@ -81,6 +83,7 @@ build-win64: prepare-deps-win64
                        --buildtype release --strip -Db_lto=true \
                        -Dcrossbuild_windows=true \
                        -Dbuild_server=false \
+                       -Dskip_frames=false \
                        -Doverride_server_path=scrcpy-server.jar )
        ninja -C "$(WIN64_BUILD_DIR)"

@@ -91,6 +94,7 @@ build-win64-noconsole: prepare-deps-win64
                        --buildtype release --strip -Db_lto=true \
                        -Dcrossbuild_windows=true \
                        -Dbuild_server=false \
+                       -Dskip_frames=false \
                        -Dwindows_noconsole=true \
                        -Doverride_server_path=scrcpy-server.jar )
        ninja -C "$(WIN64_NOCONSOLE_BUILD_DIR)"

Ah, thank you,

Adding those four -Dskip_frames=false \ to the Makefile.CrossWindows file has fixed the issue, it is now no longer skipping frames on Windows.

Thank you for your help and apologies for taking up your time!

You're welcome.

Do you see any difference in practice (except in the console)?

I do but it could be placebo for all I know. I'd need to do a proper side
by side with recording to be sure. Even so it's still a little choppier
than when I view the app on the phone but that might be down to my pretty
old CPU/GPU combo. (Which happens with or without the skipframes).

On Mon, 3 Jun 2019 at 16:27, Romain Vimont notifications@github.com wrote:

You're welcome.

Do you see any difference in practice (except in the console)?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Genymobile/scrcpy/issues/563?email_source=notifications&email_token=ABFLTCZIX4PPACNUKJJN7WTPYUZ5PA5CNFSM4HQOI4TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWZYPOA#issuecomment-498304952,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABFLTC5X4FNK3ZNPI23FON3PYUZ5PANCNFSM4HQOI4TA
.

How many frames were skipped each second with skip_frames enabled?

Between 1 and 5, with the occasional 6 or 7.

On Mon, 3 Jun 2019 at 16:31, Romain Vimont notifications@github.com wrote:
>

How many frames were skipped each second with skip_frames enabled?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

On dev branch, I replaced the compilation flag skip_frames by a runtime command-line parameter:

# equivalent to the old compilation option skip_frames=false
scrcpy --render-expired-frames

ebccb9f6cc111e8acfbe10d656cac5c1f1b744a0

Apologies for posting on a closed issue, but by replaced, you mean that if we're to run scrcpy without frame skips, we cannot compile it with the previous -Dskip_frames=false flag, so that it runs by default without frame skipping, and we absolutely have to use the new runtime command-line parameter?

I noticed that -Dskip_frames=false is a flag that's passed to mason, so I just edited the makefile to include -Dskip-frames=false on the build-win32/64 rules, including the no console ones, for a total of 4 times, to no avail, and then I found this thread. It would appear from the posts above that you had done something similar in an older version of scrcpy. I have pasted the makefile in a pastebin, if it helps: https://pastebin.com/KrHZpfSt

If we can only stop the frame skipping using that parameter, is it possible to make it so that it can read some sort of configuration file so that I don't have to run it from the command line every time?

Thank you for your time.

Just make a batch file or shell file to run the command with the parameters you want.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SuryaElavazhagan picture SuryaElavazhagan  Â·  4Comments

cordac1 picture cordac1  Â·  4Comments

BloodPHamtOm picture BloodPHamtOm  Â·  3Comments

behzadpooldar picture behzadpooldar  Â·  4Comments

targor picture targor  Â·  3Comments