From ab622153edfd43576768e11feef6fcb5e788c52f Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 31 Aug 2003 12:41:19 +0200 Subject: Now clearing the player device if there are too many poll timeouts in 'Transfer Mode' --- HISTORY | 2 ++ transfer.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/HISTORY b/HISTORY index 07c182c9..75bdca5a 100644 --- a/HISTORY +++ b/HISTORY @@ -2346,3 +2346,5 @@ Video Disk Recorder Revision History menus with the DVD plugin. - Fixed handling extra blanks in plugin command lines. - Actually implemented the SVDRP command DELC. +- Now clearing the player device if there are too many poll timeouts in 'Transfer + Mode', which avoids buffer overflows and black screens in such cases. diff --git a/transfer.c b/transfer.c index 12512c33..3e24dccd 100644 --- a/transfer.c +++ b/transfer.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: transfer.c 1.13 2003/05/18 15:15:00 kls Exp $ + * $Id: transfer.c 1.14 2003/08/31 12:19:16 kls Exp $ */ #include "transfer.h" @@ -13,6 +13,7 @@ // The size of the array used to buffer video data: // (must be larger than MINVIDEODATA - see remux.h) #define VIDEOBUFSIZE MEGABYTE(1) +#define POLLTIMEOUTS_BEFORE_DEVICECLEAR 3 // --- cTransfer ------------------------------------------------------------- @@ -67,6 +68,7 @@ void cTransfer::Action(void) { dsyslog("transfer thread started (pid=%d)", getpid()); + int PollTimeouts = 0; active = true; while (active) { @@ -99,6 +101,7 @@ void cTransfer::Action(void) while (Result > 0 && active) { cPoller Poller; if (DevicePoll(Poller, 100)) { + PollTimeouts = 0; int w = PlayVideo(p, Result); if (w > 0) { p += w; @@ -109,6 +112,13 @@ void cTransfer::Action(void) break; } } + else { + PollTimeouts++; + if (PollTimeouts == POLLTIMEOUTS_BEFORE_DEVICECLEAR) { + dsyslog("clearing device because of consecutive poll timeouts"); + DeviceClear(); + } + } } } } -- cgit v1.2.3