summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2014-04-09 10:56:16 +0100
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2014-04-09 10:57:04 +0100
commit517252e110d758bd74c783310deb21042c1406b9 (patch)
tree2b6373657a3c0d90b263a3b8042ca8392e7eb13b /sys
parent3aba455c5e9d57ed94f45e04604c1c698d71981b (diff)
mfc: reset "in use" flag on failure to initialize
Diffstat (limited to 'sys')
-rw-r--r--sys/mfc/mfc_decoder/mfc_decoder.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/mfc/mfc_decoder/mfc_decoder.c b/sys/mfc/mfc_decoder/mfc_decoder.c
index 85fa52d2a..10eaf825f 100644
--- a/sys/mfc/mfc_decoder/mfc_decoder.c
+++ b/sys/mfc/mfc_decoder/mfc_decoder.c
@@ -294,14 +294,14 @@ struct mfc_dec_context* mfc_dec_create(unsigned int codec)
ctx = calloc(1, sizeof (struct mfc_dec_context));
if (!ctx) {
GST_ERROR ("Unable to allocate memory for context");
- return NULL;
+ goto early_error;
}
ctx->output_frames_available = 0;
if (stat (MFC_PATH, &sb) < 0) {
GST_INFO ("MFC device node doesn't exist, failing quietly");
free(ctx);
- return NULL;
+ goto early_error;
}
GST_INFO ("Opening MFC device node at: %s", MFC_PATH);
@@ -309,7 +309,7 @@ struct mfc_dec_context* mfc_dec_create(unsigned int codec)
if (ctx->fd == -1) {
GST_WARNING ("Unable to open MFC device node: %d", errno);
free(ctx);
- return NULL;
+ goto early_error;
}
if (ioctl (ctx->fd, VIDIOC_QUERYCAP, &caps) < 0) {
@@ -331,6 +331,12 @@ struct mfc_dec_context* mfc_dec_create(unsigned int codec)
return NULL;
}
return ctx;
+
+early_error:
+ pthread_mutex_lock(&mutex);
+ mfc_in_use = 0;
+ pthread_mutex_unlock(&mutex);
+ return NULL;
}
static int get_output_format(struct mfc_dec_context *ctx)