[Spice-devel] [PATCH spice-gtk] pulse: do not abort on corking no stream

Marc-André Lureau marcandre.lureau at gmail.com
Mon Nov 25 05:31:10 PST 2013


On Mon, Nov 25, 2013 at 1:41 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> On Mon, Nov 25, 2013 at 01:33:52PM +0100, Marc-André Lureau wrote:
>> Check that there is an actual stream before calling cork().
>
> Is it expected that we are getting called with a non-NULL stream in the
> first place?

Since this is sent by server on mjpeg stream creation, I would say
playback stream isn't mandatory.

Anyway, it should not crash.

>>
>> https://bugzilla.redhat.com/show_bug.cgi?id=1032785
>> ---
>>  gtk/spice-pulse.c | 5 ++++-
>>  spice-common      | 2 +-
>>  2 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/gtk/spice-pulse.c b/gtk/spice-pulse.c
>> index 5e214c8..c4241d0 100644
>> --- a/gtk/spice-pulse.c
>> +++ b/gtk/spice-pulse.c
>> @@ -161,6 +161,8 @@ static void stream_uncork(SpicePulse *pulse, struct stream *s)
>>      SpicePulsePrivate *p = SPICE_PULSE_GET_PRIVATE(pulse);
>>      pa_operation *o = NULL;
>>
>> +    g_return_if_fail(s->stream);
>> +
>>      if (s->cork_op) {
>>          pa_operation_cancel(s->cork_op);
>>          pa_operation_unref(s->cork_op);
>> @@ -671,7 +673,8 @@ static void playback_min_latency_changed(GObject *object, GParamSpec *pspec, gpo
>>
>>      if (p->last_delay < p->target_delay) {
>>          spice_debug("%s: corking", __FUNCTION__);
>> -        stream_cork(pulse, &p->playback, FALSE);
>> +        if (p->playback.stream)
>> +            stream_cork(pulse, &p->playback, FALSE);
>>      } else {
>>          spice_debug("%s: not corking. The current delay satisfies the requirement", __FUNCTION__);
>>      }
>> diff --git a/spice-common b/spice-common
>> index 261d270..cacc07f 160000
>> --- a/spice-common
>> +++ b/spice-common
>> @@ -1 +1 @@
>> -Subproject commit 261d270cc8e9af0915d5248df240828214ec996e
>> +Subproject commit cacc07ff6a5b5f2c9c37177d83668cb3cdc2aba0
>
> Usual unneeded hunk. What about git add -p ? :)
>
> Christophe



-- 
Marc-André Lureau


More information about the Spice-devel mailing list