After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 575008 - Should play a sound when calling
Should play a sound when calling
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: VoIP
2.25.x
Other Linux
: Normal enhancement
: ---
Assigned To: empathy-maint
Depends on:
Blocks:
 
 
Reported: 2009-03-11 22:41 UTC by Guillaume Desmottes
Modified: 2009-06-26 16:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The phone-outgoing-calling sound seems not to be included by default on most installations. Branch containing the fix: http://git.collabora.co.uk/?p=user/jtellier/empathy.git;a=shortlog;h=refs/heads/play-sound-when-calling (13.12 KB, patch)
2009-06-17 15:13 UTC, Jonathan Tellier
none Details | Review
Fixed and created a new sound module. (35.87 KB, patch)
2009-06-19 15:08 UTC, Jonathan Tellier
none Details | Review
Addressed problems pointed out by Xavier. See commit message for details. (36.90 KB, patch)
2009-06-19 19:32 UTC, Jonathan Tellier
none Details | Review
fixed (38.50 KB, patch)
2009-06-23 13:23 UTC, Jonathan Tellier
none Details | Review

Description Guillaume Desmottes 2009-03-11 22:41:01 UTC
When you call someone, empathy should play a phone song while the call is ringing on the other side.
Comment 1 Xavier Claessens 2009-03-12 11:21:17 UTC
Is there a name for that sound in the fd.o sound naming spec?
Comment 2 Pierre-Luc Beaudoin 2009-03-12 11:33:00 UTC
As per http://0pointer.de/public/sound-naming-spec.html , "phone-incoming-call" is what you are looking for.
Comment 3 Frederic Peters 2009-03-12 11:34:08 UTC
Wrong answer, phone-outgoing-calling.
Comment 4 Pierre-Luc Beaudoin 2009-03-12 11:36:25 UTC
Ah I read this bug all the way around.
Comment 5 Pierre-Luc Beaudoin 2009-03-12 11:41:24 UTC
It should also be noted that this sound is highly locale specific... I don't know how the sound spec deals with that.
Comment 6 Xavier Claessens 2009-05-21 10:38:47 UTC
I agree we should just play that sound. We already do for incoming sounds. Let's set the gnome-love keyword, it's an easy bug for beginners :)

@Pierre-Luc: I supposes in the future you could use something like "gnome-sound-theme-fr".
Comment 7 Jonathan Tellier 2009-06-17 15:13:59 UTC
Created attachment 136840 [details] [review]
The phone-outgoing-calling sound seems not to be included by default on most installations. Branch containing the fix: http://git.collabora.co.uk/?p=user/jtellier/empathy.git;a=shortlog;h=refs/heads/play-sound-when-calling

 src/empathy-call-window.c   |   65 +++++++++++++++++--------
 src/empathy-event-manager.c |  110 +++++++++++++++++++++++++++++++------------
 src/empathy-event-manager.h |    5 ++-
 3 files changed, 127 insertions(+), 53 deletions(-)
Comment 8 Xavier Claessens 2009-06-17 15:39:04 UTC
I didn't read your patch totally, but as a first cleanup, I think we should move sound related functions to empathy-sound.c,h. I's bad to use empathy-ui-utils for such thing I think.
Comment 9 Guillaume Desmottes 2009-06-17 15:58:29 UTC
I'd reorder the CONNECTED and CONNECTING states to make them more logic.

You could use a typdef enum CallState.

empathy_call_window_set_state_connecting won't be called with incoming call too?

I prefer to let Xavier review the event-manager part.

Comment 10 Jonathan Tellier 2009-06-19 15:08:33 UTC
Created attachment 137012 [details] [review]
Fixed and created a new sound module.

 libempathy-gtk/Makefile.am        |    2 +
 libempathy-gtk/empathy-sound.c    |  276 +++++++++++++++++++++++++++++++++++++
 libempathy-gtk/empathy-sound.h    |   57 ++++++++
 libempathy-gtk/empathy-ui-utils.c |  139 +------------------
 libempathy-gtk/empathy-ui-utils.h |   26 ----
 po/POTFILES.in                    |    1 +
 src/empathy-call-window.c         |   89 +++++++++----
 src/empathy-call-window.h         |    3 +-
 src/empathy-chat-window.c         |    1 +
 src/empathy-event-manager.c       |  135 ++++++++++--------
 src/empathy-event-manager.h       |    5 +-
 src/empathy-main-window.c         |   11 +-
 src/empathy.c                     |    2 +-
 13 files changed, 490 insertions(+), 257 deletions(-)
Comment 11 Jonathan Tellier 2009-06-19 19:32:43 UTC
Created attachment 137024 [details] [review]
Addressed problems pointed out by Xavier. See commit message for details.

 libempathy-gtk/Makefile.am        |    2 +
 libempathy-gtk/empathy-sound.c    |  306 +++++++++++++++++++++++++++++++++++++
 libempathy-gtk/empathy-sound.h    |   56 +++++++
 libempathy-gtk/empathy-ui-utils.c |  139 +-----------------
 libempathy-gtk/empathy-ui-utils.h |   26 ---
 po/POTFILES.in                    |    1 +
 src/empathy-call-window.c         |   89 ++++++++---
 src/empathy-call-window.h         |    3 +-
 src/empathy-chat-window.c         |    1 +
 src/empathy-event-manager.c       |  125 ++++++++--------
 src/empathy-event-manager.h       |    5 +-
 src/empathy-main-window.c         |   11 +-
 src/empathy.c                     |    2 +-
 13 files changed, 509 insertions(+), 257 deletions(-)
Comment 12 Xavier Claessens 2009-06-20 17:57:35 UTC
Thanks. Some additionnal comments:

1) You should reorder functions to not declare playing_finished_cb on top.
2) Remove timeout_before_replay from the doc of empathy_sound_stop.
3) You should add a destroy func for the value inserted in repeating_sounds hash table. That function will remove the source if any and free the struct. Like that in empathy_sound_stop you can simply call g_hash_table_remove(repeating_sounds, GINT_TO_POINTER (sound_id))
4) I don't think you have to free the hash table if it gets empty, it's fine to leak such thing. Or you can add a g_atexit() if you want.
5) doc of empathy_sound_play_full says it's for empathy_sound_play
6) Why are you using g_hash_table_lookup_extended()? g_hash_table_lookup seems enough...
7) There is a typo in the name event_soure_id, it is 'source' no? What about renaming it to replay_timeout_id?
8) You should connect "destroy" signal on widget in empathy_sound_start_playing() to stop the sound if the widget is destroyed.
9) empathy_sound_start_playing should first check if it's already in the hash table and return if the sound is already being played in loop.
10) _start_playing() should check for the gconf key to avoid entering the loop if that sound is disabled.
11) if empathy_sound_stop is called when the sound is being played, playing_finished_cb() will be called and the sound will get played again.
12) if you call empathy_sound_play_full when a repeated sound is being played, event_source_id will be 0 and the sound being played will be cancelled. Which will remove the sound from hash table if you fix point 11. I think we should instead have empathy_sound_play_internal() private function that will be used by empathy_sound_play_full and from playing_timeout_cb. Like that in empathy_sound_play_full you can check if the sound is in hash table and return directly or call empathy_sound_play_internal if it's not found.
Comment 13 Jonathan Tellier 2009-06-23 13:23:13 UTC
I've just updated my branch. I have a question however:

> 4) I don't think you have to free the hash table if it gets empty, it's fine to
> leak such thing. Or you can add a g_atexit() if you want.

Why is it OK to leak such thing?
Comment 14 Jonathan Tellier 2009-06-23 13:23:28 UTC
Created attachment 137247 [details] [review]
fixed

 libempathy-gtk/Makefile.am        |    2 +
 libempathy-gtk/empathy-sound.c    |  353 +++++++++++++++++++++++++++++++++++++
 libempathy-gtk/empathy-sound.h    |   56 ++++++
 libempathy-gtk/empathy-ui-utils.c |  139 +---------------
 libempathy-gtk/empathy-ui-utils.h |   26 ---
 po/POTFILES.in                    |    1 +
 src/empathy-call-window.c         |   89 +++++++---
 src/empathy-call-window.h         |    3 +-
 src/empathy-chat-window.c         |    1 +
 src/empathy-event-manager.c       |  125 +++++++-------
 src/empathy-event-manager.h       |    5 +-
 src/empathy-main-window.c         |   11 +-
 src/empathy.c                     |    2 +-
 13 files changed, 556 insertions(+), 257 deletions(-)
Comment 15 Cosimo Cecchi 2009-06-23 16:24:53 UTC
(In reply to comment #13)

> Why is it OK to leak such thing?

Because it's a static global variable you only create at most once during the lifetime of the program.
The OS will release the memory for you at exit, if it has been allocated, and you save the (small) overhead of creating and freeing it every time you want to play a repeating sound.
Comment 16 Xavier Claessens 2009-06-26 16:29:09 UTC
I simplified the patch and pushed. Thanks for your great help!