Hi

----- Original Message -----
> Hi,
> On Fri, Apr 03, 2015 at 04:34:30PM +0200, Marc-André Lureau wrote:
> > Hi
> >
> > On Fri, Apr 3, 2015 at 3:53 PM, Victor Toso <[email protected]> wrote:
> >
> > > +    SPICE_AUDIO_GET_CLASS(audio)->get_playback_volume_info_async(audio,
> > > +            audio_playback_volume_info_cb, main_channel);
> > >
> >
> > It would need to keep a reference on main_channel, and an
> > audio_sync_cancellable for the case where the channel is to be
> > disconnected.
> > 
> > Also, a channel may be recycled. The state should be reset in
> > channel_reset() for further usages.
> 
> Sorry, I did not understand why I need to keep a reference to
> main_channel in this case and what should be done when the
> channel-playback or channel-record is reset.
> 
> Could you please clarify?

If the main channel is destroyed before the async callback is called this will 
run into criticals (in the best case ;)

Using a cancellable and a reference on the channel will ensure that you can 
cancel the call and run the callback with a valid reference.

Finally, the channel_reset() is there to clean-up the channel state so it can 
be reused for a new connection (it's not the best design ever, but it avoids 
breaking API or moving the channel state in another structure). If the channel 
has been configured by the client, it should keep those values, but any channel 
state should be cleared (the agent_volume_playback_sync for instance)
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to