Skip to content

Commit dbbf838

Browse files
committed
use Bytes in RtpPacket
1 parent a20bf21 commit dbbf838

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pulsebeam/src/participant/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl ParticipantCore {
171171
pkt.raw_header.marker,
172172
pkt.raw_header.ext_vals,
173173
true,
174-
pkt.payload,
174+
pkt.payload.to_vec(),
175175
) {
176176
tracing::warn!(%mid, ssrc = %pkt.raw_header.ssrc, "Dropping RTP for invalid rtp header: {err:?}");
177177
}

pulsebeam/src/rtp/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub mod switcher;
44
pub mod sync;
55
pub mod timeline;
66

7+
use bytes::Bytes;
78
use str0m::media::{Frequency, MediaTime};
89
use str0m::rtp::rtcp::SenderInfo;
910
use str0m::rtp::{RtpHeader, SeqNo};
@@ -37,7 +38,7 @@ pub struct RtpPacket {
3738
pub playout_time: Instant,
3839
pub is_keyframe_start: bool,
3940
pub last_sender_info: Option<SenderInfo>,
40-
pub payload: Vec<u8>,
41+
pub payload: Bytes,
4142
}
4243

4344
impl Default for RtpPacket {
@@ -57,7 +58,7 @@ impl Default for RtpPacket {
5758
playout_time: Instant::now(),
5859
is_keyframe_start: false,
5960
last_sender_info: None,
60-
payload: vec![0u8; 1200], // 1.2KB payload for test realism
61+
payload: Bytes::from_static(&[0u8; 1200]), // 1.2KB payload for test realism
6162
}
6263
}
6364
}
@@ -79,7 +80,7 @@ impl RtpPacket {
7980
playout_time: rtp.timestamp.into(),
8081
is_keyframe_start,
8182
last_sender_info: None,
82-
payload: rtp.payload,
83+
payload: Bytes::from(rtp.payload),
8384
}
8485
}
8586

0 commit comments

Comments
 (0)