diff options
author | Georgii Staroselskii <georgii.staroselskii@emlid.com> | 2017-11-08 12:14:35 +0300 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2020-07-10 18:46:15 +0300 |
commit | b45e23912810617d3f755d640acf475ab7f254d4 (patch) | |
tree | 7868b8e88b379007757188312de763e169bc5d37 /sys | |
parent | 149fdee7fb243e50f02f1c444c921d920a088724 (diff) |
rpicamsrc: RaspiCapture: use mmal_queue_timedwait() for buffer queueing
If an external camera was disconnected, there were no feedback in an
application. It seems reasonable to wait on mmal_queue no longer than
100ms. If it's stuck we just return a FLOW_ERROR and let the application
decide what to do later.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/rpicamsrc/RaspiCapture.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/rpicamsrc/RaspiCapture.c b/sys/rpicamsrc/RaspiCapture.c index cdc6ce21a..1d899cf09 100644 --- a/sys/rpicamsrc/RaspiCapture.c +++ b/sys/rpicamsrc/RaspiCapture.c @@ -938,8 +938,12 @@ raspi_capture_fill_buffer(RASPIVID_STATE *state, GstBuffer **bufp, GstClockTime gst_pts = GST_CLOCK_TIME_NONE; /* FIXME: Use our own interruptible cond wait: */ - buffer = mmal_queue_wait(state->encoded_buffer_q); + buffer = mmal_queue_timedwait(state->encoded_buffer_q, 100); + + if (G_UNLIKELY(buffer == NULL)) { + return GST_FLOW_ERROR; + } if (G_LIKELY (config->useSTC && clock)) { MMAL_PARAMETER_INT64_T param; |