1. 03 3月, 2018 3 次提交
  2. 02 3月, 2018 3 次提交
  3. 01 3月, 2018 3 次提交
  4. 28 2月, 2018 5 次提交
    • R
      Terminate the server on stop · c78ad637
      Romain Vimont 提交于
      On user request to quit, two kinds of blocking calls must be interrupted
      on the server:
       1. the reads from and writes to the socket;
       2. the call to MediaCodec.dequeueOutputBuffer().
      
      The former case was handled by calling shutdown() on the socket from the
      client, but the latter was not managed.
      
      There is no easy way to wake this call properly, so just terminate the
      process from the client (i.e. send SIGTERM on Linux) instead.
      c78ad637
    • R
      Initialize eof flag from BufferInfo · b61310a2
      Romain Vimont 提交于
      Stop encoding if the codec signaled the end of stream.
      
      The eof flag was read, but never written.
      b61310a2
    • R
      Clean up the server from temporary folder · 221a7d08
      Romain Vimont 提交于
      The server is copied to /data/local/tmp/scrcpy-server.jar and executed
      on the device.
      
      As soon as we are connected, we can unlink (rm) it from /data/local/tmp,
      to keep the device clean.
      221a7d08
    • R
      Clean up useless const-casts · 08d32e3b
      Romain Vimont 提交于
      The function adb_execute() now expects a "const char *const *" parameter
      for the adb command, so there is no need to cast.
      08d32e3b
    • R
      Rename ScrCpyServer to Server · 487cb10c
      Romain Vimont 提交于
      The Server class is in package scrcpy, there is no need to repeat the
      name in the classname.
      487cb10c
  5. 16 2月, 2018 13 次提交
    • R
      Add missing .PHONY in portable Makefile · 0d050d83
      Romain Vimont 提交于
      The recipe "build-portable" is also the name of the generated directory.
      Add this name to the .PHONY list.
      0d050d83
    • R
      Rename SCRCPY_SERVER_JAR to SCRCPY_SERVER_PATH · 08937892
      Romain Vimont 提交于
      The server is currently a JAR, but it may ba an APK or a DEX, so the
      variable name should not contain the type.
      
      Rename the environment variable, the Meson options and the C
      definitions.
      08937892
    • R
      Reuse server address · 60f31851
      Romain Vimont 提交于
      Set SO_REUSEADDR flag to server socket, so that bind() does not fail if
      we restart scrcpy immediately after we closed the previous one.
      60f31851
    • R
      Log socket errors · 6db22ef3
      Romain Vimont 提交于
      Do not silently ignore close() and shutdown() errors, and use perror()
      to get the errno.
      6db22ef3
    • R
      Terminate event controller thread on EOF · 37af0c80
      Romain Vimont 提交于
      No exception was thrown on EOF, so the event controller did not
      terminate. This leaded to a further InvocationTargetException.
      
      Instead, terminate the event controller on EOF, so that the process
      terminates properly.
      37af0c80
    • R
      Terminate the device process gracefully · ad6209f6
      Romain Vimont 提交于
      Call shutdown() on the device socket to make the device process finish
      its execution quickly and gracefully, without killing it.
      ad6209f6
    • R
      Send and recv all data when necessary · a791c272
      Romain Vimont 提交于
      Expose net_recv_all() and net_send_all(), equivalent of net_recv() and
      net_send(), but that waits/retries until the requested length has been
      transferred.
      
      Use these new functions where it was (wrongly) assumed that the
      requested length had been transferred.
      a791c272
    • R
      Avoid division by 0 · d646f95a
      Romain Vimont 提交于
      If the frame_size width or height is 0, just return the current size to
      avoid calculations involving divison by 0.
      d646f95a
    • R
      Cleanup old code comment · 27b9159b
      Romain Vimont 提交于
      27b9159b
    • R
      Detect failure of device information read · cf59d49d
      Romain Vimont 提交于
      If the received data is smaller than the device information size, then
      something is wrong.
      cf59d49d
    • R
      Replace SDL_net by custom implementation · 9b056f50
      Romain Vimont 提交于
      SDL_net is not very suitable for scrcpy.
      
      For example, SDLNet_TCP_Accept() is non-blocking, so we have to wrap it
      by calling many SDL_Net-specific functions to make it blocking.
      
      But above all, SDLNet_TCP_Open() is a server socket only when no IP is
      provided; otherwise, it's a client socket. Therefore, it is not possible
      to create a server socket bound to localhost, so it accepts connections
      from anywhere.
      
      This is a problem for scrcpy, because on start, the application listens
      for nearly 1 second until it accepts the first connection, supposedly
      from the device. If someone on the local network manages to connect to
      the server socket first, then they can stream arbitrary H.264 video.
      This may be troublesome, for example during a public presentation ;-)
      
      Provide our own simplified API (net.h) instead, implemented for the
      different platforms.
      9b056f50
    • R
      Improve decoder stopped event · bf41e547
      Romain Vimont 提交于
      The syntax was correct, but less readable, and it unnecessarily zeroed
      the fields other than "type".
      
      Create the event properly, from a separate method.
      bf41e547
    • R
      Prevent new window opening with CreateProcess() · 518d6d5d
      Romain Vimont 提交于
      Executing commands (like "adb push") created a new terminal window on
      Windows. Avoid it.
      518d6d5d
  6. 15 2月, 2018 13 次提交
    • R
      Reword Ctrl+x description · e8cad790
      Romain Vimont 提交于
      Pressing Ctrl+x resizes the window to remove black borders, "optimal" is
      not well-defined.
      e8cad790
    • R
      Remove useless screen render on initialization · 5ebf31d4
      Romain Vimont 提交于
      screen_render() should not be called on initialization:
       1. it is useless, since the window is hidden until the first frame;
       2. it writes an empty texture (probably green) to the renderer.
      5ebf31d4
    • R
      Add Ctrl+i shortcut to enable/disable FPS counter · d9772022
      Romain Vimont 提交于
      Disable FPS counter on start, and use Ctrl+i to enable/disable it.
      d9772022
    • R
      Refactor screencontrol to inputmanager · 000ced9b
      Romain Vimont 提交于
      The "screen control" handled user input, which happened to be only
      used to control the screen.
      
      The controller and screen were passed to every function. Instead, group
      them in a struct input_manager.
      
      The purpose is to add a new shortcut to enable/disable FPS counter. This
      feature is not related to "screen control", and will require access to
      the "frames" instance.
      000ced9b
    • R
      Add description for meson options · fb0e4675
      Romain Vimont 提交于
      The descriptions are displayed in the result of:
      
          mesonconf builddir
      fb0e4675
    • R
      Expose skip_frames as a build option · 42882702
      Romain Vimont 提交于
      It can be initially configured by:
      
          meson builddir -Dskip_frames=false
      
      Or on an existing builddir by:
      
          mesonconf builddir -Dskip_frames=false
      42882702
    • R
      Add FPS counter · 38e66828
      Romain Vimont 提交于
      Remove frame counter from scrcpy.c and add a new FPS counter, logging as
      INFO the measured frame rate every second (on new frame).
      38e66828
    • R
      Do not print usage on command error · c6c17af8
      Romain Vimont 提交于
      On error, a message is printed. If we print usage afterwards, it's easy
      to miss it.
      c6c17af8
    • R
      Expose device serial as an optional argument · 86976598
      Romain Vimont 提交于
      The device serial was provided as a positional argument:
      
          scrcpy 0123456789abcdef
      
      Instead, expose it as an optional argument, -s or --serial:
      
          scrcpy -s 0123456789abcdef
      
      This avoids inconsistency between platforms when the positional
      argument is passed before the options (which is undefined).
      86976598
    • R
      Extract argument parsing to specific functions · 23d92a95
      Romain Vimont 提交于
      To avoid a big switch/case, implement the argument parsing logic in
      separate static functions.
      23d92a95
    • R
      Use SDL_bool return to indicate success · 111068d7
      Romain Vimont 提交于
      For clarity and consistency across the application, return SDL_TRUE
      (instead of 0) on success and SDL_FALSE on failure (instead of
      non-zero).
      111068d7
    • R
      Sort parameters by letter · d3c76c00
      Romain Vimont 提交于
      For readability, sort the command-line arguments parsing by letter.
      d3c76c00
    • R
      Add run script · 9a07b694
      Romain Vimont 提交于
      Add a script to simplify the execution of scrcpy generated in a specific
      build directory.
      
      To run scrcpy generated in builddir, with a video size of 1024:
      
          ./run builddir -m 1024
      9a07b694