Skip to content

Commit 0e5c862

Browse files
authored
peer_connection: Fix packet size for buffered simulcast packet (webrtc-rs#587)
Fixes webrtc-rs#586
1 parent 1ad10c3 commit 0e5c862

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

webrtc/src/peer_connection/peer_connection_internal.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -980,21 +980,22 @@ impl PeerConnectionInternal {
980980
})
981981
.await;
982982

983-
let mut buf = vec![0u8; self.setting_engine.get_receive_mtu()];
984983
// Packets that we read as part of simulcast probing that we need to make available
985984
// if we do find a track later.
986985
let mut buffered_packets: VecDeque<(rtp::packet::Packet, Attributes)> = VecDeque::default();
987986

987+
let mut buf = vec![0u8; self.setting_engine.get_receive_mtu()];
988988
let n = rtp_stream.read(&mut buf).await?;
989+
let mut b = &buf[..n];
989990

990991
let (mut mid, mut rid, mut rsid, payload_type) = handle_unknown_rtp_packet(
991-
&buf[..n],
992+
b,
992993
mid_extension_id as u8,
993994
sid_extension_id as u8,
994995
rsid_extension_id as u8,
995996
)?;
996997

997-
let packet = rtp::packet::Packet::unmarshal(&mut buf.as_slice()).unwrap();
998+
let packet = rtp::packet::Packet::unmarshal(&mut b).unwrap();
998999

9991000
// TODO: Can we have attributes on the first packets?
10001001
buffered_packets.push_back((packet, Attributes::new()));

0 commit comments

Comments
 (0)