summaryrefslogtreecommitdiff
path: root/transfer.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2003-02-15 14:12:41 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2003-02-15 14:12:41 +0100
commitf721c85b46dcf641b4e9e4ba9382c8321160b805 (patch)
treeff461a1af48ea9d62661d248f79d8280886b994e /transfer.c
parent05e2966b351153df4e92f0db24789af64cdf2d06 (diff)
downloadvdr-f721c85b46dcf641b4e9e4ba9382c8321160b805.tar.gz
vdr-f721c85b46dcf641b4e9e4ba9382c8321160b805.tar.bz2
Now polling the output device in 'Transfer Mode' and retrying to put packets into the ring buffer
Diffstat (limited to 'transfer.c')
-rw-r--r--transfer.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/transfer.c b/transfer.c
index abcb9d08..4e8c3031 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.9 2003/01/26 09:59:35 kls Exp $
+ * $Id: transfer.c 1.10 2003/02/15 14:12:41 kls Exp $
*/
#include "transfer.h"
@@ -50,9 +50,16 @@ void cTransfer::Activate(bool On)
void cTransfer::Receive(uchar *Data, int Length)
{
if (IsAttached()) {
- int p = ringBuffer->Put(Data, Length);
- if (p != Length && active)
- esyslog("ERROR: ring buffer overflow (%d bytes dropped)", Length - p);
+ int i = 0;
+ while (active && Length > 0) {
+ if (i++ > 10) {
+ esyslog("ERROR: ring buffer overflow (%d bytes dropped)", Length);
+ break;
+ }
+ int p = ringBuffer->Put(Data, Length);
+ Length -= p;
+ Data += p;
+ }
}
}
@@ -90,14 +97,17 @@ void cTransfer::Action(void)
if (p) {
StripAudioPackets(p, Result, audioTrack);
while (Result > 0 && active) {
- int w = PlayVideo(p, Result);
- if (w > 0) {
- p += w;
- Result -= w;
- }
- else if (w < 0 && FATALERRNO) {
- LOG_ERROR;
- break;
+ cPoller Poller;
+ if (DevicePoll(Poller, 100)) {
+ int w = PlayVideo(p, Result);
+ if (w > 0) {
+ p += w;
+ Result -= w;
+ }
+ else if (w < 0 && FATALERRNO) {
+ LOG_ERROR;
+ break;
+ }
}
}
}