7 unstable releases

0.4.4 May 31, 2024
0.4.3 Sep 25, 2023
0.4.1 Mar 11, 2023
0.3.0 Jan 14, 2022
0.1.0 Sep 23, 2020

#52 in Video

Download history 66/week @ 2024-04-03 22/week @ 2024-04-10 53/week @ 2024-04-17 42/week @ 2024-04-24 21/week @ 2024-05-01 43/week @ 2024-05-08 128/week @ 2024-05-15 87/week @ 2024-05-22 229/week @ 2024-05-29 138/week @ 2024-06-05 128/week @ 2024-06-12 108/week @ 2024-06-19 70/week @ 2024-06-26 98/week @ 2024-07-03 86/week @ 2024-07-10 47/week @ 2024-07-17

314 downloads per month
Used in 5 crates (4 directly)

Apache-2.0

650KB
15K SLoC

Implementation of SRT in pure safe rust.

Generally used for live video streaming across lossy but high bandwidth connections.

Quick start

use srt_tokio::SrtSocket;
use futures::prelude::*;
use bytes::Bytes;
use std::time::Instant;
use std::io;

#[tokio::main]
async fn main()
{
    let sender_fut = async {
        let mut tx = SrtSocket::builder().listen_on(2223).await?;

        let iter = ["1", "2", "3"];

        tx.send_all(&mut stream::iter(&iter)
            .map(|b| Ok((Instant::now(), Bytes::from(*b))))).await?;
        tx.close().await?;

        Ok::<_, io::Error>(())
    };

    let receiver_fut = async {
        let mut rx = SrtSocket::builder().call("127.0.0.1:2223", None).await?;

        assert_eq!(rx.try_next().await?.map(|(_i, b)| b), Some(b"1"[..].into()));
        assert_eq!(rx.try_next().await?.map(|(_i, b)| b), Some(b"2"[..].into()));
        assert_eq!(rx.try_next().await?.map(|(_i, b)| b), Some(b"3"[..].into()));
        assert_eq!(rx.try_next().await?, None);

        Ok::<_, io::Error>(())
    };

    futures::try_join!(sender_fut, receiver_fut).unwrap();
}

Dependencies

~10–20MB
~295K SLoC