mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
v4l2videodec: use decoder stop command instead of queueing empty buffers
Only if the decoder stop command fails, keep queueing empty buffers to signal end of stream as before. https://bugzilla.gnome.org/show_bug.cgi?id=733864
This commit is contained in:
parent
ddf7d9d6de
commit
96d82357f2
1 changed files with 21 additions and 8 deletions
|
@ -336,15 +336,28 @@ gst_v4l2_video_dec_finish (GstVideoDecoder * decoder)
|
|||
|
||||
GST_DEBUG_OBJECT (self, "Finishing decoding");
|
||||
|
||||
/* Keep queuing empty buffers until the processing thread has stopped,
|
||||
* _pool_process() will return FLUSHING when that happened */
|
||||
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
|
||||
while (ret == GST_FLOW_OK) {
|
||||
buffer = gst_buffer_new ();
|
||||
ret =
|
||||
gst_v4l2_buffer_pool_process (GST_V4L2_BUFFER_POOL (self->
|
||||
v4l2output->pool), &buffer);
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
if (gst_v4l2_decoder_cmd (self->v4l2output, V4L2_DEC_CMD_STOP, 0)) {
|
||||
GstTask *task = decoder->srcpad->task;
|
||||
|
||||
/* If the decoder stop command succeeded, just wait until processing is
|
||||
* finished */
|
||||
GST_OBJECT_LOCK (task);
|
||||
while (GST_TASK_STATE (task) == GST_TASK_STARTED)
|
||||
GST_TASK_WAIT (task);
|
||||
GST_OBJECT_UNLOCK (task);
|
||||
ret = GST_FLOW_FLUSHING;
|
||||
} else {
|
||||
/* otherwise keep queuing empty buffers until the processing thread has
|
||||
* stopped, _pool_process() will return FLUSHING when that happened */
|
||||
while (ret == GST_FLOW_OK) {
|
||||
buffer = gst_buffer_new ();
|
||||
ret =
|
||||
gst_v4l2_buffer_pool_process (GST_V4L2_BUFFER_POOL (self->
|
||||
v4l2output->pool), &buffer);
|
||||
gst_buffer_unref (buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/* and ensure the processing thread has stopped in case another error
|
||||
|
|
Loading…
Reference in a new issue