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:
authorGuillaume Desmottes <guillaume.desmottes@onestream.live>2021-12-22 13:38:43 +0300
committerGuillaume Desmottes <guillaume.desmottes@onestream.live>2021-12-22 17:26:17 +0300
commitb7c08933aa51d2d93139eb47e8ae6c95f35a669f (patch)
treee8526f9056ff415d2c8a57c762917862b7ac275c /utils/uriplaylistbin/tests
parent9783d01a3520ad23dca7f1f2a76693d2755c292b (diff)
uriplaylistbin: add properties reporting the current state of the playlist
Diffstat (limited to 'utils/uriplaylistbin/tests')
-rw-r--r--utils/uriplaylistbin/tests/uriplaylistbin.rs76
1 files changed, 52 insertions, 24 deletions
diff --git a/utils/uriplaylistbin/tests/uriplaylistbin.rs b/utils/uriplaylistbin/tests/uriplaylistbin.rs
index e8e4842c..ace265cf 100644
--- a/utils/uriplaylistbin/tests/uriplaylistbin.rs
+++ b/utils/uriplaylistbin/tests/uriplaylistbin.rs
@@ -76,7 +76,7 @@ fn test(
n_streams: u32,
iterations: u32,
check_streams: bool,
-) -> Vec<gst::Message> {
+) -> (Vec<gst::Message>, u32, u64) {
init();
let playlist_len = medias.len() * (iterations as usize);
@@ -99,6 +99,9 @@ fn test(
playlist.set_property("uris", &uris);
playlist.set_property("iterations", &iterations);
+ assert_eq!(playlist.property::<u32>("current-iteration"), 0);
+ assert_eq!(playlist.property::<u64>("current-uri-index"), 0);
+
let mq_clone = mq.clone();
playlist.connect_pad_added(move |_playlist, src_pad| {
let mq_sink = mq_clone.request_pad_simple("sink_%u").unwrap();
@@ -185,9 +188,12 @@ fn test(
}
}
+ let current_iteration = playlist.property::<u32>("current-iteration");
+ let current_uri_index = playlist.property::<u64>("current-uri-index");
+
pipeline.set_state(gst::State::Null).unwrap();
- events
+ (events, current_iteration, current_uri_index)
}
fn assert_eos(msg: gst::Message) {
@@ -234,66 +240,88 @@ fn assert_stream_selected(msg: gst::Message, n_streams: usize) -> gst::Object {
#[test]
fn single_audio() {
- let events = test(vec![TestMedia::ogg()], 1, 1, true).into_iter();
- assert_eos(events.last().unwrap());
+ let (events, current_iteration, current_uri_index) = test(vec![TestMedia::ogg()], 1, 1, true);
+ assert_eos(events.into_iter().last().unwrap());
+ assert_eq!(current_iteration, 0);
+ assert_eq!(current_uri_index, 0);
}
#[test]
fn single_video() {
- let events = test(vec![TestMedia::mkv()], 2, 1, true).into_iter();
- assert_eos(events.last().unwrap());
+ let (events, current_iteration, current_uri_index) = test(vec![TestMedia::mkv()], 2, 1, true);
+ assert_eos(events.into_iter().last().unwrap());
+ assert_eq!(current_iteration, 0);
+ assert_eq!(current_uri_index, 0);
}
#[test]
fn multi_audio() {
- let events = test(
+ let (events, current_iteration, current_uri_index) = test(
vec![TestMedia::ogg(), TestMedia::ogg(), TestMedia::ogg()],
1,
1,
true,
- )
- .into_iter();
- assert_eos(events.last().unwrap());
+ );
+ assert_eos(events.into_iter().last().unwrap());
+ assert_eq!(current_iteration, 0);
+ assert_eq!(current_uri_index, 2);
}
#[test]
fn multi_audio_video() {
- let events = test(vec![TestMedia::mkv(), TestMedia::mkv()], 2, 1, true).into_iter();
- assert_eos(events.last().unwrap());
+ let (events, current_iteration, current_uri_index) =
+ test(vec![TestMedia::mkv(), TestMedia::mkv()], 2, 1, true);
+ assert_eos(events.into_iter().last().unwrap());
+ assert_eq!(current_iteration, 0);
+ assert_eq!(current_uri_index, 1);
}
#[test]
fn iterations() {
- let events = test(vec![TestMedia::mkv(), TestMedia::mkv()], 2, 2, true).into_iter();
- assert_eos(events.last().unwrap());
+ let (events, current_iteration, current_uri_index) =
+ test(vec![TestMedia::mkv(), TestMedia::mkv()], 2, 2, true);
+ assert_eos(events.into_iter().last().unwrap());
+ assert_eq!(current_iteration, 1);
+ assert_eq!(current_uri_index, 1);
}
#[test]
fn nb_streams_increasing() {
- let events = test(vec![TestMedia::ogg(), TestMedia::mkv()], 2, 1, false).into_iter();
- assert_eos(events.last().unwrap());
+ let (events, current_iteration, current_uri_index) =
+ test(vec![TestMedia::ogg(), TestMedia::mkv()], 2, 1, false);
+ assert_eos(events.into_iter().last().unwrap());
+ assert_eq!(current_iteration, 0);
+ assert_eq!(current_uri_index, 1);
}
#[test]
fn missing_file() {
- let events = test(
+ let (events, current_iteration, current_uri_index) = test(
vec![TestMedia::ogg(), TestMedia::missing_file()],
1,
1,
false,
- )
- .into_iter();
- assert_error(events.last().unwrap(), TestMedia::missing_file());
+ );
+ assert_error(
+ events.into_iter().last().unwrap(),
+ TestMedia::missing_file(),
+ );
+ assert_eq!(current_iteration, 0);
+ assert_eq!(current_uri_index, 0);
}
#[test]
fn missing_http() {
- let events = test(
+ let (events, current_iteration, current_uri_index) = test(
vec![TestMedia::ogg(), TestMedia::missing_http()],
1,
1,
false,
- )
- .into_iter();
- assert_error(events.last().unwrap(), TestMedia::missing_http());
+ );
+ assert_error(
+ events.into_iter().last().unwrap(),
+ TestMedia::missing_http(),
+ );
+ assert_eq!(current_iteration, 0);
+ assert_eq!(current_uri_index, 0);
}