1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

fixed deadlock in PIP

This commit is contained in:
jojo61 2018-10-05 11:09:55 +02:00
parent c1e5659d35
commit e3d0ccba9a

12
video.c
View File

@ -1764,8 +1764,6 @@ static void CuvidDestroySurfaces(CuvidDecoder * decoder)
glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext); glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext);
GlxCheck(); GlxCheck();
glDeleteBuffers(1,(GLuint *)&vao_buffer);
if (decoder->cuda_ctx) { if (decoder->cuda_ctx) {
checkCudaErrors(cuCtxPushCurrent(decoder->cuda_ctx)); checkCudaErrors(cuCtxPushCurrent(decoder->cuda_ctx));
for (i=0;i<decoder->SurfacesNeeded;i++) { for (i=0;i<decoder->SurfacesNeeded;i++) {
@ -1778,9 +1776,14 @@ static void CuvidDestroySurfaces(CuvidDecoder * decoder)
glDeleteTextures(CODEC_SURFACES_MAX*2,(GLuint*)&decoder->gl_textures); glDeleteTextures(CODEC_SURFACES_MAX*2,(GLuint*)&decoder->gl_textures);
GlxCheck(); GlxCheck();
if (decoder == CuvidDecoders[0]) { // only wenn last decoder closes
Debug(3,"Last decoder closes\n");
glDeleteBuffers(1,(GLuint *)&vao_buffer);
if (gl_prog) if (gl_prog)
glDeleteProgram(gl_prog); glDeleteProgram(gl_prog);
gl_prog = 0; gl_prog = 0;
}
for (i = 0; i < decoder->SurfaceFreeN; ++i) { for (i = 0; i < decoder->SurfaceFreeN; ++i) {
decoder->SurfacesFree[i] = -1; decoder->SurfacesFree[i] = -1;
@ -1978,13 +1981,14 @@ static void CuvidDelHwDecoder(CuvidDecoder * decoder)
{ {
int i,n; int i,n;
Debug(3,"cuvid del hw decoder cuda_ctx %p\n",decoder->cuda_ctx); Debug(3,"cuvid del hw decoder cuda_ctx %p\n",decoder->cuda_ctx);
pthread_mutex_lock(&VideoLockMutex); // pthread_mutex_lock(&VideoLockMutex);
glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext); glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
GlxCheck(); GlxCheck();
if (decoder->SurfaceFreeN || decoder->SurfaceUsedN) { if (decoder->SurfaceFreeN || decoder->SurfaceUsedN) {
CuvidDestroySurfaces(decoder); CuvidDestroySurfaces(decoder);
} }
pthread_mutex_unlock(&VideoLockMutex); // pthread_mutex_unlock(&VideoLockMutex);
#if 0 #if 0
if (decoder->cuda_ctx) { if (decoder->cuda_ctx) {
cuCtxDestroy (decoder->cuda_ctx); cuCtxDestroy (decoder->cuda_ctx);