[Spice-devel] [spice-common v1] protocol: add preferred video codec message

Frediano Ziglio fziglio at redhat.com
Mon Oct 24 15:06:10 UTC 2016


> 
> From: Victor Toso <me at victortoso.com>
> 
> Client might want to choose a preferred video codec for streaming for
> different reasons which having hardware decoder support being the most
> interest one.
> 
> This message allows the client to send a combination of video codec
> type with a ranking value of SpiceVideoCodecRank.
> 
> Signed-off-by: Victor Toso <victortoso at redhat.com>
> ---
>  common/messages.h | 10 ++++++++++
>  spice.proto       | 18 ++++++++++++++++++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/common/messages.h b/common/messages.h
> index 516a345..7bc90fd 100644
> --- a/common/messages.h
> +++ b/common/messages.h
> @@ -648,6 +648,16 @@ typedef struct SpiceMsgcDisplayPreferredCompression {
>      uint8_t image_compression;
>  } SpiceMsgcDisplayPreferredCompression;
>  
> +typedef struct SpiceVideoCodecPreferredRank {
> +    uint8_t type;
> +    uint8_t rank;
> +} SpiceVideoCodecPreferredRank;
> +
> +typedef struct SpiceMsgcDisplayPreferredVideoCodecType {
> +    uint32_t num_of_codecs;
> +    SpiceVideoCodecPreferredRank codec_ranks[0];
> +} SpiceMsgcDisplayPreferredVideoCodecType;
> +
>  typedef struct SpiceMsgDisplayGlScanoutUnix {
>      int drm_dma_buf_fd;
>      uint32_t width;
> diff --git a/spice.proto b/spice.proto
> index 0bfc515..c4f1a62 100644
> --- a/spice.proto
> +++ b/spice.proto
> @@ -706,6 +706,19 @@ flags32 gl_scanout_flags {
>      Y0TOP
>  };
>  
> +enum8 video_codec_rank {
> +    DISABLED = 0,
> +    SOFTWARE_DECODER,
> +    HARDWARE_DECODER,
> +    BOTH,
> +    PREFERRED,
> +};
> +

Is it an order? It's not clear what should a server do with these.
The software and hardware (and both) tell the server if the client
has software and/or hardware... but what about preferred?
The first 4 can be represented with 2 flags (hardware and software)
but preferred it's something that is not clear in this list.

The server should have its preference too. Do you have an idea
which should be these preference and how to match them.
For instance an administrator can decide to disable an hardware
encoder for licensing issues and because the driver for some
reason is buggy. Or decide the order based on network performances
or cpu (which is usually quite different).
And how to choose which one is more important, if client or server
settings?

> +struct VideoCodecPreferredRank {
> +    video_codec_type type;
> +    video_codec_rank rank;
> +};
> +
>  channel DisplayChannel : BaseChannel {
>   server:
>      message {
> @@ -984,6 +997,11 @@ channel DisplayChannel : BaseChannel {
>      } preferred_compression;
>  
>      message {
> +        uint32 num_of_codecs;
> +        VideoCodecPreferredRank codec_ranks[num_of_codecs] @end;
> +    } preferred_video_codec_type;
> +

This message needs to be after gl_draw_done

> +    message {
>      } gl_draw_done;
>  };
>  

Frediano


More information about the Spice-devel mailing list