<div dir='auto'><div><br><div class="gmail_extra"><br><div class="gmail_quote">Le 27 mars 2022 09 h 52, Laurent Pinchart <laurent.pinchart@ideasonboard.com> a écrit :<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">The code block that checks for flow errors in
<br>
gst_libcamera_src_task_run() is located in an inner scope whose purpose
<br>
it to handling locking. The flow error handling however occurs before
<br>
the lock is taken, so there's no need to place it in the inner scope.
<br>
Move it one level up.
<br>
<br>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
<br>
---
<br>
src/gstreamer/gstlibcamerasrc.cpp | 26 +++++++++++++-------------
<br>
1 file changed, 13 insertions(+), 13 deletions(-)
<br>
<br>
diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp
<br>
index 46fd02d207be..8016a98d6a4d 100644
<br>
--- a/src/gstreamer/gstlibcamerasrc.cpp
<br>
+++ b/src/gstreamer/gstlibcamerasrc.cpp
<br>
@@ -311,21 +311,21 @@ gst_libcamera_src_task_run(gpointer user_data)
<br>
srcpad, ret);
<br>
}
<br>
<br>
- {
<br>
- if (ret != GST_FLOW_OK) {
<br>
- if (ret == GST_FLOW_EOS) {
<br>
- g_autoptr(GstEvent) eos = gst_event_new_eos();
<br>
- guint32 seqnum = gst_util_seqnum_next();
<br>
- gst_event_set_seqnum(eos, seqnum);
<br>
- for (GstPad *srcpad : state->srcpads_)</p></blockquote></div></div></div><div dir="auto">Iterating the srcpads_ is not thread safe. Won't this change remove the locking for that ?</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">
<br>
- gst_pad_push_event(srcpad, gst_event_ref(eos));
<br>
- } else if (ret != GST_FLOW_FLUSHING) {
<br>
- GST_ELEMENT_FLOW_ERROR(self, ret);
<br>
- }
<br>
- gst_task_stop(self->task);
<br>
- return;
<br>
+ if (ret != GST_FLOW_OK) {
<br>
+ if (ret == GST_FLOW_EOS) {
<br>
+ g_autoptr(GstEvent) eos = gst_event_new_eos();
<br>
+ guint32 seqnum = gst_util_seqnum_next();
<br>
+ gst_event_set_seqnum(eos, seqnum);
<br>
+ for (GstPad *srcpad : state->srcpads_)
<br>
+ gst_pad_push_event(srcpad, gst_event_ref(eos));
<br>
+ } else if (ret != GST_FLOW_FLUSHING) {
<br>
+ GST_ELEMENT_FLOW_ERROR(self, ret);
<br>
}
<br>
+ gst_task_stop(self->task);
<br>
+ return;
<br>
+ }
<br>
<br>
+ {
<br>
/*
<br>
* Here we need to decide if we want to pause. This needs to
<br>
* happen in lock step with the callback thread which may want
<br>
--
<br>
Regards,
<br>
<br>
Laurent Pinchart
<br>
<br>
</p>
</blockquote></div><br></div></div></div>