Some encodings must be handled in the order they are received. Make sure we respect this in the decode manager.tags/v1.6.90
@@ -251,18 +251,27 @@ DecodeManager::QueueEntry* DecodeManager::DecodeThread::findEntry() | |||
++iter) { | |||
DecodeManager::QueueEntry* entry; | |||
std::list<DecodeManager::QueueEntry*>::iterator iter2; | |||
entry = *iter; | |||
// Another thread working on this? | |||
if (entry->active) | |||
goto next; | |||
// If this is an ordered decoder then make sure this is the first | |||
// rectangle in the queue for that decoder | |||
if (entry->decoder->flags & DecoderOrdered) { | |||
for (iter2 = manager->workQueue.begin(); iter2 != iter; ++iter2) { | |||
if (entry->encoding == (*iter2)->encoding) | |||
goto next; | |||
} | |||
} | |||
// Check overlap with earlier rectangles | |||
if (!lockedRegion.intersect(entry->affectedRegion).is_empty()) | |||
goto next; | |||
// FIXME: check dependencies between rects | |||
return entry; | |||
next: |
@@ -33,6 +33,8 @@ namespace rfb { | |||
enum DecoderFlags { | |||
// A constant for decoders that don't need anything special | |||
DecoderPlain = 0, | |||
// All rects for this decoder must be handled in order | |||
DecoderOrdered = 1 << 0, | |||
}; | |||
class Decoder { |
@@ -46,7 +46,7 @@ static const int TIGHT_MIN_TO_COMPRESS = 12; | |||
#include <rfb/tightDecode.h> | |||
#undef BPP | |||
TightDecoder::TightDecoder() : Decoder(DecoderPlain) | |||
TightDecoder::TightDecoder() : Decoder(DecoderOrdered) | |||
{ | |||
} | |||
@@ -62,7 +62,7 @@ static inline rdr::U32 readOpaque24B(rdr::InStream* is) | |||
#undef CPIXEL | |||
#undef BPP | |||
ZRLEDecoder::ZRLEDecoder() : Decoder(DecoderPlain) | |||
ZRLEDecoder::ZRLEDecoder() : Decoder(DecoderOrdered) | |||
{ | |||
} | |||