Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2021-02-04 19:06:19 +0300
committerJan Schmidt <jan@centricular.com>2021-02-04 19:24:02 +0300
commitf63c4284c1f8661eae0df31bc949793bbf7a2c43 (patch)
treea2aa532ac558faa1408b7cb192cae089da00d33d
parentb649e9b07674f563c8b4b44fde1076606b93e996 (diff)
fallbackswitch: Fix draining of the backup pad.
When not autoswitching between the primary and fallback pad, make sure to drain the disabled pad to the current running time, and fix the drain_pad_to_time() function to use the correct running time variable. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/472>
-rw-r--r--utils/fallbackswitch/src/fallbackswitch/imp.rs28
1 files changed, 21 insertions, 7 deletions
diff --git a/utils/fallbackswitch/src/fallbackswitch/imp.rs b/utils/fallbackswitch/src/fallbackswitch/imp.rs
index c5fcd951e..b114b68fb 100644
--- a/utils/fallbackswitch/src/fallbackswitch/imp.rs
+++ b/utils/fallbackswitch/src/fallbackswitch/imp.rs
@@ -205,7 +205,8 @@ impl FallbackSwitch {
while let Some(buffer) = pad.peek_buffer() {
let pts = buffer.get_dts_or_pts();
let new_running_time = segment.to_running_time(pts);
- if pts.is_none() || running_time <= target_running_time {
+
+ if pts.is_none() || new_running_time <= target_running_time {
gst_debug!(CAT, obj: pad, "Dropping trailing buffer {:?}", buffer);
pad.drop_buffer();
running_time = new_running_time;
@@ -570,13 +571,14 @@ impl FallbackSwitch {
/* If we can't auto-switch, then can't fetch anything from the backup pad */
if !settings.auto_switch {
- /* Use a dummy drain_pad_to_time() call to update the last_sinkpad_time */
+ /* Not switching, but backup pad needs draining of late buffers still */
+ gst_log!(
+ CAT,
+ obj: agg,
+ "No primary buffer, but can't autoswitch - draining backup pad"
+ );
if let Some(backup_pad) = &backup_pad {
- if let Err(e) = self.drain_pad_to_time(
- &mut *state,
- &backup_pad,
- gst::ClockTime::from_seconds(0),
- ) {
+ if let Err(e) = self.drain_pad_to_time(&mut *state, &backup_pad, cur_running_time) {
return (
Err(e),
state.check_health_changes(
@@ -1161,9 +1163,21 @@ impl AggregatorImpl for FallbackSwitch {
self.get_next_buffer(agg, timeout);
if primary_health_change {
+ gst_debug!(
+ CAT,
+ obj: agg,
+ "Primary pad health now {}",
+ &primary_health_change
+ );
agg.notify("primary-health");
}
if fallback_health_change {
+ gst_debug!(
+ CAT,
+ obj: agg,
+ "Fallback pad health now {}",
+ &fallback_health_change
+ );
agg.notify("fallback-health");
}