* Fixing edge cases in picture id munging.
Changes
1. Check the RTP sequence number order before VP8 temporal layer
filtering and use that ordering result while doing temporal
layer filtering.
In a sequence like below
o Packet 10 -> Picture ID 10
o Packet 11 -> missing
o Packet 12 -> Picture ID 11
it is not known if packet 11 will belong to Picture ID 10 or
Picture ID 11. The problem becomes a lot more tricky if there
is a burst loss and there is a larger hole in the picture id
space also as a result.
So, in the event of a packet loss, forward even if the current
packet belongs to a layer that can be dropped. More comments
in code.
2. Use result of sequence number ordering check while doing VP8 picture id munging.
3. When adding to missing picture id cache, have to include picture ids including
both ends. As a picture can span multiple packets and it is not known which
picture the packet belongs to, have to include both ends also in missing
picture id cache in the event of a gap.
4. As a picture can span multiple packets, it is not possible to have a simple
map of missing picture ids as an entry cannot be deleted if an out-of-order
picture id is received. There may be more missing packets belonging to that
picture id that is yet to be received.
So, have to use an ordered map and truncate the map if it grows too large.
Picked this for ordered map - https://github.com/elliotchance/orderedmap.
Has a simple API, had the highest number of stars of all the ones I checked.
And there are benchmarks.
The author also wrote a medium post at https://medium.com/swlh/an-ordered-map-in-go-436634692381
Another one which I looked at is - https://github.com/wk8/go-ordered-map.
The author of that wrote at https://morioh.com/p/990229f32171 and has a
bunch of other options at the end of that post (but does not include the
one I picked above). None of those have that many stars.
Testing:
--------
- Set max temporal layers to 0 so that temporal filtering happens and run for
an hour on sample app.
* do not let padding packets through VP8
* Correct comment
* fix comment
* Review comments from Jie
* golang naming convention
LiveKit - Open source, distributed video/audio rooms over WebRTC
LiveKit is an open source project that provides scalable, multi-user conferencing over WebRTC. It's designed to give you everything you need to build real time video/audio capabilities in your applications.
Features
- Horizontally scalable WebRTC Selective Forwarding Unit (SFU)
- Modern, full-featured client SDKs for JS, iOS, Android, and Flutter
- Built for production - JWT authentication and server APIs
- Robust networking & connectivity, over UDP & TCP
- Easy to deploy - pure Go & single binary
- Advanced features - speaker detection, simulcast, selective subscription, moderation APIs, and webhooks.
Documentation & Guides
Docs & Guides at: https://docs.livekit.io
Try it live
Head to our playground and give it a spin. Build a Zoom-like conferencing app in under 100 lines of code!
SDKs & Tools
Client SDKs:
Server SDKs:
- Javascript (docs)
- Go (docs)
Tools:
Installing
From source
Pre-requisites:
- Go 1.15+ is installed
- GOPATH/bin is in your PATH
Then run
git clone https://github.com/livekit/livekit-server
cd livekit-server
./bootstrap.sh
mage
Docker
LiveKit is published to Docker Hub under livekit/livekit-server
Running
Creating API keys
LiveKit utilizes JWT based access tokens for authentication to all of its APIs. Because of this, the server needs a list of valid API keys and secrets to validate the provided tokens. For more, see Access Tokens guide.
Generate API key/secret pairs with:
./bin/livekit-server generate-keys
or
docker run --rm livekit/livekit-server generate-keys
Store the generate keys in a YAML file like:
APIwLeah7g4fuLYDYAJeaKsSE: 8nTlwISkb-63DPP7OH4e.nw.J44JjicvZDiz8J59EoQ+
Starting the server
In development mode, LiveKit has no external dependencies. You can start LiveKit by passing it the keys it should use in LIVEKIT_KEYS.
LiveKit could also use a config file or config environment variable LIVEKIT_CONFIG
LIVEKIT_KEYS="<key>: <secret>" ./bin/livekit-server --dev
or
docker run --rm \
-p 7880:7880 \
-p 7881:7881 \
-p 7882:7882/udp \
-e LIVEKIT_KEYS="<key>: <secret>" \
livekit/livekit-server \
--dev \
--node-ip=<machine-ip>
When running with docker, --node-ip needs to be set to your machine's local IP address.
The --dev flag turns on log verbosity to make it easier for local debugging/development
Creating a JWT token
To create a join token for clients, livekit-server provides a convenient subcommand to create a development token. This token has an expiration of a month, which is useful for development & testing, but not appropriate for production use.
./bin/livekit-server --key-file <path/to/keyfile> create-join-token --room "myroom" --identity "myidentity"
Sample client
To test your server, you can use our example web client (built with our React component)
Enter generated access token and you are connected to a room!
Deploying for production
LiveKit is deployable to any environment that supports docker, including Kubernetes and Amazon ECS.
See deployment docs at https://docs.livekit.io/guides/deploy
Contributing
We welcome your contributions to make LiveKit better! Please join us on Slack to discuss your ideas and/or submit PRs.
License
LiveKit server is licensed under Apache License v2.0.