mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 04:51:26 +00:00
ndisrc: receiver: Remove some code duplication
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1727>
This commit is contained in:
parent
f2658eb773
commit
84fef267b5
1 changed files with 55 additions and 59 deletions
|
@ -321,11 +321,16 @@ impl Receiver {
|
||||||
gst::debug!(CAT, obj = element, "No frame received yet, retry");
|
gst::debug!(CAT, obj = element, "No frame received yet, retry");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Ok(Some(Frame::Video(frame))) => {
|
Ok(Some(frame)) => {
|
||||||
if let Some(receive_time_gst) = element.current_running_time() {
|
if let Some(receive_time_gst) = element.current_running_time() {
|
||||||
let receive_time_real = (glib::real_time() as u64 * 1000).nseconds();
|
let receive_time_real = (glib::real_time() as u64 * 1000).nseconds();
|
||||||
|
|
||||||
|
if matches!(frame, Frame::Video(_) | Frame::Audio(_)) {
|
||||||
first_frame = false;
|
first_frame = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
match frame {
|
||||||
|
Frame::Video(frame) => {
|
||||||
let discont = first_video_frame;
|
let discont = first_video_frame;
|
||||||
first_video_frame = false;
|
first_video_frame = false;
|
||||||
|
|
||||||
|
@ -343,14 +348,8 @@ impl Receiver {
|
||||||
receive_time_gst,
|
receive_time_gst,
|
||||||
receive_time_real,
|
receive_time_real,
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
Err(gst::FlowError::Flushing)
|
|
||||||
}
|
}
|
||||||
}
|
Frame::Audio(frame) => {
|
||||||
Ok(Some(Frame::Audio(frame))) => {
|
|
||||||
if let Some(receive_time_gst) = element.current_running_time() {
|
|
||||||
let receive_time_real = (glib::real_time() as u64 * 1000).nseconds();
|
|
||||||
first_frame = false;
|
|
||||||
let discont = first_audio_frame;
|
let discont = first_audio_frame;
|
||||||
first_audio_frame = false;
|
first_audio_frame = false;
|
||||||
|
|
||||||
|
@ -368,13 +367,8 @@ impl Receiver {
|
||||||
receive_time_gst,
|
receive_time_gst,
|
||||||
receive_time_real,
|
receive_time_real,
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
Err(gst::FlowError::Flushing)
|
|
||||||
}
|
}
|
||||||
}
|
Frame::Metadata(frame) => {
|
||||||
Ok(Some(Frame::Metadata(frame))) => {
|
|
||||||
if let Some(receive_time_gst) = element.current_running_time() {
|
|
||||||
let receive_time_real = (glib::real_time() as u64 * 1000).nseconds();
|
|
||||||
gst::debug!(
|
gst::debug!(
|
||||||
CAT,
|
CAT,
|
||||||
obj = element,
|
obj = element,
|
||||||
|
@ -387,6 +381,8 @@ impl Receiver {
|
||||||
receive_time_gst,
|
receive_time_gst,
|
||||||
receive_time_real,
|
receive_time_real,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Err(gst::FlowError::Flushing)
|
Err(gst::FlowError::Flushing)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue