Commit graph

89 commits

Author SHA1 Message Date
sergystepanov
67cd1e211e Clean up Dockerfile dependencies 2026-07-04 20:02:07 +03:00
sergystepanov
9197fabeda Fix 'Skip APT docs and locales in Docker builds' 2026-07-04 19:02:33 +03:00
sergystepanov
bae5dcceda Skip APT docs and locales in Docker builds 2026-07-04 18:57:25 +03:00
sergystepanov
dfb78c458d Replace SDL2 with lightweight RGFW-like GL/Window helper lib 2026-06-29 23:24:09 +03:00
sergystepanov
728b2a49f0
Add GStreamer (#504)
Old media pipe was replaced with GStreamer (go-gst). It is now possible
to change encoders to any supported by GStreamer, provided the necessary
plugins are installed on the system where cloud-retro is running. See
params in config.go.
2026-06-28 22:20:31 +03:00
sergystepanov
1ab2cb7693 Update dependencies 2026-05-10 20:44:42 +03:00
sergystepanov
bde1fdab9c Optimize Dockerfile layering 2026-05-01 14:49:29 +03:00
sergystepanov
4c8a54b8f2 Update to ubuntu:plucky
Use the dynamic x264 library because the static libx264.a was removed from the packages in the latest Ubuntu.
2026-05-01 11:30:02 +03:00
sergystepanov
d765de14dc Update to Go 1.26.0 2026-02-11 22:34:49 +03:00
sergystepanov
dc56c70acf Update to Go 1.26 2026-02-11 22:30:01 +03:00
sergystepanov
7c91d200e4 Update Go version to 1.26rc1 2025-12-17 23:12:50 +03:00
sergystepanov
9d54ea4c49 Add and use Speex audio resampler 2025-12-14 16:24:35 +03:00
sergystepanov
efa7a1d7b5 Update outdated Docker build 2025-11-21 20:44:27 +03:00
sergystepanov
6b0d7c0ce1 Update Go to 1.25.0 2025-08-15 14:51:20 +03:00
sergystepanov
a431b7050f Update dependencies 2025-04-17 09:11:26 +03:00
sergystepanov
7c878b1ee3 Update dependencies 2025-04-17 09:11:26 +03:00
sergystepanov
15ff2f3282 Update Go to 1.24.0 2025-02-12 14:17:43 +03:00
Sergey Stepanov
56e3ce328e
Update Go to 1.23.3 2024-11-30 21:35:40 +03:00
Sergey Stepanov
763f1e5d11
Update Ubuntu Docker container 2024-09-29 23:32:32 +03:00
Sergey Stepanov
16cf91f669
Update Ubuntu Docker container 2024-09-29 23:06:26 +03:00
Sergey Stepanov
dea9926e4f
Update Go version to 1.23.0 2024-08-15 15:44:56 +03:00
Sergey Stepanov
61eb55f736
Update Go version to 1.22.6 2024-08-11 13:38:42 +03:00
Sergey Stepanov
3989a735ac
Update dependencies 2024-05-20 22:46:59 +03:00
Sergey Stepanov
b530f7a6cf
Add curl to worker containers 2024-05-07 15:54:42 +03:00
Sergey Stepanov
ccb0f410ab Revert "Revert Go version back to 1.20"
This reverts commit 1a44b94c85.
2024-02-10 21:13:49 +03:00
Sergey Stepanov
1a44b94c85
Revert Go version back to 1.20
Go 1.22 crashes under Windows with h264 encoder.
2024-02-08 16:38:40 +03:00
Sergey Stepanov
610e087bcd Update to Go 1.22.0 2024-02-07 11:55:40 +03:00
Sergey Stepanov
9c768277c7 Use sudo static Docker builds 2023-10-17 19:23:00 +03:00
Sergey Stepanov
b1b33713d6 Add the initial libyuv support
The main benefit of libyuv, apart from shortening the video pipeline, is quite noticeable latency and CPU usage decrease due to various assembler/SIMD optimizations of the library. However, there is a drawback for macOS systems: libyuv cannot be downloaded as a compiled library and can only be built from the source, which means we should include a cropped source code of the library (~10K LoC) into the app or rise the complexity of macOS dev and run toolchains. The main target system -- Linux, and Windows will use compiled lib from the package managers and macOS will use the lib included as a shortened source-code.

Building the app with the no_libyuv tag will force it to use libyuv from the provided source files.
2023-10-15 18:55:53 +03:00
Sergey Stepanov
240a1f92ce
Use Go 1.20.7 with Docker builds 2023-08-09 19:55:44 +03:00
Sergey Stepanov
b2e4848ed3
Update to Go 1.21.0 2023-08-09 19:08:25 +03:00
Sergey Stepanov
167071af6f
Update Dockerfile 2023-05-16 14:53:20 +03:00
Sergey Stepanov
1dc0cabc2b Add special Dockerfile for tiny coordinator (<10Mib) and worker (<150Mib) containers 2023-05-12 14:31:21 +03:00
Sergey Stepanov
b227260060 Embed config.yaml into both apps 2023-05-12 14:31:21 +03:00
Sergey Stepanov
62fc68e88b
Add optional static linking with vpx, x264, opus 2023-04-24 00:16:00 +03:00
Sergey Stepanov
ece1efad16
Add optional static linking with vpx, x264, opus 2023-04-23 23:51:38 +03:00
Sergey Stepanov
9bb0c151a9
Compress apps for Docker 2023-04-23 20:49:29 +03:00
Sergey Stepanov
df980c5cf4
Update versions 2023-04-20 14:19:40 +03:00
Sergey Stepanov
256896df52
Try new Ubuntu Lunar as a base Docker image 2023-04-07 22:25:41 +03:00
sergystepanov
cfd5b1ae8d
Libretro cores config in yaml (#392)
Removes separate config files for Libretro cores stored in the cores folder and replaces them with options in the main config.yaml file.
2023-04-06 11:25:49 +03:00
Sergey Stepanov
c797365641
Fix Dockerfile 2023-04-02 22:32:14 +03:00
Sergey Stepanov
99687a1c28
Add precreated dirs to Dockerfile 2023-04-02 22:12:55 +03:00
Sergey Stepanov
8006939d69
Update versions 2023-02-04 22:54:18 +03:00
sergystepanov
3bd959b4ef
Refactored v3 (#350)
This PR contains refactored code.

**Changelog**
- Added new net code (the communication architecture was left intact).
- All network client IDs now have custom type `network.Uid` backed by github.com/rs/xid lib.
  ```
  The string representation of a UUID takes 32 bytes, and the new type will take just 16.
  Because of Golang JSON serialization problems with omitting zero-length empty slices (it can't) 
  and the need to use UID values as map keys (maps don't support slices as keys), 
  IDs are stored as strings (for now).
  ```
- A whole new WebSocket client/server implementation was added, as well as a new communication layer with synchronous and async call handlers.
  - WebSocket connections now support dedicated Ping/Pong frames as opposed to original ping text messages.
  - Used Gorilla WebSocket library doesn't allow concurrent (simultaneous) reads and writes, so this part was handled via send channel synchronization.
- New API structures can be found in the `pkg/api` folder.
- New communication protocol can be found in the `pkg/com/*` folder.
- Updated communication protocol is based on JSON-encoded messaging through WebSocket and has the following structure:
  ```
  Packet
    [id] string — a globally unique identification tag for the packet to track it trough a chain of requests.
    t uint8 — contains packet type information (i.e. INIT_PACKET, SDP_OFFER_PACKET, ...).
    [p] any — contains packet data (any type).

  Each packet is a text message in JSON-serialized form (WebSocket control frames obviously not).
  ```
  ```
  The main principle of this protocol and the duplex data exchange is:
  the one who initializes connection is called a client, and 
  the one who is being connected to is called a server. 
  With the current architecture, the coordinator is the server, the user browsers and workers are the clients.

            ____           ____
           ↓    ↑         ↑    ↓
     browser ⟶ coordinator ⟵ worker
       (c)          (s)         (c)

  One of the most crucial performance vise parts of these interactions is that 
  all the server-initiated calls to clients should be asynchronous!
  ```
  - In order to track synchronous calls (packets) with an asynchronous protocol, such as WebSocket, each packet may have an `id` that should be copied in all subsequent requests/responses.
  - The old `sessionID` param was replaced by `id` that should be stored inside the `p` (payload) part of the packet.
- It is possible to skip the default ping check for all connected workers on every user connection and just pick the first available with the new roundRobin param in the coordinator config file `coordinator.roundRobin: true/false`.
- Added a dedicated package for the system API (pkg/api/*).
- Added structured logging system (zerolog) for better logging and cloud services integration.
- Added a visual representation of the network message exchange in logs:
  ```
  ...
  01:00:01.1078 3f98 INF w → c Handshake ws://localhost:8000/wso
  01:00:01.1138  994 INF c ← w Handshake localhost:8000
  01:00:01.1148  994 INF c ← w Connect cid=cep.hrg
  01:00:01.1158  994 DBG c     connection id has been changed to cepl7obdrc3jv66kp2ug cid=cep.hrg
  01:00:01.1158 3f98 INF w → c Connect cid=cep.2ug
  01:00:01.1158  994 INF c     New worker / addr: localhost, ...
  01:00:01.1158 3f98 INF w     Connected to the coordinator localhost:8000 cid=cep.2ug
  01:00:02.5834  994 INF c ← u Handshake localhost:8000
  01:00:02.6175  994 INF c ← u Connect cid=cep.hs0
  01:00:02.6209  994 INF c     Search available workers cid=cep.hs0
  01:00:02.6214  994 INF c     Found next free worker cid=cep.hs0
  01:00:02.6220  994 INF c → u InitSession cid=cep.hs0
  01:00:02.6527  994 INF c ← u WebrtcInit cid=cep.hs0
  01:00:02.6527  994 INF c → w ᵇWebrtcInit cid=cep.hrg
  01:00:02.6537 3f98 INF w ← c WebrtcInit cid=cep.2ug
  01:00:02.6537 3f98 INF w     WebRTC start cid=cep.2ug
  ...
  ```
- Replaced a monstrous Prometheus metrics lib.
- Removed spflag dependency.
- Added new `version` config file param/constant for compatibility reasons.
- Bump the minimum required version for Go to 1.18 due to use of generics.
- Opus encoder now is cached and the default config is 96Kbps, complexity 5 (was 196Kbps, 8).
- Changed the default x264 quality parameters to `crf 23 / superfast / baseline` instead of `crf 17 / veryfast / main`.
- Added a separate WebRTC logging config param `webrtc.logLevel`.
- Worker now allocates much less memory.
- Optimized and fixed RGB to YUV converter.
- `--v=5` logging cmd flag was removed and replaced with the `debug` config parameter.


**Breaking changes (migration to v3)**
- Coordinator server API changes, see web/js/api/api.js.
- Coordinator client event API changes:
  - c `GAME_PLAYER_IDX_CHANGE` (string) -> `GAME_PLAYER_IDX` (number)
  - c `GAME_PLAYER_IDX` -> `GAME_PLAYER_IDX_SET`
  - c `MEDIA_STREAM_INITIALIZED` -> `WEBRTC_NEW_CONNECTION`
  - c `MEDIA_STREAM_SDP_AVAILABLE` -> `WEBRTC_SDP_OFFER`
  - c `MEDIA_STREAM_CANDIDATE_ADD` -> `WEBRTC_ICE_CANDIDATE_RECEIVED`
  - c `MEDIA_STREAM_CANDIDATE_FLUSH` -> `WEBRTC_ICE_CANDIDATES_FLUSH`
  - x `MEDIA_STREAM_READY` -> **removed**
  - c `CONNECTION_READY` -> `WEBRTC_CONNECTION_READY`
  - c `CONNECTION_CLOSED` -> `WEBRTC_CONNECTION_CLOSED`
  - c `GET_SERVER_LIST` -> `WORKER_LIST_FETCHED`
  - x `KEY_STATE_UPDATED` -> **removed**
  - n `WEBRTC_ICE_CANDIDATE_FOUND`
  - n `WEBRTC_SDP_ANSWER`
  - n `MESSAGE`
- `rtcp` module renamed to `webrtc`.
- Controller state equals Libretro controller state (changed order of bits), see: web/js/input/input.js.
- Added new `coordintaor.selector` config param that changes the selection algorithm for workers. By default it will select any free worker. Set this param to `ping` for the old behavior.
- Changed the name of the `webrtc.iceServers.url` config param to `webrtc.iceServers.urls`.
2023-01-09 23:20:22 +03:00
Sergey Stepanov
242b8f0a1f
Update Go version to 1.18 for builds 2022-03-21 12:15:14 +03:00
sergystepanov
66a13943bc
Upgrade Go version to 1.17 (#345) 2021-08-17 11:41:14 +03:00
Sergey Stepanov
fd3f267c64
Update scripts
Docker cache order.
Install missing xauth for xvfb-run.
2021-08-15 20:29:45 +03:00
sergystepanov
30d104ee98
Add version info into the apps (#330)
Both worker and coordinator display version number in the console during startup. Coordinator displays its version number in the top right corner of the index.html page.
2021-07-16 18:13:20 +03:00
sergystepanov
65dcaf7820
Enable release builds with v-tags (#310)
Re-enable release builds push into Github releases page when new v-prefixed tags are pushed (i.e. v2.4.2).
2021-04-07 18:50:34 +03:00
sergystepanov
602b9ea47c
Make executables ready for static linking (#307)
* Disable CGO (C libs) for coordinator

Needed for static linking.

* Fix "error strings should not be capitalized (ST1005)"

* Fix SA1015

Using time.Tick leaks the underlying ticker, consider using it only in endless functions, tests and the main package, and use time.NewTicker here (SA1015)

* Fix SA9004

Only the first constant in this group has an explicit type (SA9004).

* Remove unused code in the webrtc package

* Fix S1000

Should use a simple channel send/receive instead of select with a single case (S1000).

* Force dir creation/check for core downloader

* Update Makefile release script

* Disable ASLR for worker builds

* Remove WORKER_BUILD_PARAMS flag from the CI

* Don't force recompilation in release

* Add Debian packages installer script

* Build worker app without libopusfile

* Test worker app without libopusfile

* Add opus wrapper without opusfile

* Make install.sh executable

* Add opus lib in Win builds

* Make insecure HTTPS requests when downloading libs

* Add ca-certificates for Docker build stage

go mod download works only with SSL certificates installed.

* Move libx264 wrapper into the repo

That way we can get rid of a lot of not needed external Go dependencies.

* Update the dependencies
2021-04-06 18:16:52 +03:00