1. 13 2月, 2018 1 次提交
  2. 12 2月, 2018 6 次提交
  3. 09 2月, 2018 19 次提交
    • R
      Properly clean up on exit · 0fce4f95
      Romain Vimont 提交于
      The SDL clean up does not crash anymore on exit, probably since the
      memory corruption caused by calling SDLNet_TCP_Close() too early has
      been resolved.
      0fce4f95
    • R
      Timeout the server socket connection · eb09fefd
      Romain Vimont 提交于
      Wait no more than 2 seconds for accepting the connection from the
      device, since it blocks the event loop, preventing to react to SIGTERM
      (Ctrl+C).
      eb09fefd
    • R
      Improve startup time · 90a46b4c
      Romain Vimont 提交于
      On startup, the client has to:
       1. listen on a port
       2. push and start the server to the device
       3. wait for the server to connect (accept)
       4. read device name and size
       5. initialize SDL
       6. initialize the window and renderer
       7. show the window
      
      From the execution of the app_process command to start the server on the
      device, to the execution of the java main method, it takes ~800ms. As a
      consequence, step 3 also takes ~800ms on the client.
      
      Once complete, the client initializes SDL, which takes ~500ms.
      
      These two expensive actions are executed sequentially:
      
                           HOST              DEVICE
      listen on port        |                  |
      push/start the server |----------------->|| app_process loads the jar
      accept the connection .   ^              ||
                            .   |              ||
                            .   | WASTE        ||
                            .   |  OF          ||
                            .   | TIME         ||
                            .   |              ||
                            .   |              ||
                            .   v              X execution of our java main
      connection accepted   |<-----------------| connect to the host
      init SDL             ||                  |
                           || ,----------------| send frames
                           || |,---------------|
                           || ||,--------------|
                           || |||,-------------|
                           || ||||,------------|
      init window/renderer  | |||||,-----------|
      display frames        |<++++++-----------|
      (many frames skipped)
      
      The rationale for step 3 occuring before step 5 is that initializing
      SDL replaces the SIGTERM handler to receive the event in the event loop,
      so pressing Ctrl+C during step 5 would not work (since it blocks the
      event loop).
      
      But this is not so important; let's parallelize the SDL initialization
      with the app_process execution (we'll just add a timeout to the
      connection):
      
                           HOST              DEVICE
      listen on port        |                  |
      push/start the server |----------------->||app_process loads the jar
      init SDL             ||                  ||
                           ||                  ||
                           ||                  ||
                           ||                  ||
                           ||                  ||
                           ||                  ||
      accept the connection .                  ||
                            .                  X execution of our java main
      connection accepted   |<-----------------| connect to the host
      init window/renderer  |                  |
      display frames        |<-----------------| send frames
                            |<-----------------|
      
      In addition, show the window only once the first frame is available to
      avoid flickering (opening a black window for 100~200ms).
      
      Note: the window and renderer are initialized after the connection is
      accepted because they use the device information received from the
      device.
      90a46b4c
    • R
      Turn screen on in control() · 063cfd13
      Romain Vimont 提交于
      Turning the screen on is semantically associated to control(): only
      creating the EventController object should not turn the screen on.
      063cfd13
    • R
      Provide decoder_init() · 523097ea
      Romain Vimont 提交于
      Expose an initializer so that the caller does not have to guess what
      fields must be initialized.
      523097ea
    • R
      Do not release TCP sockets while still in use · 46621982
      Romain Vimont 提交于
      SDLNet_TCP_Close() not only closes, but also release the resources.
      
      Therefore, we must not close the socket if another thread attempts to
      read it.
      
      For that purpose, move socket closing from server_stop() to
      server_destroy().
      46621982
    • R
      Enable sanitizer in debug builds · d658586d
      Romain Vimont 提交于
      "make build-debug" will build with ASAN and USAN enabled.
      d658586d
    • R
      Move frame updating to screen.c · fe21d9df
      Romain Vimont 提交于
      Replace screen_update() by a higher-level screen_update_frame() handling
      the whole frame updating, so that scrcpy.c just call it without managing
      implementation details.
      fe21d9df
    • R
      Kill the server immediately on close · 7458d827
      Romain Vimont 提交于
      Do not wait 100ms anymore to let the server print any exception: we
      justly want to ignore them.
      
      Moreover, there is no nanosleep() on Windows, so this solve another
      problem.
      7458d827
    • R
      Avoid server stacktraces on close · c683872b
      Romain Vimont 提交于
      On close, the socket is closed by the client, and the server process is
      killed.
      
      This leads to (expected) exceptions, that should not be printed.
      c683872b
    • R
      Do not try to decode video when EOF is reached · 2fdc368c
      Romain Vimont 提交于
      When the video stream socket is closed and read_packey() returns -1,
      av_read_frame() still returns 0.
      
      To detect EOF, check the flag eof_reached in the AVIOContext.
      
      This avoids garbage errors on closing.
      2fdc368c
    • R
      Send "screen on" command only on mouse down · a8aa3d39
      Romain Vimont 提交于
      Avoid to send the command twice, once on mouse down, once on mouse up.
      a8aa3d39
    • R
      Fix deadlock on exit if SKIP_FRAMES disabled · 127e5678
      Romain Vimont 提交于
      On exit, the renderer will not consume frames anymore, so signal the
      condition variable to wake up the decoder.
      127e5678
    • R
      Move frame swapping logic to frame.c · 629c2962
      Romain Vimont 提交于
      Expose frames_offer_decoded_frame() and frames_consume_rendered_frame()
      so that callers are not exposed to frame swapping (between the decoding
      and rendering frames) details.
      629c2962
    • R
      Unlock mutex on screen update failure · 0d7f0503
      Romain Vimont 提交于
      The mutex was not unlocked on all code paths.
      0d7f0503
    • R
      Move control-related code to screencontrol.c · e8dfb723
      Romain Vimont 提交于
      Move the code handling user input from scrcpy.c to a separate file,
      screencontrol.c.
      e8dfb723
    • R
      Remove the "adb reverse" tunnel immediately · e1749a0c
      Romain Vimont 提交于
      As soon as we accepted a connection, we can remove the "adb reverse"
      tunnel.
      e1749a0c
    • R
      Move device-related code to device.c · 3b06e7d5
      Romain Vimont 提交于
      Move the code to read the initial device info from scrcpy.c to a
      separate file, device.c.
      3b06e7d5
    • R
      Move server-related code to server.c · 28c5cc03
      Romain Vimont 提交于
      The file server.c already existed, but exposed a low-level API. Make it
      higher-level, so that scrcpy.c does not handle server details directly.
      28c5cc03
  4. 08 2月, 2018 8 次提交
  5. 07 2月, 2018 6 次提交