mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 02:51:10 +00:00
gstreamer: Add tests for pad probes taking and dropping data
This is quite similar to the HANDLED case, so reuse that code. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1528>
This commit is contained in:
parent
6a87d4a66a
commit
bd37999166
1 changed files with 25 additions and 5 deletions
|
@ -2416,8 +2416,8 @@ mod tests {
|
|||
assert_eq!(counter.load(std::sync::atomic::Ordering::SeqCst), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_probe() {
|
||||
fn do_probe_with_return(probe_return: crate::PadProbeReturn) {
|
||||
skip_assert_initialized!();
|
||||
crate::init().unwrap();
|
||||
|
||||
let (major, minor, micro, _) = crate::version();
|
||||
|
@ -2457,7 +2457,7 @@ mod tests {
|
|||
} else {
|
||||
unreachable!();
|
||||
}
|
||||
crate::PadProbeReturn::Handled
|
||||
probe_return
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2475,7 +2475,7 @@ mod tests {
|
|||
} else {
|
||||
unreachable!();
|
||||
}
|
||||
crate::PadProbeReturn::Handled
|
||||
probe_return
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2491,7 +2491,15 @@ mod tests {
|
|||
assert!(pad.push_event(crate::event::Segment::new(segment.as_ref())));
|
||||
|
||||
assert_eq!(pad.push(crate::Buffer::new()), Ok(FlowSuccess::Ok));
|
||||
assert_eq!(pad.push(crate::Buffer::new()), flow_override);
|
||||
assert_eq!(
|
||||
pad.push(crate::Buffer::new()),
|
||||
// On Drop, we will get an Ok, not whatever value we returned
|
||||
if probe_return == crate::PadProbeReturn::Drop {
|
||||
Ok(FlowSuccess::Ok)
|
||||
} else {
|
||||
flow_override
|
||||
}
|
||||
);
|
||||
|
||||
let events = events.lock().unwrap();
|
||||
let buffers = buffers.lock().unwrap();
|
||||
|
@ -2514,6 +2522,18 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_probe() {
|
||||
crate::init().unwrap();
|
||||
do_probe_with_return(crate::PadProbeReturn::Handled);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_probe_drop() {
|
||||
crate::init().unwrap();
|
||||
do_probe_with_return(crate::PadProbeReturn::Drop);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sticky_events() {
|
||||
crate::init().unwrap();
|
||||
|
|
Loading…
Reference in a new issue