[Spice-devel] [server] streaming: Don't start streaming if there is no video encoder

Uri Lublin uril at redhat.com
Sun Jul 24 12:56:54 UTC 2016


On 07/22/2016 09:11 PM, Francois Gouget wrote:
> Without a video encoder no frame will be streamed anyway.
> This fixes the case where the client does not support any of the
> server's codecs, such as if it was compiled with --enable-gstvideo=no
> --disable-builtin-mjpeg.
>
> Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> ---
>  server/dcc-send.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/server/dcc-send.c b/server/dcc-send.c
> index f5a409d..56bbf23 100644
> --- a/server/dcc-send.c
> +++ b/server/dcc-send.c
> @@ -2159,6 +2159,10 @@ static void marshall_stream_start(RedChannelClient *rcc,
>
>      agent->last_send_time = 0;
>      spice_assert(stream);
> +    if (!agent->video_encoder) {
> +        /* Without a video encoder nothing will be streamed */
> +        return;
> +    }
>      red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_CREATE, NULL);
>      SpiceMsgDisplayStreamCreate stream_create;
>      SpiceClipRects clip_rects;
>

Hi,

This patch prevents a crash as few lines below there is access
to agent->video_encoder->codec_type.

I think it would be better to make the check it in
dcc_create_stream(), and replace the patch here to assert.

What happens with the stream in that case, dropped ?

Thanks,
     Uri.



More information about the Spice-devel mailing list