Git Product home page Git Product logo

Comments (12)

bitfl0wer avatar bitfl0wer commented on June 15, 2024 1

Good luck :)

from chorus.

kozabrada123 avatar kozabrada123 commented on June 15, 2024

At least this is well documented

Some relevant info:

  • Encryption is done using xsalsa (specifically xsalsa20_poly1305, xsalsa20_poly1305_suffix or xsalsa20_poly1305_lite), I've found the easiest way to implement this is probably the RustCrypto secretbox crate (which already combines salsa20 with poly1305)
    (Also, Discord says they themselves use libsodium and secretbox is part of NaCl-compat, which is a rust implementation of libsodium's API)

  • Audio is encoded with the Opus open audio codec (stereo, @ 48kHz). For opus in rust, we can use opus-rs, which provides high level bindings for libopus, so we can just consult the official opus documentation

(for encryption, see this part of discord's docs)

The encryption and encoding seems to be the hardest part of implementing this, the actual communication is very similar to the gateway

from chorus.

kozabrada123 avatar kozabrada123 commented on June 15, 2024

Oh and we also have no info about video, so we should probably implement voice first

from chorus.

kozabrada123 avatar kozabrada123 commented on June 15, 2024

Doing some research, video uses VP8 and VP9, maybe env-libvpx-sys in rust?

{
	"codecs": [
		{
			"name": "opus",
			"type": "audio",
			"priority": 1000,
			"payload_type": 109,
			"rtx_payload_type": null
		},
		{
			"name": "VP8",
			"type": "video",
			"priority": 2000,
			"payload_type": 120,
			"rtx_payload_type": 124
		},
		{
			"name": "VP9",
			"type": "video",
			"priority": 3000,
			"payload_type": 121,
			"rtx_payload_type": 125
		}
	]
}

from chorus.

kozabrada123 avatar kozabrada123 commented on June 15, 2024

Webrtc-rs may also be worth looking into, since it seems to support all the needed codecs

from chorus.

kozabrada123 avatar kozabrada123 commented on June 15, 2024

Potentially maybe perhaps looking into this on feature/webrtc
I probably won't manage to implement it though lol

from chorus.

kozabrada123 avatar kozabrada123 commented on June 15, 2024

Also looking at how Serenity implemented this, they seem to have developed their own rtp parser and even their own opus bindings

from chorus.

bitfl0wer avatar bitfl0wer commented on June 15, 2024

I wonder if we could... yoink this :D

from chorus.

kozabrada123 avatar kozabrada123 commented on June 15, 2024

yup :D

from chorus.

kozabrada123 avatar kozabrada123 commented on June 15, 2024

Slight change of plans, raw UDP first then webrtc
because webrtc is really complex and raw udp seems to be way easier to implement for now

from chorus.

kozabrada123 avatar kozabrada123 commented on June 15, 2024

wasm cannot support udp.

from chorus.

kozabrada123 avatar kozabrada123 commented on June 15, 2024

See https://github.com/webrtc-rs/webrtc and https://github.com/wasm-peers/wasm-peers

from chorus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.