Skip to content

Commit f158925

Browse files
logist322rainliu
authored andcommitted
Make bin
1 parent 788ab46 commit f158925

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

srtp/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ homepage = "https://webrtc.rs"
1010
repository = "https://github.com/webrtc-rs/srtp"
1111
rust-version = "1.63.0"
1212

13+
[[bin]]
14+
name = "kek"
15+
edition = "2021"
16+
path = "src/main.rs"
17+
1318
[dependencies]
1419
util = { version = "0.7.0", path = "../util", package = "webrtc-util", default-features = false, features = [
1520
"conn",

srtp/src/main.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
use bytes::BytesMut;
2+
use util::Marshal;
3+
use webrtc_srtp::{context::Context, protection_profile::ProtectionProfile};
4+
5+
fn main() {
6+
let mut ctx = Context::new(
7+
&vec![0; 16],
8+
&vec![0; 14],
9+
ProtectionProfile::Aes128CmHmacSha1_80,
10+
None,
11+
None,
12+
).unwrap();
13+
let mut pld = BytesMut::new();
14+
for i in 0..1000 {
15+
pld.extend_from_slice(&[i as u8]);
16+
}
17+
let pkt = rtp::packet::Packet {
18+
header: rtp::header::Header {
19+
sequence_number: 322,
20+
..Default::default()
21+
},
22+
payload: pld.into(),
23+
};
24+
let pkt_raw = pkt.marshal().unwrap();
25+
26+
for _ in 0..10000 {
27+
ctx.encrypt_rtp(&pkt_raw).unwrap();
28+
}
29+
}

0 commit comments

Comments
 (0)