Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implement ffmpeg mutex locking. Thanks Mehmetali and 264tnt for the p…

…atches\!
  • Loading branch information...
commit 02f0759d6c2485538268a55f71dc1f6967084fd7 1 parent 1bd5346
@skinkie skinkie authored
Showing with 33 additions and 0 deletions.
  1. +33 −0 cherokee/handler_streaming.c
View
33 cherokee/handler_streaming.c
@@ -536,6 +536,36 @@ cherokee_handler_streaming_step (cherokee_handler_streaming_t *hdl,
}
+/* Lock manager
+ */
+
+#ifdef HAVE_PTHREAD
+static int ff_lockmgr(void **mutex, enum AVLockOp op)
+{
+ CHEROKEE_MUTEX_T(**pmutex) = (void*)mutex;
+
+ switch (op) {
+ case AV_LOCK_CREATE:
+ *pmutex = malloc(sizeof(**pmutex));
+ CHEROKEE_MUTEX_INIT(*pmutex, NULL);
+ break;
+ case AV_LOCK_OBTAIN:
+ CHEROKEE_MUTEX_LOCK(*pmutex);
+ break;
+ case AV_LOCK_RELEASE:
+ CHEROKEE_MUTEX_UNLOCK(*pmutex);
+ break;
+ case AV_LOCK_DESTROY:
+ CHEROKEE_MUTEX_DESTROY(*pmutex);
+ free(*pmutex);
+ break;
+ }
+
+ return 0;
+}
+#endif
+
+
/* Library init function
*/
static cherokee_boolean_t _streaming_is_init = false;
@@ -557,4 +587,7 @@ PLUGIN_INIT_NAME(streaming) (cherokee_plugin_loader_t *loader)
/* Initialize FFMpeg
*/
av_register_all();
+#ifdef HAVE_PTHREAD
+ av_lockmgr_register(ff_lockmgr);
+#endif
}
Please sign in to comment.
Something went wrong with that request. Please try again.