diff options
-rw-r--r-- | common/rfb/H264Decoder.cxx | 9 | ||||
-rw-r--r-- | common/rfb/H264Decoder.h | 4 | ||||
-rw-r--r-- | common/rfb/H264DecoderContext.cxx | 6 | ||||
-rw-r--r-- | common/rfb/H264DecoderContext.h | 1 |
4 files changed, 8 insertions, 12 deletions
diff --git a/common/rfb/H264Decoder.cxx b/common/rfb/H264Decoder.cxx index 44c0848d..9b630045 100644 --- a/common/rfb/H264Decoder.cxx +++ b/common/rfb/H264Decoder.cxx @@ -114,6 +114,12 @@ void H264Decoder::decodeRect(const Rect& r, const uint8_t* buffer, ctx = findContext(r); } + if (ctx && (reset & resetContext)) { + contexts.remove(ctx); + delete ctx; + ctx = nullptr; + } + if (!ctx) { if (contexts.size() >= MAX_H264_INSTANCES) @@ -131,9 +137,6 @@ void H264Decoder::decodeRect(const Rect& r, const uint8_t* buffer, if (!ctx->isReady()) throw std::runtime_error("H264Decoder: Context is not ready"); - if (reset & resetContext) - ctx->reset(); - if (!len) return; diff --git a/common/rfb/H264Decoder.h b/common/rfb/H264Decoder.h index 46d25e33..6f2dabfb 100644 --- a/common/rfb/H264Decoder.h +++ b/common/rfb/H264Decoder.h @@ -21,7 +21,7 @@ #ifndef __RFB_H264DECODER_H__ #define __RFB_H264DECODER_H__ -#include <deque> +#include <list> #include <rfb/Decoder.h> @@ -43,7 +43,7 @@ namespace rfb { void resetContexts(); H264DecoderContext* findContext(const Rect& r); - std::deque<H264DecoderContext*> contexts; + std::list<H264DecoderContext*> contexts; }; } diff --git a/common/rfb/H264DecoderContext.cxx b/common/rfb/H264DecoderContext.cxx index 8d7a6a7b..ced3188e 100644 --- a/common/rfb/H264DecoderContext.cxx +++ b/common/rfb/H264DecoderContext.cxx @@ -53,9 +53,3 @@ bool H264DecoderContext::isReady() { return initialized; } - -void H264DecoderContext::reset() -{ - freeCodec(); - initCodec(); -} diff --git a/common/rfb/H264DecoderContext.h b/common/rfb/H264DecoderContext.h index aa1931c8..0b9dce82 100644 --- a/common/rfb/H264DecoderContext.h +++ b/common/rfb/H264DecoderContext.h @@ -36,7 +36,6 @@ namespace rfb { virtual void decode(const uint8_t* /*h264_buffer*/, uint32_t /*len*/, ModifiablePixelBuffer* /*pb*/) {} - void reset(); inline bool isEqualRect(const Rect &r) const { return r == rect; } bool isReady(); |