From 3611fd65c946c771914f8d2dae16b96c1ddb6545 Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sun, 10 Jun 2012 16:00:33 +0200 Subject: [PATCH] Fix infinite loop in OSD --- osdopengl.cc | 20 ++++++++++++++------ videovpeogl.cc | 5 +++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/osdopengl.cc b/osdopengl.cc index d835570..1547caf 100755 --- a/osdopengl.cc +++ b/osdopengl.cc @@ -403,13 +403,11 @@ void OsdOpenGL::threadMethod() //glmutex.Unlock(); VPEOGLFrame *frame=NULL; - struct timespec ts; - ts.tv_sec=0; - ts.tv_nsec=0; + int ts=0; VideoVPEOGL* video =(VideoVPEOGL*) Video::getInstance(); while (true) { - ts.tv_nsec=10*1000000LL; + ts=10; unsigned int waittime=10; if (initted){ if (!frame) frame=video->getReadyOGLFrame(); @@ -427,9 +425,19 @@ void OsdOpenGL::threadMethod() } frame=video->getReadyOGLFrame(); } - if (frame) ts.tv_nsec=0; + + if (frame) ts=0; threadCheckExit(); - if (ts.tv_nsec!=0) threadWaitForSignalTimed(&ts); + if (ts!=0) { + struct timespec target_time; + clock_gettime(CLOCK_REALTIME,&target_time); + target_time.tv_nsec+=1000000LL*ts; + if (target_time.tv_nsec>999999999) { + target_time.tv_nsec-=1000000000L; + target_time.tv_sec+=1; + } + threadWaitForSignalTimed(&target_time); + } //Sleep(1); } //eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); diff --git a/videovpeogl.cc b/videovpeogl.cc index f528687..938fea8 100755 --- a/videovpeogl.cc +++ b/videovpeogl.cc @@ -47,8 +47,9 @@ VideoVPEOGL::VideoVPEOGL() dec_frame_libav_uploading=NULL; dec_frame_libav_decoding=NULL; ogl_frame_outside=false; - //decoding_mode=VPE_NO_XVMC; - decoding_mode=VPE_XVMC_MOCOMP; + decoding_mode=VPE_NO_XVMC; + //decoding_mode=VPE_XVMC_MOCOMP; + //decoding_mode=VPE_XVMC_IDCT; framebuf_framenum=0; #endif -- 2.39.5