[Spice-commits] src/channel-playback.c src/channel-record.c src/spice-session.c src/spice-session-priv.h

Victor Toso de Carvalho victortoso at kemper.freedesktop.org
Tue Mar 28 14:28:26 UTC 2017


 src/channel-playback.c   |    5 +++--
 src/channel-record.c     |    5 +++--
 src/spice-session-priv.h |    1 +
 src/spice-session.c      |   13 +++++++++++++
 4 files changed, 20 insertions(+), 4 deletions(-)

New commits:
commit 7721d0906d55cfaa6ce8f5786829c5c738adf74c
Author: Victor Toso <me at victortoso.com>
Date:   Tue Mar 28 13:45:16 2017 +0200

    audio: debug audio codec when audio stream starts
    
    We already debug a few parameters but the audio codec is missing.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1436249
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/channel-playback.c b/src/channel-playback.c
index 39c2178..ca14b96 100644
--- a/src/channel-playback.c
+++ b/src/channel-playback.c
@@ -367,8 +367,9 @@ static void playback_handle_start(SpiceChannel *channel, SpiceMsgIn *in)
     SpicePlaybackChannelPrivate *c = SPICE_PLAYBACK_CHANNEL(channel)->priv;
     SpiceMsgPlaybackStart *start = spice_msg_in_parsed(in);
 
-    CHANNEL_DEBUG(channel, "%s: fmt %u channels %u freq %u time %u", __FUNCTION__,
-                  start->format, start->channels, start->frequency, start->time);
+    CHANNEL_DEBUG(channel, "%s: fmt %u channels %u freq %u time %u mode %s", __FUNCTION__,
+                  start->format, start->channels, start->frequency, start->time,
+                  spice_audio_data_mode_to_string(c->mode));
 
     c->frame_count = 0;
     c->last_time = start->time;
diff --git a/src/channel-record.c b/src/channel-record.c
index c1d9afa..9834e85 100644
--- a/src/channel-record.c
+++ b/src/channel-record.c
@@ -405,8 +405,9 @@ static void record_handle_start(SpiceChannel *channel, SpiceMsgIn *in)
 
     c->mode = spice_record_desired_mode(channel, start->frequency);
 
-    CHANNEL_DEBUG(channel, "%s: fmt %u channels %u freq %u", __FUNCTION__,
-                  start->format, start->channels, start->frequency);
+    CHANNEL_DEBUG(channel, "%s: fmt %u channels %u freq %u mode %s", __FUNCTION__,
+                  start->format, start->channels, start->frequency,
+                  spice_audio_data_mode_to_string(c->mode));
 
     g_return_if_fail(start->format == SPICE_AUDIO_FMT_S16);
 
diff --git a/src/spice-session-priv.h b/src/spice-session-priv.h
index 049973a..03005aa 100644
--- a/src/spice-session-priv.h
+++ b/src/spice-session-priv.h
@@ -99,6 +99,7 @@ guint spice_session_get_n_display_channels(SpiceSession *session);
 void spice_session_set_main_channel(SpiceSession *session, SpiceChannel *channel);
 gboolean spice_session_set_migration_session(SpiceSession *session, SpiceSession *mig_session);
 SpiceAudio *spice_audio_get(SpiceSession *session, GMainContext *context);
+const gchar* spice_audio_data_mode_to_string(gint mode);
 G_END_DECLS
 
 #endif /* __SPICE_CLIENT_SESSION_PRIV_H__ */
diff --git a/src/spice-session.c b/src/spice-session.c
index 66376ff..6f8cf5e 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -2602,6 +2602,19 @@ void spice_session_set_shared_dir(SpiceSession *session, const gchar *dir)
     s->shared_dir = g_strdup(dir);
 }
 
+G_GNUC_INTERNAL
+const gchar* 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";
+}
+
+
 /**
  * spice_session_get_proxy_uri:
  * @session: a #SpiceSession


More information about the Spice-commits mailing list