diff options
author | Sven Gothel <[email protected]> | 2014-02-16 06:12:45 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-02-16 06:12:45 +0100 |
commit | e685f79ec7071e266a1bd3d3ce3e742397b5372e (patch) | |
tree | 7328960c34c3083e91ec47793993c686359e0015 /src/jogl/native/libav/ffmpeg_tool.h | |
parent | a6acce1be19060a6a4801582f0534e0d6887467a (diff) |
Bug 927: Fix minor MT issues w/ libav/ffmpeg
Issue:
[NULL @ 0x35bde60] insufficient thread locking around avcodec_open/close()
Decorating said libav functions w/ mutex lock/release.
Abstract impl. to either use pthread or JNI Monitor,
but using the latter to reduce dependencies (ming64 windows).
FFMPEGNatives is now an abstract class containing the
'static final Object mutex_avcodec_openclose'
Diffstat (limited to 'src/jogl/native/libav/ffmpeg_tool.h')
-rw-r--r-- | src/jogl/native/libav/ffmpeg_tool.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/jogl/native/libav/ffmpeg_tool.h b/src/jogl/native/libav/ffmpeg_tool.h index 97e60afce..66c3519e6 100644 --- a/src/jogl/native/libav/ffmpeg_tool.h +++ b/src/jogl/native/libav/ffmpeg_tool.h @@ -64,6 +64,15 @@ typedef struct SwrContext SwrContext; #include <stdio.h> #include <stdlib.h> +// We use JNI Monitor Locking, since this removes the need +// to statically link-in pthreads on window .. +// #define USE_PTHREAD_LOCKING 1 +// +#ifdef USE_PTHREAD_LOCKING + #include <pthread.h> + #error PTHREAD path not tested yet +#endif + #include <GL/gl.h> typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); @@ -148,6 +157,12 @@ typedef struct { PFNGLFLUSH procAddrGLFlush; PFNGLFINISH procAddrGLFinish; + #ifdef USE_PTHREAD_LOCKING + pthread_mutex_t mutex_avcodec_openclose; + #else + jobject mutex_avcodec_openclose; + #endif + AVFormatContext* pFormatCtx; int32_t vid; AVStream* pVStream; |