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,72 +321,68 @@ 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();
|
||||||
|
|
||||||
first_frame = false;
|
if matches!(frame, Frame::Video(_) | Frame::Audio(_)) {
|
||||||
let discont = first_video_frame;
|
first_frame = false;
|
||||||
first_video_frame = false;
|
}
|
||||||
|
|
||||||
gst::debug!(
|
match frame {
|
||||||
CAT,
|
Frame::Video(frame) => {
|
||||||
obj = element,
|
let discont = first_video_frame;
|
||||||
"Received video frame at timecode {}: {:?}",
|
first_video_frame = false;
|
||||||
(frame.timecode() as u64 * 100).nseconds(),
|
|
||||||
frame,
|
|
||||||
);
|
|
||||||
|
|
||||||
Ok(Buffer::Video {
|
gst::debug!(
|
||||||
frame,
|
CAT,
|
||||||
discont,
|
obj = element,
|
||||||
receive_time_gst,
|
"Received video frame at timecode {}: {:?}",
|
||||||
receive_time_real,
|
(frame.timecode() as u64 * 100).nseconds(),
|
||||||
})
|
frame,
|
||||||
} else {
|
);
|
||||||
Err(gst::FlowError::Flushing)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
first_audio_frame = false;
|
|
||||||
|
|
||||||
gst::debug!(
|
Ok(Buffer::Video {
|
||||||
CAT,
|
frame,
|
||||||
obj = element,
|
discont,
|
||||||
"Received audio frame at timecode {}: {:?}",
|
receive_time_gst,
|
||||||
(frame.timecode() as u64 * 100).nseconds(),
|
receive_time_real,
|
||||||
frame,
|
})
|
||||||
);
|
}
|
||||||
|
Frame::Audio(frame) => {
|
||||||
|
let discont = first_audio_frame;
|
||||||
|
first_audio_frame = false;
|
||||||
|
|
||||||
Ok(Buffer::Audio {
|
gst::debug!(
|
||||||
frame,
|
CAT,
|
||||||
discont,
|
obj = element,
|
||||||
receive_time_gst,
|
"Received audio frame at timecode {}: {:?}",
|
||||||
receive_time_real,
|
(frame.timecode() as u64 * 100).nseconds(),
|
||||||
})
|
frame,
|
||||||
} else {
|
);
|
||||||
Err(gst::FlowError::Flushing)
|
|
||||||
}
|
Ok(Buffer::Audio {
|
||||||
}
|
frame,
|
||||||
Ok(Some(Frame::Metadata(frame))) => {
|
discont,
|
||||||
if let Some(receive_time_gst) = element.current_running_time() {
|
receive_time_gst,
|
||||||
let receive_time_real = (glib::real_time() as u64 * 1000).nseconds();
|
receive_time_real,
|
||||||
gst::debug!(
|
})
|
||||||
CAT,
|
}
|
||||||
obj = element,
|
Frame::Metadata(frame) => {
|
||||||
"Received metadata frame at timecode {}: {:?}",
|
gst::debug!(
|
||||||
(frame.timecode() as u64 * 100).nseconds(),
|
CAT,
|
||||||
frame,
|
obj = element,
|
||||||
);
|
"Received metadata frame at timecode {}: {:?}",
|
||||||
Ok(Buffer::Metadata {
|
(frame.timecode() as u64 * 100).nseconds(),
|
||||||
frame,
|
frame,
|
||||||
receive_time_gst,
|
);
|
||||||
receive_time_real,
|
Ok(Buffer::Metadata {
|
||||||
})
|
frame,
|
||||||
|
receive_time_gst,
|
||||||
|
receive_time_real,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Err(gst::FlowError::Flushing)
|
Err(gst::FlowError::Flushing)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue