uriplaylistbin: rely on new uridecodebin3 gapless logic

uridecodebin3 can now properly handle gapless switches so use that
instead of our own very complicated logic.

Fix #268
Fix #193

Depends on gst 1.23.90 as the plugin requires recent fixes to work properly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1471>
This commit is contained in:
Guillaume Desmottes 2022-12-16 16:04:09 +01:00
parent 1e88971ec8
commit 721b7e9c8c
4 changed files with 226 additions and 1262 deletions

View file

@ -170,6 +170,7 @@ plugins = {
'library': 'libgsturiplaylistbin', 'library': 'libgsturiplaylistbin',
'examples': ['playlist'], 'examples': ['playlist'],
'features': ['clap'], 'features': ['clap'],
'gst-version': '>=1.23.90',
}, },
'cdg': {'library': 'libgstcdg'}, 'cdg': {'library': 'libgstcdg'},
@ -397,6 +398,18 @@ foreach plugin_name, details: plugins
endif endif
endforeach endforeach
endif endif
if details.has_key('gst-version')
# Check if we have the required GStreamer version
gst_version = details.get('gst-version', '')
dep = dependency('gstreamer-1.0', required: false, version: gst_version)
if not dep.found()
opt = get_option(plugin_name)
if opt.enabled()
error('Required GStreamer version not found to build ' + plugin_name)
endif
plugin_deps_found = false
endif
endif
if plugin_deps_found if plugin_deps_found
packages += f'gst-plugin-@plugin_name@' packages += f'gst-plugin-@plugin_name@'
features += plugin_features features += plugin_features

View file

@ -9,7 +9,7 @@ description = "GStreamer Playlist Playback Plugin"
rust-version.workspace = true rust-version.workspace = true
[dependencies] [dependencies]
gst.workspace = true gst = { workspace = true, features = ["v1_24"] }
anyhow = "1" anyhow = "1"
clap = { version = "4", optional = true, features = ["derive"] } clap = { version = "4", optional = true, features = ["derive"] }
thiserror = "1" thiserror = "1"

File diff suppressed because it is too large Load diff

View file

@ -135,9 +135,21 @@ fn test(
break; break;
} }
// check stream related messages // check stream related messages
MessageView::StreamCollection(_) | MessageView::StreamsSelected(_) => { MessageView::StreamCollection(sc) => {
if let Some(prev) = events.last() {
if let MessageView::StreamCollection(prev_sc) = prev.view() {
if prev_sc.src() == sc.src()
&& prev_sc.stream_collection() == sc.stream_collection()
{
// decodebin3 may send twice the same collection
continue;
}
}
}
events.push(msg.clone()) events.push(msg.clone())
} }
MessageView::StreamsSelected(_) => events.push(msg.clone()),
_ => {} _ => {}
} }
} }
@ -174,12 +186,15 @@ fn test(
// check stream-collection and streams-selected message ordering // check stream-collection and streams-selected message ordering
let mut events = events.clone().into_iter(); let mut events = events.clone().into_iter();
for _ in 0..playlist_len { for i in 0..playlist_len {
let decodebin = assert_stream_collection(events.next().unwrap(), n_streams as usize); let decodebin = assert_stream_collection(events.next().unwrap(), n_streams as usize);
assert_eq!( if i == 0 {
assert_stream_selected(events.next().unwrap(), n_streams as usize), // decodebin3 sends StreamSelected only once, which is ok as the selected stream stays the same
decodebin assert_eq!(
); assert_stream_selected(events.next().unwrap(), n_streams as usize),
decodebin
);
}
} }
} }