7个不稳定版本

0.4.4 2024年5月31日
0.4.3 2023年9月25日
0.4.1 2023年3月11日
0.3.0 2022年1月14日
0.1.0 2020年9月23日

#59视频

Download history 25/week @ 2024-05-04 115/week @ 2024-05-11 97/week @ 2024-05-18 179/week @ 2024-05-25 162/week @ 2024-06-01 138/week @ 2024-06-08 121/week @ 2024-06-15 61/week @ 2024-06-22 117/week @ 2024-06-29 55/week @ 2024-07-06 84/week @ 2024-07-13 70/week @ 2024-07-20 72/week @ 2024-07-27 36/week @ 2024-08-03 46/week @ 2024-08-10 37/week @ 2024-08-17

每月200 次下载
用于 5 个Crate(4个直接)

Apache-2.0

650KB
15K SLoC

纯Rust安全实现的SRT

通常用于在具有高带宽但存在丢包的连接上进行实时视频流。

快速开始

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();
}

依赖项

~9–20MB
~290K SLoC