Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> On Thu, Apr 14, 2016 at 06:01:23PM +0200, Pavel Grunt wrote: > Avoid repeating the same code and having a SpiceSession variable > defined when is not really needed. > --- > src/channel-main.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/src/channel-main.c b/src/channel-main.c > index 8e5de8a..a7770fa 100644 > --- a/src/channel-main.c > +++ b/src/channel-main.c > @@ -1187,11 +1187,15 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel) > return TRUE; > } > > +static SpiceAudio *spice_main_get_audio(const SpiceMainChannel *channel) > +{ > + return spice_audio_get(spice_channel_get_session(SPICE_CHANNEL(channel)), NULL); > +} > + > static void audio_playback_volume_info_cb(GObject *object, GAsyncResult *res, gpointer user_data) > { > SpiceMainChannel *main_channel = user_data; > - SpiceSession *session = spice_channel_get_session(SPICE_CHANNEL(main_channel)); > - SpiceAudio *audio = spice_audio_get(session, NULL); > + SpiceAudio *audio = spice_main_get_audio(main_channel); > VDAgentAudioVolumeSync *avs; > guint16 *volume; > guint8 nchannels; > @@ -1229,8 +1233,7 @@ static void audio_playback_volume_info_cb(GObject *object, GAsyncResult *res, gp > > static void agent_sync_audio_playback(SpiceMainChannel *main_channel) > { > - SpiceSession *session = spice_channel_get_session(SPICE_CHANNEL(main_channel)); > - SpiceAudio *audio = spice_audio_get(session, NULL); > + SpiceAudio *audio = spice_main_get_audio(main_channel); > SpiceMainChannelPrivate *c = main_channel->priv; > > if (audio == NULL || > @@ -1249,8 +1252,7 @@ static void agent_sync_audio_playback(SpiceMainChannel *main_channel) > static void audio_record_volume_info_cb(GObject *object, GAsyncResult *res, gpointer user_data) > { > SpiceMainChannel *main_channel = user_data; > - SpiceSession *session = spice_channel_get_session(SPICE_CHANNEL(main_channel)); > - SpiceAudio *audio = spice_audio_get(session, NULL); > + SpiceAudio *audio = spice_main_get_audio(main_channel); > VDAgentAudioVolumeSync *avs; > guint16 *volume; > guint8 nchannels; > @@ -1287,8 +1289,7 @@ static void audio_record_volume_info_cb(GObject *object, GAsyncResult *res, gpoi > > static void agent_sync_audio_record(SpiceMainChannel *main_channel) > { > - SpiceSession *session = spice_channel_get_session(SPICE_CHANNEL(main_channel)); > - SpiceAudio *audio = spice_audio_get(session, NULL); > + SpiceAudio *audio = spice_main_get_audio(main_channel); > SpiceMainChannelPrivate *c = main_channel->priv; > > if (audio == NULL || > -- > 2.8.1 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/spice-devel
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel