[Spice-devel] [PATCH 7/7] Add debug output identifying audio codec
Jonathon Jongsma
jjongsma at redhat.com
Fri Apr 7 19:58:19 UTC 2017
On Fri, 2017-04-07 at 17:55 +0200, Pavel Grunt wrote:
> On Fri, 2017-04-07 at 10:24 -0500, Jonathon Jongsma wrote:
> > It can be useful for debug to know what the codec of the playback
> > and
> > record channels are, so add a debug-level print statement
> > indicating
> > this.
> >
> > Resolves: rhbz#1436251
> > ---
> > server/sound.c | 20 ++++++++++++++++++++
> > 1 file changed, 20 insertions(+)
> >
> > diff --git a/server/sound.c b/server/sound.c
> > index 6a6d965..eb0220f 100644
> > --- a/server/sound.c
> > +++ b/server/sound.c
> > @@ -314,6 +314,18 @@ static bool
> > snd_record_handle_write(RecordChannelClient *record_client, size_t
> > s
> > return TRUE;
> > }
> >
> > +static
> > +const char* spice_audio_data_mode_to_string(gint mode)
> > +{
> > + static const char *str[] = {
>
> I had submitted something similar and it was suggested [0] to use
> static const char *const str[]
>
> [0] https://lists.freedesktop.org/archives/spice-devel/2017-March/036
> 7
> 76.html
Probably a good idea. For what it's worth, this bit is basically just
copy/pasted from spice-gtk.
>
> > + [ SPICE_AUDIO_DATA_MODE_INVALID ] = "invalid",
> > + [ SPICE_AUDIO_DATA_MODE_RAW ] = "raw",
> > + [ SPICE_AUDIO_DATA_MODE_CELT_0_5_1 ] = "celt",
> > + [ SPICE_AUDIO_DATA_MODE_OPUS ] = "opus",
> > + };
> > + return (mode >= 0 && mode < G_N_ELEMENTS(str)) ? str[mode] :
> > "unknown audio codec";
> > +}
> > +
> > static bool
> > record_channel_handle_message(RedChannelClient *rcc, uint16_t
> > type,
> > uint32_t size, void *message)
> > {
> > @@ -343,6 +355,9 @@ record_channel_handle_message(RedChannelClient
> > *rcc, uint16_t type, uint32_t siz
> > }
> > else
> > record_client->mode = mode->mode;
> > +
> > + spice_debug("record client %p using mode %s",
> > record_client,
> > + spice_audio_data_mode_to_string(record_client-
> > > mode));
> >
> > break;
> > }
> >
> > @@ -1061,6 +1076,9 @@ playback_channel_client_constructed(GObject
> > *object)
> > }
> > }
> >
> > + spice_debug("playback client %p using mode %s",
> > playback_client,
> > + spice_audio_data_mode_to_string(playback_client-
> > > mode));
> >
> > +
> > if (!red_client_during_migrate_at_target(client)) {
> > on_new_playback_channel_client(channel,
> > SND_CHANNEL_CLIENT(playback_client));
> > }
> > @@ -1469,6 +1487,8 @@ void snd_set_playback_compression(bool on)
> > if (playback->mode != desired_mode) {
> > playback->mode = desired_mode;
> > snd_set_command(now->connection,
> > SND_PLAYBACK_MODE_MASK);
> > + spice_debug("playback client %p using mode %s",
> > playback,
> > + spice_audio_data_mode_to_string(playba
> > c
> > k->mode));
> > }
> > }
> > }
More information about the Spice-devel
mailing list