1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Now polling the output device in 'Transfer Mode' and retrying to put packets into the ring buffer

This commit is contained in:
Klaus Schmidinger 2003-02-15 14:12:41 +01:00
parent 05e2966b35
commit f721c85b46
2 changed files with 24 additions and 12 deletions

View File

@ -1962,3 +1962,5 @@ Video Disk Recorder Revision History
- Fixed high CPU load during replay (thanks Marcel Wiesweg for pointing out this - Fixed high CPU load during replay (thanks Marcel Wiesweg for pointing out this
one). one).
- Fixed margin handling in cRingBufferLinear. - Fixed margin handling in cRingBufferLinear.
- Now polling the output device in 'Transfer Mode' and retrying to put packets
into the ring buffer.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "transfer.h"
@ -50,9 +50,16 @@ void cTransfer::Activate(bool On)
void cTransfer::Receive(uchar *Data, int Length) void cTransfer::Receive(uchar *Data, int Length)
{ {
if (IsAttached()) { if (IsAttached()) {
int p = ringBuffer->Put(Data, Length); int i = 0;
if (p != Length && active) while (active && Length > 0) {
esyslog("ERROR: ring buffer overflow (%d bytes dropped)", Length - p); 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) { if (p) {
StripAudioPackets(p, Result, audioTrack); StripAudioPackets(p, Result, audioTrack);
while (Result > 0 && active) { while (Result > 0 && active) {
int w = PlayVideo(p, Result); cPoller Poller;
if (w > 0) { if (DevicePoll(Poller, 100)) {
p += w; int w = PlayVideo(p, Result);
Result -= w; if (w > 0) {
} p += w;
else if (w < 0 && FATALERRNO) { Result -= w;
LOG_ERROR; }
break; else if (w < 0 && FATALERRNO) {
LOG_ERROR;
break;
}
} }
} }
} }