Implement optional per-frame CRC calculation to save bandwidth
Current implementation is very CPU-efficient as it's not processing
JPEG-encoded data received from V4L2 at all.
This patch implements an optional mode where for each frame that's about
to be sent a CRC32 is calculated and if this client has already received
it before, the transmission is skipped. This of course adds some
noticeable CPU load (proportional to the frame rate requested and the
encoded JPEG size); on AST2500 it's taking about 10 % CPU when showing a
relatively complex GUI login screen with 15 FPS.
Reducing required bandwidth to 0 for static images helps a lot when
using IP KVM via poor connections, e.g. provided by cellular network
operators or some hotels, so can be beneficial for certain common
usecases.
The next optimisation to try is to dynamically alter the frame rate,
automatically ramping it up as soon as the changes start happening and
lowering after a period of inactivity; it's not yet clear if V4L2 allows
this.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: I74b887cf83b5c8676f5792412805de08e1a54f32
diff --git a/ikvm_args.hpp b/ikvm_args.hpp
index f877d32..fbe19ad 100644
--- a/ikvm_args.hpp
+++ b/ikvm_args.hpp
@@ -101,6 +101,16 @@
return videoPath;
}
+ /*
+ * @brief Get the identical frames detection setting
+ *
+ * @return True if identical frames detection is enabled
+ */
+ inline bool getCalcFrameCRC() const
+ {
+ return calcFrameCRC;
+ }
+
private:
/* @brief Prints the application usage to stderr */
void printUsage();
@@ -116,6 +126,8 @@
std::string pointerPath;
/* @brief Path to the V4L2 video device */
std::string videoPath;
+ /* @brief Identical frames detection */
+ bool calcFrameCRC;
/* @brief Original command line arguments passed to the application */
CommandLine commandLine;
};