summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBing Song <bing.song@nxp.com>2021-02-04 13:43:17 +0800
committerTim-Philipp Müller <tim@centricular.com>2021-02-16 11:54:49 +0000
commit7da5e6a4a0702c186663035adb55170d53f038c8 (patch)
treeb4617dec7f1100da11d4f4d3301eb1828c9f50c4
parent5486a60e245493190b5b3feda1839f55a5c0e011 (diff)
downloadgstreamer-plugins-good-7da5e6a4a0702c186663035adb55170d53f038c8.tar.gz
v4l2videoenc: support resolution change stream encode.
Resolution change stream transcoding will drain before send new video frame buffer. Need encode video frame after process EOS. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/872>
-rw-r--r--sys/v4l2/gstv4l2videoenc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/v4l2/gstv4l2videoenc.c b/sys/v4l2/gstv4l2videoenc.c
index a6c44cbc6..d43f649d6 100644
--- a/sys/v4l2/gstv4l2videoenc.c
+++ b/sys/v4l2/gstv4l2videoenc.c
@@ -738,10 +738,13 @@ gst_v4l2_video_enc_handle_frame (GstVideoEncoder * encoder,
if (task_state == GST_TASK_STOPPED || task_state == GST_TASK_PAUSED) {
GstBufferPool *pool = GST_BUFFER_POOL (self->v4l2output->pool);
- /* It possible that the processing thread stopped due to an error */
+ /* It is possible that the processing thread stopped due to an error or
+ * when the last buffer has been met during the draining process. */
if (self->output_flow != GST_FLOW_OK &&
- self->output_flow != GST_FLOW_FLUSHING) {
- GST_DEBUG_OBJECT (self, "Processing loop stopped with error, leaving");
+ self->output_flow != GST_FLOW_FLUSHING &&
+ self->output_flow != GST_V4L2_FLOW_LAST_BUFFER) {
+ GST_DEBUG_OBJECT (self, "Processing loop stopped with error: %s, leaving",
+ gst_flow_get_name (self->output_flow));
ret = self->output_flow;
goto drop;
}