mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-22 11:30:59 +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) => {
|
gst::EventView::Segment(e) => {
|
||||||
is_restart = true;
|
is_restart = true;
|
||||||
|
|
||||||
let segment = match e.segment().downcast_ref() {
|
let Some(segment) = e.segment().downcast_ref() else {
|
||||||
Some(s) => s,
|
gst::error!(CAT, imp: self, "Got non-TIME segment");
|
||||||
None => {
|
return false;
|
||||||
gst::error!(CAT, imp: self, "Got non-TIME segment");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut state = self.state.lock();
|
let mut state = self.state.lock();
|
||||||
|
@ -1218,14 +1215,12 @@ impl LiveSync {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn buffer_is_backwards(&self, state: &State, timestamp: Option<Timestamps>) -> BufferLateness {
|
fn buffer_is_backwards(&self, state: &State, timestamp: Option<Timestamps>) -> BufferLateness {
|
||||||
let timestamp = match timestamp {
|
let Some(timestamp) = timestamp else {
|
||||||
Some(t) => t,
|
return BufferLateness::OnTime;
|
||||||
None => return BufferLateness::OnTime,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let out_timestamp = match state.out_timestamp {
|
let Some(out_timestamp) = state.out_timestamp else {
|
||||||
Some(t) => t,
|
return BufferLateness::OnTime;
|
||||||
None => return BufferLateness::OnTime,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if timestamp.end > out_timestamp.end {
|
if timestamp.end > out_timestamp.end {
|
||||||
|
@ -1246,9 +1241,8 @@ impl LiveSync {
|
||||||
None => return BufferLateness::LateUnderThreshold,
|
None => return BufferLateness::LateUnderThreshold,
|
||||||
};
|
};
|
||||||
|
|
||||||
let in_timestamp = match state.in_timestamp {
|
let Some(in_timestamp) = state.in_timestamp else {
|
||||||
Some(t) => t,
|
return BufferLateness::LateUnderThreshold;
|
||||||
None => return BufferLateness::LateUnderThreshold,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if timestamp.start > in_timestamp.end + late_threshold {
|
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 {
|
fn buffer_is_early(&self, state: &State, timestamp: Option<Timestamps>) -> bool {
|
||||||
let timestamp = match timestamp {
|
let Some(timestamp) = timestamp else {
|
||||||
Some(t) => t,
|
return false;
|
||||||
None => return false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let out_timestamp = match state.out_timestamp {
|
let Some(out_timestamp) = state.out_timestamp else {
|
||||||
Some(t) => t,
|
return false;
|
||||||
None => return false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// When out_timestamp is set, we also have an out_buffer
|
// When out_timestamp is set, we also have an out_buffer
|
||||||
|
|
Loading…
Reference in a new issue