Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sdroege/gst-plugin-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2023-02-01 19:32:54 +0300
committerSebastian Dröge <sebastian@centricular.com>2023-02-02 21:24:27 +0300
commited4e9a50d5eee58f0a77a9a43a365c6354948e78 (patch)
tree7fb0076619e665ddb9ae759d54c7464c685a7a46
parentd6cb9d72d8259d181b92c5973907d663720bbe00 (diff)
rtpav1depay: Set DISCONT flag on buffers following a corrupted packet
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1072>
-rw-r--r--net/rtp/src/av1/depay/imp.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/net/rtp/src/av1/depay/imp.rs b/net/rtp/src/av1/depay/imp.rs
index 355694d4..5ae3e305 100644
--- a/net/rtp/src/av1/depay/imp.rs
+++ b/net/rtp/src/av1/depay/imp.rs
@@ -26,15 +26,28 @@ use crate::av1::common::{
// TODO: handle internal size fields in RTP OBUs
-#[derive(Debug, Default)]
+#[derive(Debug)]
struct State {
last_timestamp: Option<u32>,
/// if true, the last packet of a temporal unit has been received
marked_packet: bool,
+ /// if the next output buffer needs the DISCONT flag set
+ needs_discont: bool,
/// holds data for a fragment
obu_fragment: Option<(UnsizedObu, Vec<u8>)>,
}
+impl Default for State {
+ fn default() -> Self {
+ State {
+ last_timestamp: None,
+ marked_packet: false,
+ needs_discont: true,
+ obu_fragment: None,
+ }
+ }
+}
+
#[derive(Debug, Default)]
pub struct RTPAv1Depay {
state: Mutex<State>,
@@ -314,9 +327,10 @@ impl RTPBaseDepayloadImpl for RTPAv1Depay {
gst::log!(
CAT,
imp: self,
- "creating buffer containing {} bytes of data (marker {})...",
+ "creating buffer containing {} bytes of data (marker {}, discont {})...",
ready_obus.len(),
state.marked_packet,
+ state.needs_discont,
);
let mut buffer = gst::Buffer::from_mut_slice(ready_obus);
@@ -325,6 +339,10 @@ impl RTPBaseDepayloadImpl for RTPAv1Depay {
if state.marked_packet {
buffer.set_flags(gst::BufferFlags::MARKER);
}
+ if state.needs_discont {
+ buffer.set_flags(gst::BufferFlags::DISCONT);
+ state.needs_discont = false;
+ }
}
Some(buffer)
@@ -332,6 +350,8 @@ impl RTPBaseDepayloadImpl for RTPAv1Depay {
None
};
+ // It's important to check this after the packet was created as otherwise
+ // the discont flag is already before the missing data.
if state.marked_packet && state.obu_fragment.is_some() {
gst::error!(
CAT,