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

Checking the return value of '...FileReady...' calls in dvbapi.c for better performance under heavy system load

This commit is contained in:
Klaus Schmidinger 2002-03-29 11:43:58 +01:00
parent d9b6236191
commit 0358b2abb8
2 changed files with 58 additions and 53 deletions

View File

@ -1141,3 +1141,5 @@ Video Disk Recorder Revision History
- New command command line option '-V' to display the VDR version. - New command command line option '-V' to display the VDR version.
- Adjusting column width for channel numbers in case there are more than 999 - Adjusting column width for channel numbers in case there are more than 999
channels. channels.
- Checking the return value of '...FileReady...' calls in dvbapi.c for better
performance under heavy system load.

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: dvbapi.c 1.165 2002/03/23 16:15:00 kls Exp $ * $Id: dvbapi.c 1.166 2002/03/29 11:32:47 kls Exp $
*/ */
#include "dvbapi.h" #include "dvbapi.h"
@ -525,6 +525,7 @@ void cRecordBuffer::Input(void)
time_t t = time(NULL); time_t t = time(NULL);
recording = true; recording = true;
for (;;) { for (;;) {
if (cFile::FileReady(videoDev, 100)) {
int r = read(videoDev, b, sizeof(b)); int r = read(videoDev, b, sizeof(b));
if (r > 0) { if (r > 0) {
uchar *p = b; uchar *p = b;
@ -545,12 +546,12 @@ void cRecordBuffer::Input(void)
} }
} }
} }
}
if (time(NULL) - t > MAXBROKENTIMEOUT) { if (time(NULL) - t > MAXBROKENTIMEOUT) {
esyslog(LOG_ERR, "ERROR: video data stream broken"); esyslog(LOG_ERR, "ERROR: video data stream broken");
cThread::EmergencyExit(true); cThread::EmergencyExit(true);
t = time(NULL); t = time(NULL);
} }
cFile::FileReady(videoDev, 100);
if (!recording) if (!recording)
break; break;
} }
@ -790,7 +791,7 @@ void cPlayBuffer::Output(void)
const uchar *p = frame->Data(); const uchar *p = frame->Data();
int r = frame->Count(); int r = frame->Count();
while (r > 0 && Busy() && !blockOutput) { while (r > 0 && Busy() && !blockOutput) {
cFile::FileReadyForWriting(videoDev, 100); if (cFile::FileReadyForWriting(videoDev, 100)) {
int w = write(videoDev, p, r); int w = write(videoDev, p, r);
if (w > 0) { if (w > 0) {
p += w; p += w;
@ -802,6 +803,7 @@ void cPlayBuffer::Output(void)
return; return;
} }
} }
}
writeIndex = frame->Index(); writeIndex = frame->Index();
backTrace.Add(frame->Index(), frame->Count()); backTrace.Add(frame->Index(), frame->Count());
} }
@ -1370,7 +1372,7 @@ void cTransferBuffer::Input(void)
uchar b[MINVIDEODATA]; uchar b[MINVIDEODATA];
int n = 0; int n = 0;
while (Busy()) { while (Busy()) {
cFile::FileReady(fromDevice, 100); if (cFile::FileReady(fromDevice, 100)) {
int r = read(fromDevice, b + n, sizeof(b) - n); int r = read(fromDevice, b + n, sizeof(b) - n);
if (r > 0) { if (r > 0) {
n += r; n += r;
@ -1399,6 +1401,7 @@ void cTransferBuffer::Input(void)
} }
} }
} }
}
dsyslog(LOG_INFO, "input thread ended (pid=%d)", getpid()); dsyslog(LOG_INFO, "input thread ended (pid=%d)", getpid());
} }