v4l2videodec: Ensure internal pool are activated

This commit is contained in:
Nicolas Dufresne 2014-03-16 18:39:32 +01:00
parent a8024fef04
commit e9eba56cd3

View file

@ -449,6 +449,7 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder,
} }
if (G_UNLIKELY (!GST_V4L2_IS_ACTIVE (self->v4l2capture))) { if (G_UNLIKELY (!GST_V4L2_IS_ACTIVE (self->v4l2capture))) {
GstBufferPool *pool = GST_BUFFER_POOL (self->v4l2output->pool);
GstVideoInfo info; GstVideoInfo info;
GstVideoCodecState *output_state; GstVideoCodecState *output_state;
GstBuffer *codec_data; GstBuffer *codec_data;
@ -468,6 +469,9 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder,
frame->input_buffer = NULL; frame->input_buffer = NULL;
} }
if (!gst_buffer_pool_set_active (pool, TRUE))
goto activate_failed;
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder); GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
gst_v4l2_object_unlock_stop (self->v4l2output); gst_v4l2_object_unlock_stop (self->v4l2output);
ret = ret =
@ -494,6 +498,11 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder,
else else
goto not_negotiated; goto not_negotiated;
} }
/* Ensure our internal pool is activated */
if (!gst_buffer_pool_set_active (GST_BUFFER_POOL (self->v4l2capture->pool),
TRUE))
goto activate_failed;
} }
if (g_atomic_int_get (&self->processing) == FALSE) { if (g_atomic_int_get (&self->processing) == FALSE) {
@ -542,6 +551,13 @@ not_negotiated:
ret = GST_FLOW_NOT_NEGOTIATED; ret = GST_FLOW_NOT_NEGOTIATED;
goto drop; goto drop;
} }
activate_failed:
{
GST_ELEMENT_ERROR (self, RESOURCE, SETTINGS,
(_("Failed to allocated required memory.")),
("Buffer pool activation failed"));
return GST_FLOW_ERROR;
}
flushing: flushing:
{ {
ret = GST_FLOW_FLUSHING; ret = GST_FLOW_FLUSHING;