mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-20 16:08:14 +00:00
rtp: tests: add possibility to check duration of depayloaded buffers
.. and clarify an expect panic message. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1586>
This commit is contained in:
parent
6b628485c5
commit
6597ec84eb
1 changed files with 22 additions and 1 deletions
|
@ -103,6 +103,8 @@ pub struct ExpectedBuffer {
|
||||||
pub pts: Option<gst::ClockTime>,
|
pub pts: Option<gst::ClockTime>,
|
||||||
/// If not set then it is asserted that the depayloaded buffer also has no DTS.
|
/// If not set then it is asserted that the depayloaded buffer also has no DTS.
|
||||||
pub dts: Option<gst::ClockTime>,
|
pub dts: Option<gst::ClockTime>,
|
||||||
|
/// If set, the duration will be checked against the one on the depayloaded buffer
|
||||||
|
pub duration: Option<gst::ClockTime>,
|
||||||
/// If not set the size will not be checked.
|
/// If not set the size will not be checked.
|
||||||
pub size: Option<usize>,
|
pub size: Option<usize>,
|
||||||
pub flags: gst::BufferFlags,
|
pub flags: gst::BufferFlags,
|
||||||
|
@ -115,12 +117,14 @@ impl ExpectedBuffer {
|
||||||
///
|
///
|
||||||
/// * pts: None
|
/// * pts: None
|
||||||
/// * dts: None
|
/// * dts: None
|
||||||
|
/// * duration: None
|
||||||
/// * size: None => not checked
|
/// * size: None => not checked
|
||||||
/// * flags: gst::BufferFlags::empty()
|
/// * flags: gst::BufferFlags::empty()
|
||||||
pub fn builder() -> ExpectedBufferBuilder {
|
pub fn builder() -> ExpectedBufferBuilder {
|
||||||
ExpectedBufferBuilder(ExpectedBuffer {
|
ExpectedBufferBuilder(ExpectedBuffer {
|
||||||
pts: None,
|
pts: None,
|
||||||
dts: None,
|
dts: None,
|
||||||
|
duration: None,
|
||||||
size: None,
|
size: None,
|
||||||
flags: gst::BufferFlags::empty(),
|
flags: gst::BufferFlags::empty(),
|
||||||
})
|
})
|
||||||
|
@ -145,6 +149,11 @@ impl ExpectedBufferBuilder {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn duration(mut self, duration: gst::ClockTime) -> Self {
|
||||||
|
self.0.duration = Some(duration);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn size(mut self, size: usize) -> Self {
|
pub fn size(mut self, size: usize) -> Self {
|
||||||
self.0.size = Some(size);
|
self.0.size = Some(size);
|
||||||
self
|
self
|
||||||
|
@ -282,7 +291,7 @@ pub fn run_test_pipeline_full(
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.next()
|
.next()
|
||||||
.expect("Expected packets?!");
|
.expect("Not enough expected packets?!");
|
||||||
|
|
||||||
let drop_count = expected_packets
|
let drop_count = expected_packets
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -574,6 +583,18 @@ pub fn run_test_pipeline_full(
|
||||||
expected_buffer.pts.display(),
|
expected_buffer.pts.display(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if let Some(expected_duration) = expected_buffer.duration {
|
||||||
|
assert_eq!(
|
||||||
|
buffer.duration(),
|
||||||
|
Some(expected_duration),
|
||||||
|
"Buffer {} of payload buffer list {} has unexpected duration {:?} instead of {:?}",
|
||||||
|
j,
|
||||||
|
i,
|
||||||
|
buffer.duration(),
|
||||||
|
expected_duration,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(expected_size) = expected_buffer.size {
|
if let Some(expected_size) = expected_buffer.size {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
buffer.size(),
|
buffer.size(),
|
||||||
|
|
Loading…
Reference in a new issue