{"id":33926935,"url":"https://github.com/restsend/rustrtc","last_synced_at":"2026-01-13T21:04:22.627Z","repository":{"id":325918106,"uuid":"1104733069","full_name":"restsend/rustrtc","owner":"restsend","description":"A high-performance implementation of WebRTC. ","archived":false,"fork":false,"pushed_at":"2026-01-12T08:15:51.000Z","size":2123,"stargazers_count":57,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-12T16:13:06.691Z","etag":null,"topics":["pion","rtc","rtp","sfu","webrtc"],"latest_commit_sha":null,"homepage":"https://miuda.ai","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/restsend.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-26T16:01:11.000Z","updated_at":"2026-01-12T08:15:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/restsend/rustrtc","commit_stats":null,"previous_names":["restsend/rustrtc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/restsend/rustrtc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restsend%2Frustrtc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restsend%2Frustrtc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restsend%2Frustrtc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restsend%2Frustrtc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/restsend","download_url":"https://codeload.github.com/restsend/rustrtc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/restsend%2Frustrtc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28400419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pion","rtc","rtp","sfu","webrtc"],"created_at":"2025-12-12T10:37:13.821Z","updated_at":"2026-01-13T21:04:22.620Z","avatar_url":"https://github.com/restsend.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rustrtc\n\n[![Crates.io](https://img.shields.io/crates/v/rustrtc.svg)](https://crates.io/crates/rustrtc)\n[![Documentation](https://docs.rs/rustrtc/badge.svg)](https://docs.rs/rustrtc)\n\nA high-performance implementation of WebRTC.\n\n## Features\n\n- **🚀High performance:** ~2.8x faster than `pion` (go version).\n- **🍡WebRTC Compliant**: Full compliance with webrtc/chrome.\n- **📺Media Support**: RTP/SRTP handling for audio and video.\n- **👌ICE/STUN**: Interactive Connectivity Establishment and STUN protocol support.\n\n## Benchmark game (rustrtc vs webrtc-rs \u0026 pion) in 0.2.28\n\n**CPU:**  `AMD Ryzen 7 5700X 8-Core Processor`\n**OS** `5.15.0-118-generic #128-Ubuntu`  \n**Compiler** `rustc 1.91.0 (f8297e351 2025-10-28)`,  `go version go1.23.0 linux/amd64`\n\n```shell\nnice@miuda.ai rustrtc % cargo run -r --example benchmark\n\nComparison (Baseline: webrtc)\nMetric               | webrtc     | rustrtc    | pion      \n--------------------------------------------------------------------------------\nDuration (s)         | 10.07      | 10.02      | 10.13     \nSetup Latency (ms)   | 1.36       | 0.22       | 0.90      \nThroughput (MB/s)    | 254.55     | 713.66     | 309.11    \nMsg Rate (msg/s)     | 260659.38  | 730788.92  | 316533.37 \nCPU Usage (%)        | 1480.45    | 1497.50    | 1121.20   \nMemory (MB)          | 29.00      | 15.00      | 44.00     \n--------------------------------------------------------------------------------\n\nPerformance Charts\n==================\n\nThroughput (MB/s) (Higher is better)\nwebrtc     | ██████████████                           254.55\nrustrtc    | ████████████████████████████████████████ 713.66\npion       | █████████████████                        309.11\n\nMessage Rate (msg/s) (Higher is better)\nwebrtc     | ██████████████                           260659.38\nrustrtc    | ████████████████████████████████████████ 730788.92\npion       | █████████████████                        316533.37\n\nSetup Latency (ms) (Lower is better)\nwebrtc     | ████████████████████████████████████████ 1.36\nrustrtc    | ██████                                   0.22\npion       | ██████████████████████████               0.90\n\nCPU Usage (%) (Lower is better)\nwebrtc     | ███████████████████████████████████████  1480.45\nrustrtc    | ████████████████████████████████████████ 1497.50\npion       | █████████████████████████████            1121.20\n\nMemory (MB) (Lower is better)\nwebrtc     | ██████████████████████████               29.00\nrustrtc    | █████████████                            15.00\npion       | ████████████████████████████████████████ 44.00\n```\n\n**Key Findings:**\n\n- **Throughput**: `rustrtc` is ~2.8x faster than `webrtc-rs` and ~2.3x faster than `pion`.\n- **Memory**: `rustrtc` uses ~48% less memory than `webrtc-rs` and ~66% less than `pion`.\n- **Setup Latency**: Significantly faster connection setup (0.22ms vs 1.36ms/0.90ms).\n\n## Usage\n\nHere is a simple example of how to create a `PeerConnection` and handle an offer:\n\n```rust\nuse rustrtc::{PeerConnection, RtcConfiguration, SessionDescription, SdpType};\n\n#[tokio::main]\nasync fn main() {\n    let config = RtcConfiguration::default();\n    let pc = PeerConnection::new(config);\n\n    // Create a Data Channel\n    let dc = pc.create_data_channel(\"data\", None).unwrap();\n\n    // Handle received messages\n    let dc_clone = dc.clone();\n    tokio::spawn(async move {\n        while let Some(event) = dc_clone.recv().await {\n            if let rustrtc::DataChannelEvent::Message(data) = event {\n                println!(\"Received: {:?}\", String::from_utf8_lossy(\u0026data));\n            }\n        }\n    });\n\n    // Create an offer\n    let offer = pc.create_offer().unwrap();\n    pc.set_local_description(offer).unwrap();\n\n    // Wait for ICE gathering to complete\n    pc.wait_for_gathering_complete().await;\n\n    // Get the complete SDP with candidates\n    let complete_offer = pc.local_description().unwrap();\n    println!(\"Offer SDP: {}\", complete_offer.to_sdp_string());\n}\n```\n\n## Configuration\n\n`rustrtc` allows customizing the WebRTC session via `RtcConfiguration`:\n\n- **ice_servers**: Configure STUN/TURN servers.\n- **ice_transport_policy**: Control ICE candidate gathering (e.g., `All`, `Relay`).\n- **ssrc_start**: Set the starting SSRC value for local tracks.\n- **media_capabilities**: Configure supported codecs (payload types, names) and SCTP ports.\n\n```rust\nuse rustrtc::{PeerConnection, RtcConfiguration, IceServer, IceTransportPolicy, config::MediaCapabilities};\n\nlet mut config = RtcConfiguration::default();\n\n// Configure ICE servers\nconfig.ice_servers.push(IceServer::new(vec![\"stun:stun.l.google.com:19302\"]));\n\n// Set ICE transport policy (optional)\nconfig.ice_transport_policy = IceTransportPolicy::All;\n\nconfig.ssrc_start = 10000;\n\n// Customize media capabilities\nlet mut caps = MediaCapabilities::default();\n// ... configure audio/video/application caps ...\nconfig.media_capabilities = Some(caps);\n\nlet pc = PeerConnection::new(config);\n```\n\n## Examples\n\nYou can run the examples provided in the repository.\n\n### SFU (Selective Forwarding Unit)\n\nA multi-user video conferencing server. It receives media from each participant and forwards it to others.\n\n1. Run the server:\n\n    ```bash\n    cargo run --example rustrtc_sfu\n    ```\n\n2. Open your browser and navigate to `http://127.0.0.1:8081`. Open multiple tabs/windows to simulate multiple users.\n\n![rustrtcsfu](./rustrtc_sfu.png)\n\n### Echo Server\n\nThe echo server example demonstrates how to accept a WebRTC connection, receive data on a data channel, and echo it back. It also supports video playback if an IVF file is provided.\n\n1. Run the server:\n\n    ```bash\n    cargo run --example echo_server\n    ```\n\n2. Open your browser and navigate to `http://127.0.0.1:3000`.\n\n### DataChannel Chat\n\nA multi-user chat room using WebRTC DataChannels.\n\n1. Run the server:\n\n    ```bash\n    cargo run --example datachannel_chat\n    ```\n\n2. Open your browser and navigate to `http://127.0.0.1:3000`. Open multiple tabs to chat between them.\n\n### Audio Saver\n\nRecords audio from the browser's microphone and saves it to a file (`output.ulaw`) on the server.\n\n1. Run the server:\n\n    ```bash\n    cargo run --example audio_saver\n    ```\n\n2. Open your browser and navigate to `http://127.0.0.1:3000`. Click \"Start\" to begin recording.\n\n### RTP Play (FFmpeg)\n\nStreams a video file (`examples/static/output.ivf`) via RTP to a UDP port, which can be played back using `ffplay`.\n\n1. Run the server:\n\n    ```bash\n    cargo run --example rtp_play\n    ```\n\n2. In a separate terminal, run `ffplay` (requires ffmpeg installed):\n\n    ```bash\n    ffplay -protocol_whitelist file,udp,rtp -i examples/rtp_play.sdp\n    ```\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frestsend%2Frustrtc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frestsend%2Frustrtc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frestsend%2Frustrtc/lists"}