Compare commits

..

3 Commits

Author SHA1 Message Date
Kevin Bataille
75cfe07b14 Rename sound files with -fr suffix for French tones
Add country suffix to sound filenames to clarify the tone standard
in use. Remove the unsuffixed and North American variants.
2026-02-08 14:58:16 +01:00
Kevin Bataille
2c7cfff2d3 Fix use-after-free crash in media playback and use French tones
Replace North American ringback/busy tones with French standard
(440 Hz single tone with 1.5s/3.5s and 0.5s/0.5s cadences).

Fix a crash in on_playing_done where the error/cancel path freed
the MediaPlaybackData via g_autoptr without clearing the owning
pointer (data_calling/data_busy), leaving a dangling pointer that
would segfault on the next stop call.
2026-02-08 14:55:48 +01:00
Kevin Bataille
4d46cdb029 Bundle fallback ringback and busy tone audio files
Most desktop Linux sound themes lack telephony events like
phone-outgoing-calling and phone-outgoing-busy, causing gsound
playback to fail silently. Bundle OGG Vorbis fallback files and
pass GSOUND_ATTR_MEDIA_FILENAME alongside GSOUND_ATTR_EVENT_ID
so libcanberra falls back to the bundled audio when the theme
event is not found.
2026-02-08 14:45:35 +01:00
5 changed files with 43 additions and 0 deletions

View File

@@ -110,3 +110,10 @@ if compile_schemas.found()
args: ['--strict', '--dry-run', meson.current_source_dir()],
)
endif
# Sounds (fallback for systems without telephony events in sound theme)
install_data(
'sounds/phone-outgoing-calling-fr.oga',
'sounds/phone-outgoing-busy-fr.oga',
install_dir: join_paths(datadir, calls_name, 'sounds'),
)

Binary file not shown.

Binary file not shown.

View File

@@ -78,6 +78,8 @@ config_data.set_quoted('APP_DATA_NAME', calls_name)
config_data.set_quoted('GETTEXT_PACKAGE', calls_name)
config_data.set_quoted('LOCALEDIR', full_localedir)
config_data.set_quoted('PLUGIN_LIBDIR', full_calls_plugin_libdir)
config_data.set_quoted('CALLS_SOUNDS_DIR',
join_paths(prefix, get_option('datadir'), calls_name, 'sounds'))
config_data.set_quoted('PACKAGE_URL', calls_homepage)
config_data.set_quoted('PACKAGE_VERSION', calls_version)
config_data.set('PACKAGE_URL_RAW', calls_homepage)

View File

@@ -26,6 +26,8 @@
#include "calls-media-playback.h"
#include "calls-config.h"
#include <gsound.h>
@@ -96,6 +98,23 @@ playback_event_to_string (PlaybackEvent event)
}
}
static const char *
playback_event_to_filename (PlaybackEvent event)
{
switch (event) {
case PLAYBACK_CALLING:
return CALLS_SOUNDS_DIR "/phone-outgoing-calling-fr.oga";
case PLAYBACK_BUSY:
return CALLS_SOUNDS_DIR "/phone-outgoing-busy-fr.oga";
case PLAYBACK_LAST:
default:
return NULL;
}
}
static void
calls_media_playback_dispose (GObject *object)
{
@@ -156,6 +175,18 @@ on_playing_done (GObject *object,
g_warning ("Playing '%s' failed: %s",
playback_event_to_string (data->event),
error->message);
switch (data->event) {
case PLAYBACK_CALLING:
data->self->data_calling = NULL;
break;
case PLAYBACK_BUSY:
data->self->data_busy = NULL;
break;
case PLAYBACK_LAST:
default:
break;
}
} else {
if (g_timer_elapsed (data->timer, NULL) < data->min_playback_time) {
playback_data (g_steal_pointer (&data));
@@ -182,11 +213,13 @@ static void
playback_data (MediaPlaybackData *data)
{
const char *event_id;
const char *filename;
g_assert (CALLS_IS_MEDIA_PLAYBACK (data->self));
g_assert (data->self->context);
event_id = playback_event_to_string (data->event);
filename = playback_event_to_filename (data->event);
if (!event_id) {
g_warning ("No event id found for %d", data->event);
@@ -201,6 +234,7 @@ playback_data (MediaPlaybackData *data)
data,
GSOUND_ATTR_CANBERRA_CACHE_CONTROL, "volatile",
GSOUND_ATTR_EVENT_ID, event_id,
GSOUND_ATTR_MEDIA_FILENAME, filename,
NULL);
}