diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2002-04-21 18:00:00 +0200 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2002-04-21 18:00:00 +0200 |
commit | cfac68ee8458c6b51e638dd787d931bd5baad57a (patch) | |
tree | 20e5840f818a567a675b099272f42e6c7d51d751 /ringbuffer.c | |
parent | c9a5d8ea5328e4a8bcb0c3423b825c02cb0c3b27 (diff) | |
download | vdr-patch-lnbsharing-cfac68ee8458c6b51e638dd787d931bd5baad57a.tar.gz vdr-patch-lnbsharing-cfac68ee8458c6b51e638dd787d931bd5baad57a.tar.bz2 |
Version 1.0.1vdr-1.0.1
- Added some DVB-T channels for Berlin (Germany) to channels.conf.terr (thanks to
Andreas Roedl).
- Implemented enhanced string editing with upper-/lowercase, insert/overwrite
and delete (thanks to Sergei Haller).
- Fixed color palette handling on "big endian" systems (thanks to Jean Martin
for pointing out this one).
- Updated the "Blue Movie" channels to the new "Premiere Erotik" (thanks to
Thilo Wunderlich). NOTE: this adds a new channel to 'channels.conf', so that
any timers referencing a channel with a number higher than 102 should be
checked and adapted if necessary (this only applies if you are using the default
'channels.conf').
- Improved thread locking in the ring buffer to avoid possible race conditions
under heavy load (thanks to Werner Fink).
- Fixed a crash when selecting the "Jump" function directly after setting an
editing mark (thanks to Steffen Koch for reporting and Stefan Huelswitt for
fixing this one).
- Fixed some missing ',' in i18n.c (thanks to Matthias Hilbig).
- Fixed a possible endless loop in shifting recordings between DVB cards (thanks
to Stefan Huelswitt for reporting this one).
- Updated the Premiere World Formula 1 channels in 'channels.conf' (thanks to Mel
Schächner).
- No longer setting PIDs 0x1FFF, which apparently fixes problems with CAMs and
AC3 sound only working the first time (thanks to Stefan Huelswitt).
- Now encoding '.' at the end of a directory name in case of VFAT=1, since Windows
can't handle these (thanks to Simon Dean for reporting this one).
Diffstat (limited to 'ringbuffer.c')
-rw-r--r-- | ringbuffer.c | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/ringbuffer.c b/ringbuffer.c index 8b8420c..a52683d 100644 --- a/ringbuffer.c +++ b/ringbuffer.c @@ -7,7 +7,7 @@ * Parts of this file were inspired by the 'ringbuffy.c' from the * LinuxDVB driver (see linuxtv.org). * - * $Id: ringbuffer.c 1.5 2001/11/03 09:50:46 kls Exp $ + * $Id: ringbuffer.c 1.6 2002/04/18 15:46:36 kls Exp $ */ #include "ringbuffer.h" @@ -154,7 +154,6 @@ int cRingBufferLinear::Put(const uchar *Data, int Count) Lock(); int rest = Size() - head; int diff = tail - head; - Unlock(); int free = (diff > 0) ? diff - 1 : Size() + diff - 1; if (statistics) { int fill = Size() - free - 1 + Count; @@ -167,22 +166,25 @@ int cRingBufferLinear::Put(const uchar *Data, int Count) dsyslog(LOG_INFO, "buffer usage: %d%%", percent); } } - if (free <= 0) - return 0; - if (free < Count) - Count = free; - if (Count > maxFill) - maxFill = Count; - if (Count >= rest) { - memcpy(buffer + head, Data, rest); - if (Count - rest) - memcpy(buffer, Data + rest, Count - rest); - head = Count - rest; - } - else { - memcpy(buffer + head, Data, Count); - head += Count; + if (free > 0) { + if (free < Count) + Count = free; + if (Count > maxFill) + maxFill = Count; + if (Count >= rest) { + memcpy(buffer + head, Data, rest); + if (Count - rest) + memcpy(buffer, Data + rest, Count - rest); + head = Count - rest; + } + else { + memcpy(buffer + head, Data, Count); + head += Count; + } } + else + Count = 0; + Unlock(); } return Count; } @@ -193,22 +195,24 @@ int cRingBufferLinear::Get(uchar *Data, int Count) Lock(); int rest = Size() - tail; int diff = head - tail; - Unlock(); int cont = (diff >= 0) ? diff : Size() + diff; - if (rest <= 0) - return 0; - if (cont < Count) - Count = cont; - if (Count >= rest) { - memcpy(Data, buffer + tail, rest); - if (Count - rest) - memcpy(Data + rest, buffer, Count - rest); - tail = Count - rest; - } - else { - memcpy(Data, buffer + tail, Count); - tail += Count; + if (rest > 0) { + if (cont < Count) + Count = cont; + if (Count >= rest) { + memcpy(Data, buffer + tail, rest); + if (Count - rest) + memcpy(Data + rest, buffer, Count - rest); + tail = Count - rest; + } + else { + memcpy(Data, buffer + tail, Count); + tail += Count; + } } + else + Count = 0; + Unlock(); } return Count; } |