[Spice-devel] [PATCH 7/7] Add debug output identifying audio codec

Christophe Fergeau cfergeau at redhat.com
Fri Apr 7 15:44:17 UTC 2017


On Fri, Apr 07, 2017 at 10:24:01AM -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[] = {
> +        [ 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";

I'd use a regular if {} here.


Acked-by: Christophe Fergeau <cfergeau at redhat.com>

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170407/77f27fa0/attachment.sig>


More information about the Spice-devel mailing list