[Spice-commits] 2 commits - Makefile.am meson.build meson_options.txt server/sound.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 17 15:34:04 UTC 2020


 Makefile.am       |    1 -
 meson.build       |    3 +--
 meson_options.txt |    5 -----
 server/sound.c    |   44 ++++++++------------------------------------
 4 files changed, 9 insertions(+), 44 deletions(-)

New commits:
commit 4194659c984f4af88502e943793869a08809b47b
Author: Victor Toso <me at victortoso.com>
Date:   Tue Mar 17 15:39:10 2020 +0100

    sound: default to Opus 48000 Hz
    
    As celt's default 44100 Hz is deprecated.
    Related: https://gitlab.freedesktop.org/spice/spice-protocol/-/merge_requests/15
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/sound.c b/server/sound.c
index a1358b1e..f6ac050e 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -1231,19 +1231,6 @@ SPICE_GNUC_VISIBLE uint32_t spice_server_record_get_samples(SpiceRecordInstance
     return len;
 }
 
-static uint32_t snd_get_best_rate(SndChannelClient *client, uint32_t cap_opus)
-{
-    bool client_can_opus = true;
-    if (client) {
-        client_can_opus = red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(client), cap_opus);
-    }
-
-    if (client_can_opus && snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_OPUS, SND_CODEC_ANY_FREQUENCY))
-        return SND_CODEC_OPUS_PLAYBACK_FREQ;
-
-    return SND_CODEC_CELT_PLAYBACK_FREQ;
-}
-
 static void snd_set_rate(SndChannel *channel, uint32_t frequency, uint32_t cap_opus)
 {
     RedChannel *red_channel = RED_CHANNEL(channel);
@@ -1255,8 +1242,7 @@ static void snd_set_rate(SndChannel *channel, uint32_t frequency, uint32_t cap_o
 
 SPICE_GNUC_VISIBLE uint32_t spice_server_get_best_playback_rate(SpicePlaybackInstance *sin)
 {
-    SndChannelClient *client = sin ? snd_channel_get_client(&sin->st->channel) : NULL;
-    return snd_get_best_rate(client, SPICE_PLAYBACK_CAP_OPUS);
+    return SND_CODEC_OPUS_PLAYBACK_FREQ;
 }
 
 SPICE_GNUC_VISIBLE void spice_server_set_playback_rate(SpicePlaybackInstance *sin, uint32_t frequency)
@@ -1266,8 +1252,7 @@ SPICE_GNUC_VISIBLE void spice_server_set_playback_rate(SpicePlaybackInstance *si
 
 SPICE_GNUC_VISIBLE uint32_t spice_server_get_best_record_rate(SpiceRecordInstance *sin)
 {
-    SndChannelClient *client = sin ? snd_channel_get_client(&sin->st->channel) : NULL;
-    return snd_get_best_rate(client, SPICE_RECORD_CAP_OPUS);
+    return SND_CODEC_OPUS_PLAYBACK_FREQ;
 }
 
 SPICE_GNUC_VISIBLE void spice_server_set_record_rate(SpiceRecordInstance *sin, uint32_t frequency)
@@ -1340,7 +1325,7 @@ static void remove_channel(SndChannel *channel)
 static void
 snd_channel_init(SndChannel *self)
 {
-    self->frequency = SND_CODEC_CELT_PLAYBACK_FREQ; /* Default to the legacy rate */
+    self->frequency = SND_CODEC_OPUS_PLAYBACK_FREQ;
 }
 
 static void
commit 9136c639a23bce9587dc3d0f785a53672933b9c7
Author: Victor Toso <me at victortoso.com>
Date:   Tue Mar 17 15:28:48 2020 +0100

    sound: remove celt support
    
    Follow up of spice-protocol's deprecation of celt mode.
    See: https://gitlab.freedesktop.org/spice/spice-protocol/-/merge_requests/15
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/Makefile.am b/Makefile.am
index 78b4dd78..448332b2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,7 +10,6 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = spice-server.pc
 
 DISTCHECK_CONFIGURE_FLAGS =			\
-	--disable-celt051			\
 	--enable-smartcard			\
 	--with-sasl				\
 	--enable-manual				\
diff --git a/meson.build b/meson.build
index 293ee12e..1685c077 100644
--- a/meson.build
+++ b/meson.build
@@ -112,8 +112,7 @@ endif
 #
 # Non-mandatory/optional dependencies
 #
-optional_deps = {'celt051' : '>= 0.5.1.1',
-                 'opus'    : '>= 0.9.14'}
+optional_deps = {'opus' : '>= 0.9.14'}
 foreach dep, version : optional_deps
   d = dependency(dep, required : get_option(dep), version : version)
   if d.found()
diff --git a/meson_options.txt b/meson_options.txt
index f8a1e95e..36d39e01 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -13,11 +13,6 @@ option('sasl',
     value : true,
     description : 'Use cyrus SASL authentication')
 
-option('celt051',
-    type : 'feature',
-    value : 'disabled',
-    description: 'Enable celt051 audio codec')
-
 option('opus',
     type : 'feature',
     description: 'Enable Opus audio codec')
diff --git a/server/sound.c b/server/sound.c
index c952ffc5..a1358b1e 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -333,12 +333,14 @@ static bool snd_record_handle_write(RecordChannelClient *record_client, size_t s
 static
 const char* spice_audio_data_mode_to_string(gint mode)
 {
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     static const char * const 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",
     };
+    G_GNUC_END_IGNORE_DEPRECATIONS
     if (mode >= 0 && mode < G_N_ELEMENTS(str)) {
         return str[mode];
     }
@@ -1014,7 +1016,7 @@ void snd_set_playback_latency(RedClient *client, uint32_t latency)
 }
 
 static int snd_desired_audio_mode(bool playback_compression, int frequency,
-                                  bool client_can_celt, bool client_can_opus)
+                                  bool client_can_opus)
 {
     if (!playback_compression)
         return SPICE_AUDIO_DATA_MODE_RAW;
@@ -1022,9 +1024,6 @@ static int snd_desired_audio_mode(bool playback_compression, int frequency,
     if (client_can_opus && snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_OPUS, frequency))
         return SPICE_AUDIO_DATA_MODE_OPUS;
 
-    if (client_can_celt && snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_CELT_0_5_1, frequency))
-        return SPICE_AUDIO_DATA_MODE_CELT_0_5_1;
-
     return SPICE_AUDIO_DATA_MODE_RAW;
 }
 
@@ -1065,14 +1064,11 @@ playback_channel_client_constructed(GObject *object)
 
     scc->on_message_done = snd_playback_on_message_done;
 
-    bool client_can_celt = red_channel_client_test_remote_cap(rcc,
-                                          SPICE_PLAYBACK_CAP_CELT_0_5_1);
     bool client_can_opus = red_channel_client_test_remote_cap(rcc,
                                           SPICE_PLAYBACK_CAP_OPUS);
     bool playback_compression =
         reds_config_get_playback_compression(red_channel_get_server(red_channel));
-    int desired_mode = snd_desired_audio_mode(playback_compression, channel->frequency,
-                                              client_can_celt, client_can_opus);
+    int desired_mode = snd_desired_audio_mode(playback_compression, channel->frequency, client_can_opus);
     if (desired_mode != SPICE_AUDIO_DATA_MODE_RAW) {
         if (snd_codec_create(&playback_client->codec, desired_mode, channel->frequency,
                              SND_CODEC_ENCODE) == SND_CODEC_OK) {
@@ -1381,9 +1377,6 @@ playback_channel_constructed(GObject *object)
 
     G_OBJECT_CLASS(playback_channel_parent_class)->constructed(object);
 
-    if (snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_CELT_0_5_1, SND_CODEC_ANY_FREQUENCY)) {
-        red_channel_set_cap(RED_CHANNEL(self), SPICE_PLAYBACK_CAP_CELT_0_5_1);
-    }
     red_channel_set_cap(RED_CHANNEL(self), SPICE_PLAYBACK_CAP_VOLUME);
 
     add_channel(self);
@@ -1430,9 +1423,6 @@ record_channel_constructed(GObject *object)
 
     G_OBJECT_CLASS(record_channel_parent_class)->constructed(object);
 
-    if (snd_codec_is_capable(SPICE_AUDIO_DATA_MODE_CELT_0_5_1, SND_CODEC_ANY_FREQUENCY)) {
-        red_channel_set_cap(RED_CHANNEL(self), SPICE_RECORD_CAP_CELT_0_5_1);
-    }
     red_channel_set_cap(RED_CHANNEL(self), SPICE_RECORD_CAP_VOLUME);
 
     add_channel(self);
@@ -1497,12 +1487,9 @@ void snd_set_playback_compression(bool on)
         if (type == SPICE_CHANNEL_PLAYBACK && client) {
             PlaybackChannelClient* playback = PLAYBACK_CHANNEL_CLIENT(client);
             RedChannelClient *rcc = RED_CHANNEL_CLIENT(playback);
-            bool client_can_celt = red_channel_client_test_remote_cap(rcc,
-                                    SPICE_PLAYBACK_CAP_CELT_0_5_1);
             bool client_can_opus = red_channel_client_test_remote_cap(rcc,
                                     SPICE_PLAYBACK_CAP_OPUS);
-            int desired_mode = snd_desired_audio_mode(on, now->frequency,
-                                                      client_can_celt, client_can_opus);
+            int desired_mode = snd_desired_audio_mode(on, now->frequency, client_can_opus);
             if (playback->mode != desired_mode) {
                 playback->mode = desired_mode;
                 snd_set_command(client, SND_PLAYBACK_MODE_MASK);


More information about the Spice-commits mailing list