diff --git a/.gitignore b/.gitignore index b648d73..268f8cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/spice-streaming-agent-0.2.tar.xz +SOURCES/spice-streaming-agent-0.3.tar.xz diff --git a/.spice-streaming-agent.metadata b/.spice-streaming-agent.metadata index d1a6485..bc44ba0 100644 --- a/.spice-streaming-agent.metadata +++ b/.spice-streaming-agent.metadata @@ -1 +1 @@ -e70ef989cc25b90a3b4e49b7124d43d911fbf4c5 SOURCES/spice-streaming-agent-0.2.tar.xz +d052d0abd8ad77b61a4db72e6de701de165b4999 SOURCES/spice-streaming-agent-0.3.tar.xz diff --git a/SOURCES/0001-start-streaming-check-num_codecs.patch b/SOURCES/0001-start-streaming-check-num_codecs.patch deleted file mode 100644 index 6629073..0000000 --- a/SOURCES/0001-start-streaming-check-num_codecs.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 5aaaa5bd91261a6b61fcaa75585f8446b9eeb036 Mon Sep 17 00:00:00 2001 -From: Uri Lublin -Date: Tue, 31 Jul 2018 16:18:15 +0300 -Subject: [PATCH 1/4] start streaming: check num_codecs - -The server sends StreamMsgStartStop to tell spice-streaming-agent -to start streaming and a list of available codecs. - -The first uint8_t is the number of codecs. -Each following uint8_t is a codec. - -This patch checks that the number of codecs in the message, as -reported by the server, is not too large. ---- - src/spice-streaming-agent.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp -index 1121f35..9ebbf5d 100644 ---- a/src/spice-streaming-agent.cpp -+++ b/src/spice-streaming-agent.cpp -@@ -95,6 +95,11 @@ static void handle_stream_start_stop(StreamPort &stream_port, uint32_t len) - syslog(LOG_INFO, "GOT START_STOP message -- request to %s streaming\n", - streaming_requested ? "START" : "STOP"); - client_codecs.clear(); -+ const int mnc = len - 1; /* max num codecs, see struct StreamMsgStartStop */ -+ if (msg[0] > mnc) { -+ throw std::runtime_error("num_codecs=" + std::to_string(msg[0]) + -+ " > max_num_codecs=" + std::to_string(mnc)); -+ } - for (int i = 1; i <= msg[0]; ++i) { - client_codecs.insert((SpiceVideoCodecType) msg[i]); - } --- -2.17.1 - diff --git a/SOURCES/0002-LoadPlugin-call-dlclose-upon-failure.patch b/SOURCES/0002-LoadPlugin-call-dlclose-upon-failure.patch deleted file mode 100644 index e46400d..0000000 --- a/SOURCES/0002-LoadPlugin-call-dlclose-upon-failure.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 9a7ba6b16e608054f910a76d28e14fd85a00dec3 Mon Sep 17 00:00:00 2001 -From: Uri Lublin -Date: Wed, 1 Aug 2018 11:03:04 +0300 -Subject: [PATCH 2/4] LoadPlugin: call dlclose upon failure - -Signed-off-by: Uri Lublin ---- - src/concrete-agent.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/concrete-agent.cpp b/src/concrete-agent.cpp -index ca666d7..1f8b4b4 100644 ---- a/src/concrete-agent.cpp -+++ b/src/concrete-agent.cpp -@@ -88,6 +88,7 @@ void ConcreteAgent::LoadPlugin(const std::string &plugin_filename) - if (!version) { - syslog(LOG_ERR, "error loading plugin %s: no version information", - plugin_filename.c_str()); -+ dlclose(dl); - return; - } - if (!PluginVersionIsCompatible(*version)) { -@@ -95,6 +96,7 @@ void ConcreteAgent::LoadPlugin(const std::string &plugin_filename) - "error loading plugin %s: plugin interface version %u.%u not accepted", - plugin_filename.c_str(), - MajorVersion(*version), MinorVersion(*version)); -+ dlclose(dl); - return; - } - --- -2.17.1 - diff --git a/SOURCES/0003-main-better-cleanup-when-XOpenDisplay-or-XFixesQuery.patch b/SOURCES/0003-main-better-cleanup-when-XOpenDisplay-or-XFixesQuery.patch deleted file mode 100644 index 87d7abf..0000000 --- a/SOURCES/0003-main-better-cleanup-when-XOpenDisplay-or-XFixesQuery.patch +++ /dev/null @@ -1,38 +0,0 @@ -From d85f863389cf5e36623aad0eb79818e888e15e66 Mon Sep 17 00:00:00 2001 -From: Uri Lublin -Date: Tue, 31 Jul 2018 17:15:09 +0300 -Subject: [PATCH 3/4] main: better cleanup when XOpenDisplay or XFixesQuery - fail - -close f_log if needed. -close X display if needed. ---- - src/spice-streaming-agent.cpp | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp -index 9ebbf5d..f342ebf 100644 ---- a/src/spice-streaming-agent.cpp -+++ b/src/spice-streaming-agent.cpp -@@ -517,11 +517,18 @@ int main(int argc, char* argv[]) - - Display *display = XOpenDisplay(NULL); - if (display == NULL) { -+ if (f_log) { -+ fclose(f_log); -+ } - syslog(LOG_ERR, "failed to open display\n"); - return EXIT_FAILURE; - } - int event_base, error_base; - if (!XFixesQueryExtension(display, &event_base, &error_base)) { -+ if (f_log) { -+ fclose(f_log); -+ } -+ XCloseDisplay(display); - syslog(LOG_ERR, "XFixesQueryExtension failed\n"); - return EXIT_FAILURE; - } --- -2.17.1 - diff --git a/SOURCES/0004-jpeg-Do-not-use-next_output_byte-buf_empty_output_bu.patch b/SOURCES/0004-jpeg-Do-not-use-next_output_byte-buf_empty_output_bu.patch deleted file mode 100644 index 2d18e2c..0000000 --- a/SOURCES/0004-jpeg-Do-not-use-next_output_byte-buf_empty_output_bu.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0605440f7344d9d6d1b047992fbadcd256f2c301 Mon Sep 17 00:00:00 2001 -From: Frediano Ziglio -Date: Tue, 17 Jul 2018 16:24:06 +0100 -Subject: [PATCH 4/4] jpeg: Do not use next_output_byte buf_empty_output_buffer - -The pointer is not updated to the last byte used so using it -to compute the bytes written into the buffer we ignore some bytes -causing some image corruptions. -Note that also free_in_buffer is not updated to last written byte. -When buf_empty_output_buffer is called the buffer is full so use the -size of it instead of relying on next_output_byte or free_in_buffer. - -Signed-off-by: Frediano Ziglio -Acked-by: Uri Lublin ---- - src/jpeg.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/jpeg.cpp b/src/jpeg.cpp -index ceee359..5f6d128 100644 ---- a/src/jpeg.cpp -+++ b/src/jpeg.cpp -@@ -23,7 +23,7 @@ struct JpegBuffer: public jpeg_destination_mgr - static boolean buf_empty_output_buffer(j_compress_ptr cinfo) - { - JpegBuffer *buf = (JpegBuffer *) cinfo->dest; -- size_t size = buf->next_output_byte - &buf->buffer[0]; -+ size_t size = buf->buffer.size(); - buf->buffer.resize(buf->buffer.capacity() * 2); - buf->next_output_byte = &buf->buffer[0] + size; - buf->free_in_buffer = buf->buffer.size() - size; --- -2.17.1 - diff --git a/SOURCES/0100-gst-plugin-make-VP8-the-default-codec-downstream.patch b/SOURCES/0100-gst-plugin-make-VP8-the-default-codec-downstream.patch new file mode 100644 index 0000000..9d8e945 --- /dev/null +++ b/SOURCES/0100-gst-plugin-make-VP8-the-default-codec-downstream.patch @@ -0,0 +1,26 @@ +From aaf2a1c4c276e7e5dd4f7bc570e9053a9accac85 Mon Sep 17 00:00:00 2001 +From: Uri Lublin +Date: Thu, 28 Nov 2019 14:48:10 +0200 +Subject: [spice-streaming-agent patch 100/101] gst-plugin: make VP8 the default codec (downstream) + +Signed-off-by: Uri Lublin +--- + src/gst-plugin.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/gst-plugin.cpp b/src/gst-plugin.cpp +index 922b90d..b270e54 100644 +--- a/src/gst-plugin.cpp ++++ b/src/gst-plugin.cpp +@@ -33,7 +33,7 @@ namespace gstreamer_plugin { + struct GstreamerEncoderSettings + { + int fps = 25; +- SpiceVideoCodecType codec = SPICE_VIDEO_CODEC_TYPE_H264; ++ SpiceVideoCodecType codec = SPICE_VIDEO_CODEC_TYPE_VP8; + std::string encoder; + std::vector> prop_pairs; + }; +-- +2.23.0 + diff --git a/SOURCES/0101-gst-plugin-remove-H264-and-H265-downstream.patch b/SOURCES/0101-gst-plugin-remove-H264-and-H265-downstream.patch new file mode 100644 index 0000000..76807da --- /dev/null +++ b/SOURCES/0101-gst-plugin-remove-H264-and-H265-downstream.patch @@ -0,0 +1,57 @@ +From 5b38408d515ad76b31e096204e69f77880b41f6b Mon Sep 17 00:00:00 2001 +From: Uri Lublin +Date: Thu, 28 Nov 2019 14:51:00 +0200 +Subject: [spice-streaming-agent patch 101/101] gst-plugin: remove H264 and H265 (downstream) + +Signed-off-by: Uri Lublin +--- + src/gst-plugin.cpp | 14 +------------- + 1 file changed, 1 insertion(+), 13 deletions(-) + +diff --git a/src/gst-plugin.cpp b/src/gst-plugin.cpp +index b270e54..8841b88 100644 +--- a/src/gst-plugin.cpp ++++ b/src/gst-plugin.cpp +@@ -118,11 +118,6 @@ GstElement *GstreamerFrameCapture::get_encoder_plugin(const GstreamerEncoderSett + GstElementFactory *factory = nullptr; + + switch (settings.codec) { +- case SPICE_VIDEO_CODEC_TYPE_H264: +- sink_caps.reset(gst_caps_new_simple("video/x-h264", +- "stream-format", G_TYPE_STRING, "byte-stream", +- nullptr)); +- break; + case SPICE_VIDEO_CODEC_TYPE_MJPEG: + sink_caps.reset(gst_caps_new_empty_simple("image/jpeg")); + break; +@@ -132,9 +127,6 @@ GstElement *GstreamerFrameCapture::get_encoder_plugin(const GstreamerEncoderSett + case SPICE_VIDEO_CODEC_TYPE_VP9: + sink_caps.reset(gst_caps_new_empty_simple("video/x-vp9")); + break; +- case SPICE_VIDEO_CODEC_TYPE_H265: +- sink_caps.reset(gst_caps_new_empty_simple("video/x-h265")); +- break; + default : /* Should not happen - just to avoid compiler's complaint */ + throw std::logic_error("Unknown codec"); + } +@@ -433,16 +425,12 @@ void GstreamerPlugin::ParseOptions(const ConfigureOption *options) + throw std::runtime_error("Invalid value '" + value + "' for option 'framerate'."); + } + } else if (name == "gst.codec") { +- if (value == "h264") { +- settings.codec = SPICE_VIDEO_CODEC_TYPE_H264; +- } else if (value == "vp9") { ++ if (value == "vp9") { + settings.codec = SPICE_VIDEO_CODEC_TYPE_VP9; + } else if (value == "vp8") { + settings.codec = SPICE_VIDEO_CODEC_TYPE_VP8; + } else if (value == "mjpeg") { + settings.codec = SPICE_VIDEO_CODEC_TYPE_MJPEG; +- } else if (value == "h265") { +- settings.codec = SPICE_VIDEO_CODEC_TYPE_H265; + } else { + throw std::runtime_error("Invalid value '" + value + "' for option 'gst.codec'."); + } +-- +2.23.0 + diff --git a/SPECS/spice-streaming-agent.spec b/SPECS/spice-streaming-agent.spec index bfd244f..b2d649d 100644 --- a/SPECS/spice-streaming-agent.spec +++ b/SPECS/spice-streaming-agent.spec @@ -1,25 +1,21 @@ Name: spice-streaming-agent -Version: 0.2 -Release: 3%{?dist} +Version: 0.3 +Release: 2%{?dist} Summary: SPICE streaming agent Group: Applications/System License: ASL 2.0 URL: https://www.redhat.com Source0: %{name}-%{version}.tar.xz - -Patch1: 0001-start-streaming-check-num_codecs.patch -Patch2: 0002-LoadPlugin-call-dlclose-upon-failure.patch - -# Patch 3 is a downstream only patch. The issue is already fixed upstream -# (8fb16195dca782b4aa5faa82951f734caf31bffe) but depends on other patches -Patch3: 0003-main-better-cleanup-when-XOpenDisplay-or-XFixesQuery.patch -Patch4: 0004-jpeg-Do-not-use-next_output_byte-buf_empty_output_bu.patch - -BuildRequires: spice-protocol >= 0.12.14 +BuildRequires: spice-protocol >= 0.12.16 BuildRequires: libX11-devel libXfixes-devel BuildRequires: libjpeg-turbo-devel BuildRequires: catch-devel BuildRequires: pkgconfig(udev) +BuildRequires: libdrm-devel +BuildRequires: libXrandr-devel +BuildRequires: gcc-c++ +BuildRequires: diffutils +BuildRequires: gstreamer1-devel gstreamer1-plugins-base-devel # we need /usr/sbin/semanage program which is available on different # packages depending on distribution Requires(post): /usr/sbin/semanage @@ -27,13 +23,18 @@ Requires(postun): /usr/sbin/semanage ExclusiveArch: x86_64 +# Downstream: remove H264 and set VP8 as the default codec +Patch0100: 0100-gst-plugin-make-VP8-the-default-codec-downstream.patch +Patch0101: 0101-gst-plugin-remove-H264-and-H265-downstream.patch + %description An agent, running on a guest, sending video streams of the X display to a remote client (over SPICE). %package devel -Requires: spice-protocol >= 0.12.14 +Requires: spice-protocol >= 0.12.16 Requires: pkgconfig +Requires: libX11-devel Summary: SPICE streaming agent development files %description devel @@ -42,13 +43,11 @@ agent plugins. %prep %setup -q -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 +%patch100 -p1 +%patch101 -p1 %build -%configure --enable-tests --with-udevrulesdir=%{_udevrulesdir} +%configure --enable-tests --with-udevrulesdir=%{_udevrulesdir} --enable-gst-plugin=yes make %{?_smp_mflags} V=1 %check @@ -76,6 +75,9 @@ fi %{_bindir}/spice-streaming-agent %{_sysconfdir}/xdg/autostart/spice-streaming.desktop %{_datadir}/gdm/greeter/autostart/spice-streaming.desktop +%{_mandir}/man1/spice-streaming-agent.1.gz +%{_libdir}/%{name}/plugins/*.so + %files devel %defattr(-,root,root,-) @@ -83,6 +85,11 @@ fi %{_libdir}/pkgconfig %changelog +* Thu Dec 12 2019 Uri Lublin - 0.3-2 +- Update to 0.3 release +- Resolves: rhbz#1774123 +- Resolves: rhbz#1774129 + * Wed Aug 1 2018 Uri Lublin - 0.2-3 - Rebuild for rhel-8 Related: rhbz#1614485