Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased

* Avoid sending VLA on every packet #866
* Add `abs-capture-time` RTP header extension #864

# 0.16.2
Expand Down
9 changes: 8 additions & 1 deletion src/packet/payload.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::format::CodecSpec;
use crate::media::ToPayload;
use crate::rtp::vla::VideoLayersAllocation;
use crate::rtp_::Frequency;
use crate::streams::StreamTx;

Expand Down Expand Up @@ -42,6 +43,7 @@ impl Payloader {

for (idx, data) in chunks.into_iter().enumerate() {
let last = idx == len - 1;
let first = idx == 0;

let previous_data = stream.last_packet();
let marker = self.pack.is_marker(data.as_slice(), previous_data, last)
Expand All @@ -52,13 +54,18 @@ impl Payloader {
// TODO: delegate to self.pack to decide whether this packet is nackable.
let nackable = !is_audio;

let mut pkt_ext_vals = ext_vals.clone();
if !first {
pkt_ext_vals.user_values.remove::<VideoLayersAllocation>();
}

stream.write_rtp(
pt,
seq_no,
rtp_time.rebase(self.clock_rate).numer() as u32,
wallclock,
marker,
ext_vals.clone(),
pkt_ext_vals,
nackable,
data,
)?;
Expand Down
7 changes: 7 additions & 0 deletions src/rtp/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,13 @@ impl UserExtensionValues {
.downcast()
.ok()
}

/// Remove a user extension value (by type).
pub fn remove<T: Send + Sync + 'static>(&mut self) {
if let Some(map) = &mut self.map {
map.remove(&TypeId::of::<T>());
}
}
}

impl UnwindSafe for UserExtensionValues {}
Expand Down
Loading