summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2011-12-11 19:45:21 +0100
committerJohns <johns98@gmx.net>2011-12-11 19:45:21 +0100
commit8853c06375636e6bbc68ce94e186ec7dc7bbbeb5 (patch)
treed93c07f9bb505cde99fa935b6d9db58bb0f9ac1f
parent12da237cc39c445d85606ee67419c0798a896891 (diff)
downloadvdr-plugin-softhddevice-8853c06375636e6bbc68ce94e186ec7dc7bbbeb5.tar.gz
vdr-plugin-softhddevice-8853c06375636e6bbc68ce94e186ec7dc7bbbeb5.tar.bz2
Add guards against cleanup errors.
-rw-r--r--Todo4
-rw-r--r--video.c30
2 files changed, 29 insertions, 5 deletions
diff --git a/Todo b/Todo
index c6c5dbc..87122e8 100644
--- a/Todo
+++ b/Todo
@@ -6,6 +6,8 @@ libva-intel-driver:
libva-vdpau-driver:
G210 osd update too slow (needs hardware problem workaround)
OSD update is too slow
+ hangup on exit (VaapiDelDecoder -> VaapiCleanup
+ -> vaDestroyContext -> pthread_rwlock_wrlock)
x11:
support resize of x11 window
@@ -15,3 +17,5 @@ x11:
video/audio asyncron
playback of >2 channels on 2 channel hardware
+
+playback of recording
diff --git a/video.c b/video.c
index 3a65e74..30dfae3 100644
--- a/video.c
+++ b/video.c
@@ -849,20 +849,21 @@ static void VaapiDestroySurfaces(VaapiDecoder * decoder)
// update OSD associate
//
if (VaOsdSubpicture != VA_INVALID_ID) {
- if (vaDeassociateSubpicture(VaDisplay, VaOsdSubpicture,
+ if (decoder->SurfaceFreeN
+ && vaDeassociateSubpicture(VaDisplay, VaOsdSubpicture,
decoder->SurfacesFree, decoder->SurfaceFreeN)
!= VA_STATUS_SUCCESS) {
Error(_("video/vaapi: can't deassociate %d surfaces\n"),
decoder->SurfaceFreeN);
}
- if (vaDeassociateSubpicture(VaDisplay, VaOsdSubpicture,
+ if (decoder->SurfaceUsedN
+ && vaDeassociateSubpicture(VaDisplay, VaOsdSubpicture,
decoder->SurfacesUsed, decoder->SurfaceUsedN)
!= VA_STATUS_SUCCESS) {
Error(_("video/vaapi: can't deassociate %d surfaces\n"),
decoder->SurfaceUsedN);
}
-
}
if (vaDestroySurfaces(decoder->VaDisplay, decoder->SurfacesFree,
@@ -1135,6 +1136,15 @@ static void VaapiDelDecoder(VaapiDecoder * decoder)
VaapiCleanup(decoder);
if (decoder->BlackSurface != VA_INVALID_ID) {
+ //
+ // update OSD associate
+ //
+ if (VaOsdSubpicture != VA_INVALID_ID) {
+ if (vaDeassociateSubpicture(VaDisplay, VaOsdSubpicture,
+ &decoder->BlackSurface, 1) != VA_STATUS_SUCCESS) {
+ Error(_("video/vaapi: can't deassociate black surfaces\n"));
+ }
+ }
if (vaDestroySurfaces(decoder->VaDisplay, &decoder->BlackSurface, 1)
!= VA_STATUS_SUCCESS) {
Error(_("video/vaapi: can't destroy a surface\n"));
@@ -2410,7 +2420,7 @@ static void VaapiRenderFrame(VaapiDecoder * decoder,
** FIXME: frame delay for 50hz hardcoded
**
*/
-void VaapiDisplayFrame(void)
+static void VaapiDisplayFrame(void)
{
uint32_t start;
uint32_t sync;
@@ -3050,7 +3060,7 @@ static void *VideoDisplayHandlerThread(void *dummy)
video_clock = decoder->PTS - (decoder->Interlaced ? 40 : 20) * 90;
}
- delay = 4 * 500L * 1000 * 1000;
+ delay = 1 * 500L * 1000 * 1000;
clock_gettime(CLOCK_REALTIME, &nowtime);
// wait until we got any surface
@@ -3395,6 +3405,16 @@ void VideoRenderFrame(VideoHwDecoder * decoder, AVCodecContext * video_ctx,
VideoPollEvent();
+ if (!(decoder->Vaapi.FrameCounter % (50 * 10))) {
+ int64_t audio_clock;
+
+ audio_clock = AudioGetClock();
+ Debug(3,
+ "video: %09" PRIx64 "-%09" PRIx64 " pts %+dms %" PRId64 "\n",
+ audio_clock, decoder->Vaapi.PTS,
+ (int)(audio_clock - decoder->Vaapi.PTS) / 90,
+ AudioGetDelay() / 90);
+ }
// give osd some time slot
while (pthread_cond_timedwait(&VideoWakeupCond, &VideoLockMutex,
&abstime) != ETIMEDOUT) {