Commit graph

435 commits

Author SHA1 Message Date
sergystepanov
042ecfa956 Use async audio converter 2026-07-05 14:30:04 +03:00
sergystepanov
a7c6aad065 Use concurrent-safe game lib iterators 2026-07-04 21:21:54 +03:00
sergystepanov
5b27963656 Fix race while room close || user add 2026-07-04 16:36:32 +03:00
sergystepanov
6d2ab88177 Com cleanup 2026-07-04 16:02:02 +03:00
sergystepanov
3ad7a00d72 Don't leak times in RPC 2026-07-03 19:32:58 +03:00
sergystepanov
0edba391f2 Reorder API struct fields for better alignment 2026-07-03 19:22:50 +03:00
sergystepanov
9d72022b57 Backoff with a 2x multiplier instead of exponential 2026-07-03 11:36:49 +03:00
sergystepanov
13852a725a Remove x/image dep 2026-07-02 21:31:33 +03:00
sergystepanov
00d93c0a00 Remove Prometheus metrics 2026-07-02 21:26:15 +03:00
sergystepanov
68ac6afab4 Switch to the more precise runtime.nanotime for frame timing 2026-07-02 21:26:13 +03:00
sergystepanov
f2cb7ebc7a Increase video channel buffer size to 3
In case if an encoder slower than 16ms.
2026-07-01 23:48:45 +03:00
sergystepanov
3018a7da0d Drop dlfcn dependency on Windows
Use direct syscalls instead. Needed for static builds.
2026-07-01 15:38:56 +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
04240aa855 Use sub-frame emulation precision 2026-06-27 14:56:50 +03:00
sergystepanov
8476600767 Hardcode audio codec to Opus in WebRTC connection 2026-06-13 20:25:33 +03:00
sergystepanov
cbbca28a19 Support array index notation in env var parsing 2026-06-13 18:30:52 +03:00
sergystepanov
e3b16d5feb Use client-side stream vertical flip
Previously we used zero-cost x264 `X264_CSP_VFLIP` and vpx
`vpx_img_flip` for OpenGL cores (which render their output buffers
upside down). Now the flip is handled client-side during GPU compositing
of the video stream.
This will be needed later, when we have to use more codecs and
Gstreamer.
2026-06-13 17:53:37 +03:00
sergystepanov
f55727a9c5 Use single 10ms frame for audio encoder for fewer fragments 2026-06-13 14:05:48 +03:00
sergystepanov
168bad0450 Use thread OS lock only with GL cores 2026-06-13 09:46:11 +03:00
sergystepanov
6ed3a1b0d0 Force keyframes during first 3 frames because user will see blanks til
kf
2026-06-12 18:18:14 +03:00
sergystepanov
adf67c035d Drain all VPx encoder packets and use zero-copy internal buffer 2026-06-12 16:56:17 +03:00
sergystepanov
10c2727a38 Move keyframe interval to common Video config and set it to 120 frames 2026-06-12 16:39:41 +03:00
sergystepanov
7ece426518 Fix missing codec params in the VPX struct 2026-06-11 22:04:34 +03:00
sergystepanov
9c42f1cc59 Retune VP8/VP9 codecs
Add new params
cpuUsed: 0
tileColumns: 0
tune: screen

In VP9 it will use multithreaded encoding now.

Keyframe interval was not set properly wasting bitrate. By default. It
is changed to 120 frames instead of 5.
2026-06-11 21:44:33 +03:00
sergystepanov
20ed20e22a Optimize keyboard state sync with one bulk CGO call
Instead of abusing 348 individual calls, we use just one
2026-06-11 14:25:58 +03:00
sergystepanov
16b9c179c8 Refactor webrtc module on the server
- Use unified ice/sdp signaling handlers;
- Set transceiver directions explicitly for performance.
2026-06-09 15:10:09 +03:00
sergystepanov
86ee0cb380 Create the main data channel without negotiation
There is no point in previously pushing or pulling this channel, since we won't change any of its configuration parameters.
2026-06-09 15:10:07 +03:00
sergystepanov
67cd92da6b Add IncludeLoopbackCandidate option 2026-06-08 16:47:31 +03:00
sergystepanov
14de2a1790 Disable automatic worker room assignment in busy rooms 2026-06-06 22:23:19 +03:00
sergystepanov
a4b4e0458f Unify all WebRTC signaling in the API
Users, workers, and the coordinator will now send WebRTC signaling
information through a single API endpoint with a unified structure. The
payload should contain either an sdp or ice field for further processing
by the designated handlers.

Replaced API endpoints:
  - (101) WebrtcOffer -> WebrtcSignal
    Removed API endpoints:
  - WebrtcAnswer (102)
  - WebrtcIce (103)
2026-06-06 18:19:07 +03:00
sergystepanov
f72202684f Remove Base64 encoding of wire data 2026-06-06 15:31:13 +03:00
sergystepanov
3388a0fbce Create data channels when pushed to the server 2026-06-05 14:46:55 +03:00
sergystepanov
d6f2cfc5ef Add the option switch for WebRTC initiator 2026-06-04 22:36:36 +03:00
sergystepanov
8c4b4bf96f Add an option for initiating WebRTC offer on the client side
WebRTC negotiation will start in the browser with an offer. Added because a reversed negotiation (server's offer) doesn't work in Firefox-based browsers.
2026-06-04 22:36:35 +03:00
sergystepanov
240147f8f1 Set sane ws default message size 2026-06-04 22:36:34 +03:00
sergystepanov
337bf6149c Add Trickle ICE support on the server 2026-06-04 22:36:32 +03:00
sergystepanov
4d5a1c7778 Remove INIT_WEBRTC API call 2026-06-04 22:36:31 +03:00
sergystepanov
e541f7e183 Add InitWebrtcStream API call 2026-06-04 22:36:31 +03:00
sergystepanov
4745b10572 Add remote and local ICE IP filters 2026-05-27 18:54:17 +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
1d5bae0c62 Add analog triggers and pack axes into atomic int64
- Pack 4 analog axes (LX, LY, RX, RY) into single int64 for atomic access
- Pack L2/R2 analog triggers into single int32
- Reduce memory per port from 20 to 16 bytes
- Reduce atomic stores per SetInput from 5 to 3
- Add RETRO_DEVICE_INDEX_ANALOG_BUTTON support for analog trigger queries
- Fallback to digital (0/0x7FFF) for non-trigger analog button queries

Wire format: [BTN:2][LX:2][LY:2][RX:2][RY:2][L2:2][R2:2] (14 bytes)
2025-12-29 20:20:55 +03:00
sergystepanov
368bae8c07 Swap mutex to atomics in keyboard input 2025-12-28 21:25:33 +03:00
sergystepanov
58a19affcb Clean SDL/OpenGL functions 2025-12-27 01:58:14 +03:00
sergystepanov
8754a5edfa Tweak OpenGL framebuffer
Force alignment for GL ReadPixels and skip unbinding last framebuffer which makes it a bit faster.
2025-12-26 16:17:37 +03:00
sergystepanov
aeb41008c9 Remove room watchers 2025-12-24 21:25:03 +03:00
sergystepanov
059e19d790 Remove com.Uid from the API 2025-12-24 21:23:19 +03:00
sergystepanov
94e13cb93b Clean api 2025-12-22 15:37:04 +03:00
sergystepanov
c800dd4bf9 Fix with go fix 2025-12-22 15:08:50 +03:00
sergystepanov
d45daeab7a Tweak room join/creation logic 2025-12-15 18:42:41 +03:00