From: Christophe de Dinechin <dinechin@xxxxxxxxxx> The streaming agent started as C code. This series converts the style to something that is more usual for C++, notably: - Adds encapsulation and RAII for resources such as the stream - Splits functionality into several classes with clear roles - Create exception handling classes dealing with exception identification and message formatting - Puts message formatting and writing in a template Message class - Isolate what's specific to each message in four derived classes - Isolate X11-specific code in separate classes, one for cursor messages, one for the thread polling the data. Changes since WIP: - Took into account the many comments on the WIP (if I forgot any, my apologies, let me know) - Finished the error handling work, extended to all 'throw' points - Avoid any allocation in exception handling (and made it noexcept) - Split X11 cursor class into two classes, "updater" and "thread" - Added final patches to move the classes in separate files - Tested with both MJPEG and H264 encoders, verified cursor fix - Tested exception handling and message reporting Christophe de Dinechin (22): Eliminate signed/unsigned warning Reorder headers according to style guide Reformat 'if' statments according to style guide Use RAII to cleanup stream in case of exception or return Replace C-style initialization with shorter C++-style Get rid of C-style memset initializations, use C++ style aggregates Since we use a namespace, simplify name of local classes Use C++ style for cursor message initialization instead of C style Move read, write, handle and locking into the 'Stream' class Remove client_codecs global variable, moved inside the 'Stream' class Make streaming_requested a method in Stream Add exception handling classes Convert message writing from C style to C++ style Create classes encapsulating the X11 display cursor capture Create FrameLog class to encapsulate logging of frames Move the capture loop in the ConcreteAgent Catch all std::exception derivatives Convert existing std::runtime_error to the new Error classes Put Stream and Message classes in separate files Move the X11CursorUpdater and X11CursorThread classes in a separate file Moving FrameLog into a separate file Move capture loop into concrete-agent.cpp include/spice-streaming-agent/Makefile.am | 2 +- include/spice-streaming-agent/errors.hpp | 95 +++++++ src/Makefile.am | 7 + src/concrete-agent.cpp | 106 ++++++- src/concrete-agent.hpp | 4 + src/errors.cpp | 74 +++++ src/frame-log.cpp | 45 +++ src/frame-log.hpp | 43 +++ src/message.hpp | 43 +++ src/mjpeg-fallback.cpp | 12 +- src/spice-streaming-agent.cpp | 451 ++---------------------------- src/stream.cpp | 172 ++++++++++++ src/stream.hpp | 55 ++++ src/unittests/Makefile.am | 1 + src/unittests/test-mjpeg-fallback.cpp | 4 +- src/x11-cursor.cpp | 65 +++++ src/x11-cursor.hpp | 91 ++++++ 17 files changed, 840 insertions(+), 430 deletions(-) create mode 100644 include/spice-streaming-agent/errors.hpp create mode 100644 src/errors.cpp create mode 100644 src/frame-log.cpp create mode 100644 src/frame-log.hpp create mode 100644 src/message.hpp create mode 100644 src/stream.cpp create mode 100644 src/stream.hpp create mode 100644 src/x11-cursor.cpp create mode 100644 src/x11-cursor.hpp -- 2.13.5 (Apple Git-94) _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel