mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 13:01:07 +00:00
livesync: Use let-else
in a few more places
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1635>
This commit is contained in:
parent
505fab2e1c
commit
7caf6b2073
1 changed files with 13 additions and 21 deletions
|
@ -651,12 +651,9 @@ impl LiveSync {
|
|||
gst::EventView::Segment(e) => {
|
||||
is_restart = true;
|
||||
|
||||
let segment = match e.segment().downcast_ref() {
|
||||
Some(s) => s,
|
||||
None => {
|
||||
let Some(segment) = e.segment().downcast_ref() else {
|
||||
gst::error!(CAT, imp: self, "Got non-TIME segment");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
let mut state = self.state.lock();
|
||||
|
@ -1218,14 +1215,12 @@ impl LiveSync {
|
|||
}
|
||||
|
||||
fn buffer_is_backwards(&self, state: &State, timestamp: Option<Timestamps>) -> BufferLateness {
|
||||
let timestamp = match timestamp {
|
||||
Some(t) => t,
|
||||
None => return BufferLateness::OnTime,
|
||||
let Some(timestamp) = timestamp else {
|
||||
return BufferLateness::OnTime;
|
||||
};
|
||||
|
||||
let out_timestamp = match state.out_timestamp {
|
||||
Some(t) => t,
|
||||
None => return BufferLateness::OnTime,
|
||||
let Some(out_timestamp) = state.out_timestamp else {
|
||||
return BufferLateness::OnTime;
|
||||
};
|
||||
|
||||
if timestamp.end > out_timestamp.end {
|
||||
|
@ -1246,9 +1241,8 @@ impl LiveSync {
|
|||
None => return BufferLateness::LateUnderThreshold,
|
||||
};
|
||||
|
||||
let in_timestamp = match state.in_timestamp {
|
||||
Some(t) => t,
|
||||
None => return BufferLateness::LateUnderThreshold,
|
||||
let Some(in_timestamp) = state.in_timestamp else {
|
||||
return BufferLateness::LateUnderThreshold;
|
||||
};
|
||||
|
||||
if timestamp.start > in_timestamp.end + late_threshold {
|
||||
|
@ -1259,14 +1253,12 @@ impl LiveSync {
|
|||
}
|
||||
|
||||
fn buffer_is_early(&self, state: &State, timestamp: Option<Timestamps>) -> bool {
|
||||
let timestamp = match timestamp {
|
||||
Some(t) => t,
|
||||
None => return false,
|
||||
let Some(timestamp) = timestamp else {
|
||||
return false;
|
||||
};
|
||||
|
||||
let out_timestamp = match state.out_timestamp {
|
||||
Some(t) => t,
|
||||
None => return false,
|
||||
let Some(out_timestamp) = state.out_timestamp else {
|
||||
return false;
|
||||
};
|
||||
|
||||
// When out_timestamp is set, we also have an out_buffer
|
||||
|
|
Loading…
Reference in a new issue