summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schmirler <vdr@schmirler.de>2015-01-24 00:49:51 +0100
committerFrank Schmirler <vdr@schmirler.de>2015-01-24 00:49:51 +0100
commit3e06c59196c78fa9c807744621fc173a02890da3 (patch)
treed7c413ce8c12658679aa1e7b0e344a265b56d7e7
parentb33d2631df753bf4918f7967404620d5e605f967 (diff)
downloadvdr-plugin-streamdev-3e06c59196c78fa9c807744621fc173a02890da3.tar.gz
vdr-plugin-streamdev-3e06c59196c78fa9c807744621fc173a02890da3.tar.bz2
make sure TimedWrite(...) doesn't return failure after a slow but successful
write operation (refs #2045)
-rw-r--r--CONTRIBUTORS1
-rw-r--r--HISTORY2
-rw-r--r--tools/source.c14
3 files changed, 10 insertions, 7 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 6f26cb7..92bf691 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -240,6 +240,7 @@ Martin1234
Toerless Eckert
for converting suspend.dat into proper PES format
for investigating and fixing problems caused by filter streaming
+ for fixing TimedWrite() so it doesn't fail after a slow but successful write
Tomasz Maciej Nowak
for providing Polish language texts
diff --git a/HISTORY b/HISTORY
index 0a4f03a..7438191 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,6 +1,8 @@
VDR Plugin 'streamdev' Revision History
---------------------------------------
+- make sure TimedWrite(...) doesn't return failure after a slow but successful
+ write operation (thanks to Toerless Eckert)
- fixed problems related to VTP filter streaming like ringbuffer overflows,
stuttering or aborting video stream (thanks to Toerless Eckert)
- added Polish translation (thanks to Tomasz Maciej Nowak)
diff --git a/tools/source.c b/tools/source.c
index 8a6b5f5..954405a 100644
--- a/tools/source.c
+++ b/tools/source.c
@@ -57,15 +57,20 @@ ssize_t cTBSource::Write(const void *Buffer, size_t Length) {
bool cTBSource::TimedWrite(const void *Buffer, size_t Length, uint TimeoutMs) {
cTBSelect sel;
int ms, offs;
-
cTimeMs starttime;
- ms = TimeoutMs;
+
offs = 0;
sel.Clear();
sel.Add(m_Filed, true);
while (Length > 0) {
int b;
+ ms = TimeoutMs - starttime.Elapsed();
+ if (ms <= 0) {
+ errno = ETIMEDOUT;
+ return false;
+ }
+
if (sel.Select(ms) == -1)
return false;
@@ -76,11 +81,6 @@ bool cTBSource::TimedWrite(const void *Buffer, size_t Length, uint TimeoutMs) {
Length -= b;
}
- ms = TimeoutMs - starttime.Elapsed();
- if (ms <= 0) {
- errno = ETIMEDOUT;
- return false;
- }
}
return true;
}