[Spice-devel,v7,01/23] protocol: Add support for the VP8 and h264 video codecs

Submitted by Francois Gouget on Dec. 16, 2015, 3:16 p.m.

Details

Message ID alpine.DEB.2.20.1512161114490.16981@amboise
State New
Headers show
Series "Add GStreamer support for video streaming" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Francois Gouget Dec. 16, 2015, 3:16 p.m.
Clients that support multiple codecs must advertise the
SPICE_DISPLAY_CAP_MULTI_CODEC capability and one
SPICE_DISPLAY_CAP_CODEC_XXX per supported codec.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
---
 configure.ac     | 2 +-
 spice.proto      | 2 ++
 spice/enums.h    | 2 ++
 spice/protocol.h | 4 ++++
 4 files changed, 9 insertions(+), 1 deletion(-)

Note:
* This increases the version to 0.12.12 so the spice server and 
  client can check for it. Adjust as appropriate.

Patch hide | download patch | download mbox

diff --git a/configure.ac b/configure.ac
index e8d118d..7486d81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@  AC_PREREQ([2.57])
 
 m4_define([SPICE_MAJOR], 0)
 m4_define([SPICE_MINOR], 12)
-m4_define([SPICE_MICRO], 11)
+m4_define([SPICE_MICRO], 12)
 
 AC_INIT(spice-protocol, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-protocol)
 
diff --git a/spice.proto b/spice.proto
index 3bca900..b03d0db 100644
--- a/spice.proto
+++ b/spice.proto
@@ -329,6 +329,8 @@  flags8 path_flags { /* TODO: C enum names changes */
 
 enum8 video_codec_type {
     MJPEG = 1,
+    VP8,
+    H264,
 };
 
 flags8 stream_flags {
diff --git a/spice/enums.h b/spice/enums.h
index 16885ac..e02a0c5 100644
--- a/spice/enums.h
+++ b/spice/enums.h
@@ -139,6 +139,8 @@  typedef enum SpicePathFlags {
 
 typedef enum SpiceVideoCodecType {
     SPICE_VIDEO_CODEC_TYPE_MJPEG = 1,
+    SPICE_VIDEO_CODEC_TYPE_VP8,
+    SPICE_VIDEO_CODEC_TYPE_H264,
 
     SPICE_VIDEO_CODEC_TYPE_ENUM_END
 } SpiceVideoCodecType;
diff --git a/spice/protocol.h b/spice/protocol.h
index 0c265ee..b63fbe5 100644
--- a/spice/protocol.h
+++ b/spice/protocol.h
@@ -136,6 +136,10 @@  enum {
     SPICE_DISPLAY_CAP_STREAM_REPORT,
     SPICE_DISPLAY_CAP_LZ4_COMPRESSION,
     SPICE_DISPLAY_CAP_PREF_COMPRESSION,
+    SPICE_DISPLAY_CAP_MULTI_CODEC,
+    SPICE_DISPLAY_CAP_CODEC_MJPEG,
+    SPICE_DISPLAY_CAP_CODEC_VP8,
+    SPICE_DISPLAY_CAP_CODEC_H264,
 };
 
 enum {

Comments

On Wed, Dec 16, 2015 at 04:16:04PM +0100, Francois Gouget wrote:
> Clients that support multiple codecs must advertise the
> SPICE_DISPLAY_CAP_MULTI_CODEC capability and one
> SPICE_DISPLAY_CAP_CODEC_XXX per supported codec.
> 
> Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
> ---
>  configure.ac     | 2 +-
>  spice.proto      | 2 ++
>  spice/enums.h    | 2 ++
>  spice/protocol.h | 4 ++++
>  4 files changed, 9 insertions(+), 1 deletion(-)
> 
> Note:
> * This increases the version to 0.12.12 so the spice server and 
>   client can check for it. Adjust as appropriate.
> 
> diff --git a/configure.ac b/configure.ac
> index e8d118d..7486d81 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2,7 +2,7 @@ AC_PREREQ([2.57])
>  
>  m4_define([SPICE_MAJOR], 0)
>  m4_define([SPICE_MINOR], 12)
> -m4_define([SPICE_MICRO], 11)
> +m4_define([SPICE_MICRO], 12)
>  
>  AC_INIT(spice-protocol, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-protocol)
>  
> diff --git a/spice.proto b/spice.proto
> index 3bca900..b03d0db 100644
> --- a/spice.proto
> +++ b/spice.proto
> @@ -329,6 +329,8 @@ flags8 path_flags { /* TODO: C enum names changes */
>  
>  enum8 video_codec_type {
>      MJPEG = 1,
> +    VP8,
> +    H264,
>  };

I understand the general desire to support something better than
MJPEG, but what is the compelling rationale for adding both VP8
and H264, as opposed to just VP8 ?

Support for the H264 codec is pretty difficult given the open
source / free software hostile patent licensing situation around
it, which will effectively limit the ability to support it in
many spice server/client impls.

VP8 by comparison is open source friendly as its patents were
placed under an irrevokable royalty free license.

If we add H264 to the SPICE protocol then we are inevitably
going to cause interoperability issues with some clients not
being able to work with some servers & vica-verca. I think
this would be bad for SPICE in general - one of its strengths
over VNC is that we don't have fragmented codec support across
impls.

As such I'd much prefer to see us *only* add VP8 which is
not going to cause implementation problems wrt licensing,
and so will not cause the same kind of interoperability
issues as H264.

Regards,
Daniel
On 12/16/2015 09:33 AM, Daniel P. Berrange wrote:
> On Wed, Dec 16, 2015 at 04:16:04PM +0100, Francois Gouget wrote:
> 
> I understand the general desire to support something better than
> MJPEG, but what is the compelling rationale for adding both VP8
> and H264, as opposed to just VP8 ?
> 
> Support for the H264 codec is pretty difficult given the open
> source / free software hostile patent licensing situation around
> it, which will effectively limit the ability to support it in
> many spice server/client impls.
> 
> VP8 by comparison is open source friendly as its patents were
> placed under an irrevokable royalty free license.
> 
> If we add H264 to the SPICE protocol then we are inevitably
> going to cause interoperability issues with some clients not
> being able to work with some servers & vica-verca. I think
> this would be bad for SPICE in general - one of its strengths
> over VNC is that we don't have fragmented codec support across
> impls.
> 
> As such I'd much prefer to see us *only* add VP8 which is
> not going to cause implementation problems wrt licensing,
> and so will not cause the same kind of interoperability
> issues as H264.

There are several motivations.  First, the task is not just to add new
codecs, but to create the capability to readily add any gst supported codec.

Second, at the time we started this, you essentially could not get
hardware accelerated encoding for vp8, but you could for h264.  And, in
general, the h264 gst implementation works better on the desktop.  So in
the real world, h264 is useful today in a way that vp8 is not.

Finally, the implementation is designed to take advantage of the codecs
that you have on your system.  So if you have h264, you can use it, if
you don't, you can fall back to vp8 (or whatever you have). Note that
Spice does not include any h264 code at all; just support for using
codecs you already have.

And while I share a passionate hatred for all things patent encumbered,
this approach preserves freedom for customers to choose, which is a
large part of the motivation for the whole patch series.

Cheers,

Jeremy