summaryrefslogtreecommitdiff
path: root/video.c
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2013-01-05 20:44:54 +0100
committerJohns <johns98@gmx.net>2013-01-05 20:44:54 +0100
commitfa09d940c57174c033ea4f65f61d32dda4e834bd (patch)
treea08d9c8c5fc48cc3aa9bba178157ea2e81a6acc8 /video.c
parentd4702b9a9ec1774f546e91958f0752c0c45a632c (diff)
downloadvdr-plugin-softhddevice-fa09d940c57174c033ea4f65f61d32dda4e834bd.tar.gz
vdr-plugin-softhddevice-fa09d940c57174c033ea4f65f61d32dda4e834bd.tar.bz2
Fix PIP threading problems.
Diffstat (limited to 'video.c')
-rw-r--r--video.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/video.c b/video.c
index 463f9a0..b4d2593 100644
--- a/video.c
+++ b/video.c
@@ -8231,6 +8231,7 @@ static void VdpauSyncRenderFrame(VdpauDecoder * decoder,
while (atomic_read(&decoder->SurfacesFilled) >= VIDEO_SURFACES_MAX) {
struct timespec abstime;
+ fprintf(stderr, "video/vdpau: must be removed\n");
pthread_mutex_unlock(&VideoLockMutex);
abstime = decoder->FrameTime;
@@ -8378,6 +8379,7 @@ static void VdpauDisplayHandlerThread(void)
}
decoded = 0;
+ pthread_mutex_lock(&VideoLockMutex);
for (i = 0; i < VdpauDecoderN; ++i) {
int filled;
@@ -8389,10 +8391,8 @@ static void VdpauDisplayHandlerThread(void)
filled = atomic_read(&decoder->SurfacesFilled);
if (filled < VIDEO_SURFACES_MAX) {
// FIXME: hot polling
- pthread_mutex_lock(&VideoLockMutex);
// fetch+decode or reopen
err = VideoDecodeInput(decoder->Stream);
- pthread_mutex_unlock(&VideoLockMutex);
} else {
err = VideoPollInput(decoder->Stream);
}
@@ -8409,6 +8409,7 @@ static void VdpauDisplayHandlerThread(void)
}
decoded = 1;
}
+ pthread_mutex_unlock(&VideoLockMutex);
if (!decoded) { // nothing decoded, sleep
// FIXME: sleep on wakeup
@@ -9459,7 +9460,13 @@ struct _video_hw_decoder_
///
VideoHwDecoder *VideoNewHwDecoder(VideoStream * stream)
{
- return VideoUsedModule->NewHwDecoder(stream);
+ VideoHwDecoder *hw;
+
+ VideoThreadLock();
+ hw = VideoUsedModule->NewHwDecoder(stream);
+ VideoThreadUnlock();
+
+ return hw;
}
///
@@ -9470,7 +9477,9 @@ VideoHwDecoder *VideoNewHwDecoder(VideoStream * stream)
void VideoDelHwDecoder(VideoHwDecoder * hw_decoder)
{
if (hw_decoder) {
+ VideoThreadLock();
VideoUsedModule->DelHwDecoder(hw_decoder);
+ VideoThreadUnlock();
}
}