mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-06-30 03:50:34 +00:00
fallbackswitch: Use pad as the debug object
Instead of using the aggregator as the object in debug statements relating to pad dataflow, use the pad itself.
This commit is contained in:
parent
34a2dd80a2
commit
fddf33d339
|
@ -234,7 +234,6 @@ impl OutputState {
|
||||||
impl FallbackSwitch {
|
impl FallbackSwitch {
|
||||||
fn drain_pad_to_time(
|
fn drain_pad_to_time(
|
||||||
&self,
|
&self,
|
||||||
agg: &super::FallbackSwitch,
|
|
||||||
state: &mut OutputState,
|
state: &mut OutputState,
|
||||||
pad: &gst_base::AggregatorPad,
|
pad: &gst_base::AggregatorPad,
|
||||||
target_running_time: gst::ClockTime,
|
target_running_time: gst::ClockTime,
|
||||||
|
@ -247,7 +246,7 @@ impl FallbackSwitch {
|
||||||
}
|
}
|
||||||
|
|
||||||
let segment = segment.downcast::<gst::ClockTime>().map_err(|_| {
|
let segment = segment.downcast::<gst::ClockTime>().map_err(|_| {
|
||||||
gst_error!(CAT, obj: agg, "Only TIME segments supported");
|
gst_error!(CAT, obj: pad, "Only TIME segments supported");
|
||||||
gst::FlowError::Error
|
gst::FlowError::Error
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -257,7 +256,7 @@ impl FallbackSwitch {
|
||||||
let pts = buffer.get_dts_or_pts();
|
let pts = buffer.get_dts_or_pts();
|
||||||
let new_running_time = segment.to_running_time(pts);
|
let new_running_time = segment.to_running_time(pts);
|
||||||
if pts.is_none() || running_time <= target_running_time {
|
if pts.is_none() || running_time <= target_running_time {
|
||||||
gst_debug!(CAT, obj: agg, "Dropping trailing buffer {:?}", buffer);
|
gst_debug!(CAT, obj: pad, "Dropping trailing buffer {:?}", buffer);
|
||||||
pad.drop_buffer();
|
pad.drop_buffer();
|
||||||
running_time = new_running_time;
|
running_time = new_running_time;
|
||||||
} else {
|
} else {
|
||||||
|
@ -288,14 +287,14 @@ impl FallbackSwitch {
|
||||||
// If we got a buffer on the sinkpad just handle it
|
// If we got a buffer on the sinkpad just handle it
|
||||||
gst_debug!(
|
gst_debug!(
|
||||||
CAT,
|
CAT,
|
||||||
obj: agg,
|
obj: preferred_pad,
|
||||||
"Got buffer on pad {} - {:?}",
|
"Got buffer on pad {} - {:?}",
|
||||||
preferred_pad.get_name(),
|
preferred_pad.get_name(),
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
if buffer.get_pts().is_none() {
|
if buffer.get_pts().is_none() {
|
||||||
gst_error!(CAT, obj: agg, "Only buffers with PTS supported");
|
gst_error!(CAT, obj: preferred_pad, "Only buffers with PTS supported");
|
||||||
return Err(gst::FlowError::Error);
|
return Err(gst::FlowError::Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +302,7 @@ impl FallbackSwitch {
|
||||||
.get_segment()
|
.get_segment()
|
||||||
.downcast::<gst::ClockTime>()
|
.downcast::<gst::ClockTime>()
|
||||||
.map_err(|_| {
|
.map_err(|_| {
|
||||||
gst_error!(CAT, obj: agg, "Only TIME segments supported");
|
gst_error!(CAT, obj: preferred_pad, "Only TIME segments supported");
|
||||||
gst::FlowError::Error
|
gst::FlowError::Error
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -331,7 +330,7 @@ impl FallbackSwitch {
|
||||||
if cur_running_time > deadline {
|
if cur_running_time > deadline {
|
||||||
gst_debug!(
|
gst_debug!(
|
||||||
CAT,
|
CAT,
|
||||||
obj: agg,
|
obj: preferred_pad,
|
||||||
"Buffer is too late: {} > {}",
|
"Buffer is too late: {} > {}",
|
||||||
cur_running_time,
|
cur_running_time,
|
||||||
deadline
|
deadline
|
||||||
|
@ -356,7 +355,7 @@ impl FallbackSwitch {
|
||||||
* to the other pad or there's no point outputting this anyway */
|
* to the other pad or there's no point outputting this anyway */
|
||||||
gst_debug!(
|
gst_debug!(
|
||||||
CAT,
|
CAT,
|
||||||
obj: agg,
|
obj: preferred_pad,
|
||||||
"Buffer is too late and timeout reached: {} + {} <= {}",
|
"Buffer is too late and timeout reached: {} + {} <= {}",
|
||||||
state.last_output_time,
|
state.last_output_time,
|
||||||
settings.timeout,
|
settings.timeout,
|
||||||
|
@ -374,7 +373,7 @@ impl FallbackSwitch {
|
||||||
if buffer.get_flags().contains(gst::BufferFlags::DELTA_UNIT) {
|
if buffer.get_flags().contains(gst::BufferFlags::DELTA_UNIT) {
|
||||||
gst_info!(
|
gst_info!(
|
||||||
CAT,
|
CAT,
|
||||||
obj: agg,
|
obj: preferred_pad,
|
||||||
"Can't change back to sinkpad {}, waiting for keyframe",
|
"Can't change back to sinkpad {}, waiting for keyframe",
|
||||||
preferred_pad.get_name()
|
preferred_pad.get_name()
|
||||||
);
|
);
|
||||||
|
@ -386,7 +385,7 @@ impl FallbackSwitch {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_info!(CAT, obj: agg, "Active pad changed to sinkpad");
|
gst_info!(CAT, obj: preferred_pad, "Active pad changed to sinkpad");
|
||||||
*active_sinkpad = Some(preferred_pad.clone().upcast());
|
*active_sinkpad = Some(preferred_pad.clone().upcast());
|
||||||
}
|
}
|
||||||
drop(active_sinkpad);
|
drop(active_sinkpad);
|
||||||
|
@ -405,7 +404,7 @@ impl FallbackSwitch {
|
||||||
|
|
||||||
// Drop all older buffers from the fallback sinkpad
|
// Drop all older buffers from the fallback sinkpad
|
||||||
if let Some(backup_pad) = backup_pad {
|
if let Some(backup_pad) = backup_pad {
|
||||||
self.drain_pad_to_time(&agg, state, &backup_pad, state.last_output_time)?;
|
self.drain_pad_to_time(state, &backup_pad, state.last_output_time)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Some((buffer, active_caps, pad_change)))
|
Ok(Some((buffer, active_caps, pad_change)))
|
||||||
|
@ -413,7 +412,6 @@ impl FallbackSwitch {
|
||||||
|
|
||||||
fn get_backup_buffer(
|
fn get_backup_buffer(
|
||||||
&self,
|
&self,
|
||||||
agg: &super::FallbackSwitch,
|
|
||||||
state: &mut OutputState,
|
state: &mut OutputState,
|
||||||
settings: &Settings,
|
settings: &Settings,
|
||||||
backup_pad: &gst_base::AggregatorPad,
|
backup_pad: &gst_base::AggregatorPad,
|
||||||
|
@ -425,10 +423,15 @@ impl FallbackSwitch {
|
||||||
.pop_buffer()
|
.pop_buffer()
|
||||||
.ok_or(gst_base::AGGREGATOR_FLOW_NEED_DATA)?;
|
.ok_or(gst_base::AGGREGATOR_FLOW_NEED_DATA)?;
|
||||||
|
|
||||||
gst_debug!(CAT, obj: agg, "Got buffer on fallback sinkpad {:?}", buffer);
|
gst_debug!(
|
||||||
|
CAT,
|
||||||
|
obj: backup_pad,
|
||||||
|
"Got buffer on fallback sinkpad {:?}",
|
||||||
|
buffer
|
||||||
|
);
|
||||||
|
|
||||||
if buffer.get_pts().is_none() {
|
if buffer.get_pts().is_none() {
|
||||||
gst_error!(CAT, obj: agg, "Only buffers with PTS supported");
|
gst_error!(CAT, obj: backup_pad, "Only buffers with PTS supported");
|
||||||
return Err(gst::FlowError::Error);
|
return Err(gst::FlowError::Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,7 +439,7 @@ impl FallbackSwitch {
|
||||||
.get_segment()
|
.get_segment()
|
||||||
.downcast::<gst::ClockTime>()
|
.downcast::<gst::ClockTime>()
|
||||||
.map_err(|_| {
|
.map_err(|_| {
|
||||||
gst_error!(CAT, obj: agg, "Only TIME segments supported");
|
gst_error!(CAT, obj: backup_pad, "Only TIME segments supported");
|
||||||
gst::FlowError::Error
|
gst::FlowError::Error
|
||||||
})?;
|
})?;
|
||||||
let running_time = backup_segment.to_running_time(buffer.get_dts_or_pts());
|
let running_time = backup_segment.to_running_time(buffer.get_dts_or_pts());
|
||||||
|
@ -463,7 +466,7 @@ impl FallbackSwitch {
|
||||||
if state.last_output_time + settings.timeout > running_time {
|
if state.last_output_time + settings.timeout > running_time {
|
||||||
gst_debug!(
|
gst_debug!(
|
||||||
CAT,
|
CAT,
|
||||||
obj: agg,
|
obj: backup_pad,
|
||||||
"Timeout not reached yet: {} + {} > {}",
|
"Timeout not reached yet: {} + {} > {}",
|
||||||
state.last_output_time,
|
state.last_output_time,
|
||||||
settings.timeout,
|
settings.timeout,
|
||||||
|
@ -475,7 +478,7 @@ impl FallbackSwitch {
|
||||||
|
|
||||||
gst_debug!(
|
gst_debug!(
|
||||||
CAT,
|
CAT,
|
||||||
obj: agg,
|
obj: backup_pad,
|
||||||
"Timeout reached: {} + {} <= {}",
|
"Timeout reached: {} + {} <= {}",
|
||||||
state.last_output_time,
|
state.last_output_time,
|
||||||
settings.timeout,
|
settings.timeout,
|
||||||
|
@ -489,7 +492,7 @@ impl FallbackSwitch {
|
||||||
if buffer.get_flags().contains(gst::BufferFlags::DELTA_UNIT) {
|
if buffer.get_flags().contains(gst::BufferFlags::DELTA_UNIT) {
|
||||||
gst_info!(
|
gst_info!(
|
||||||
CAT,
|
CAT,
|
||||||
obj: agg,
|
obj: backup_pad,
|
||||||
"Can't change to sinkpad {} yet, waiting for keyframe",
|
"Can't change to sinkpad {} yet, waiting for keyframe",
|
||||||
backup_pad.get_name()
|
backup_pad.get_name()
|
||||||
);
|
);
|
||||||
|
@ -501,7 +504,11 @@ impl FallbackSwitch {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_info!(CAT, obj: agg, "Active pad changed to fallback sinkpad");
|
gst_info!(
|
||||||
|
CAT,
|
||||||
|
obj: backup_pad,
|
||||||
|
"Active pad changed to fallback sinkpad"
|
||||||
|
);
|
||||||
*active_sinkpad = Some(backup_pad.clone().upcast());
|
*active_sinkpad = Some(backup_pad.clone().upcast());
|
||||||
}
|
}
|
||||||
drop(active_sinkpad);
|
drop(active_sinkpad);
|
||||||
|
@ -606,7 +613,6 @@ impl FallbackSwitch {
|
||||||
/* Use a dummy drain_pad_to_time() call to update the last_sinkpad_time */
|
/* Use a dummy drain_pad_to_time() call to update the last_sinkpad_time */
|
||||||
if let Some(backup_pad) = &backup_pad {
|
if let Some(backup_pad) = &backup_pad {
|
||||||
if let Err(e) = self.drain_pad_to_time(
|
if let Err(e) = self.drain_pad_to_time(
|
||||||
&agg,
|
|
||||||
&mut *state,
|
&mut *state,
|
||||||
&backup_pad,
|
&backup_pad,
|
||||||
gst::ClockTime::from_seconds(0),
|
gst::ClockTime::from_seconds(0),
|
||||||
|
@ -647,7 +653,7 @@ impl FallbackSwitch {
|
||||||
)
|
)
|
||||||
} else if let (true, Some(backup_pad)) = (timeout, &backup_pad) {
|
} else if let (true, Some(backup_pad)) = (timeout, &backup_pad) {
|
||||||
(
|
(
|
||||||
self.get_backup_buffer(agg, &mut *state, &settings, backup_pad),
|
self.get_backup_buffer(&mut *state, &settings, backup_pad),
|
||||||
state.check_health_changes(
|
state.check_health_changes(
|
||||||
&settings,
|
&settings,
|
||||||
&Some(backup_pad),
|
&Some(backup_pad),
|
||||||
|
|
Loading…
Reference in a new issue