mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-03 15:58:42 +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>,
|
||||
/// If not set then it is asserted that the depayloaded buffer also has no DTS.
|
||||
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.
|
||||
pub size: Option<usize>,
|
||||
pub flags: gst::BufferFlags,
|
||||
|
@ -115,12 +117,14 @@ impl ExpectedBuffer {
|
|||
///
|
||||
/// * pts: None
|
||||
/// * dts: None
|
||||
/// * duration: None
|
||||
/// * size: None => not checked
|
||||
/// * flags: gst::BufferFlags::empty()
|
||||
pub fn builder() -> ExpectedBufferBuilder {
|
||||
ExpectedBufferBuilder(ExpectedBuffer {
|
||||
pts: None,
|
||||
dts: None,
|
||||
duration: None,
|
||||
size: None,
|
||||
flags: gst::BufferFlags::empty(),
|
||||
})
|
||||
|
@ -145,6 +149,11 @@ impl ExpectedBufferBuilder {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn duration(mut self, duration: gst::ClockTime) -> Self {
|
||||
self.0.duration = Some(duration);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn size(mut self, size: usize) -> Self {
|
||||
self.0.size = Some(size);
|
||||
self
|
||||
|
@ -282,7 +291,7 @@ pub fn run_test_pipeline_full(
|
|||
.lock()
|
||||
.unwrap()
|
||||
.next()
|
||||
.expect("Expected packets?!");
|
||||
.expect("Not enough expected packets?!");
|
||||
|
||||
let drop_count = expected_packets
|
||||
.iter()
|
||||
|
@ -574,6 +583,18 @@ pub fn run_test_pipeline_full(
|
|||
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 {
|
||||
assert_eq!(
|
||||
buffer.size(),
|
||||
|
|
Loading…
Reference in a new issue