I have made the following changes intended for : CE:Adaptation:N9xx-common / pulseaudio-modules-n900
Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below. https://build.pub.meego.com//request/show/7578 Thank You, Juho Hämäläinen [This message was auto-generated] --- Request # 7578: Messages from BOSS: State: review at 2012-12-21T13:46:09 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:jhamalai:branches:CE:Adaptation:N9xx-common / pulseaudio-modules-n900 -> CE:Adaptation:N9xx-common / pulseaudio-modules-n900 changes files: -------------- --- pulseaudio-modules-n900.changes +++ pulseaudio-modules-n900.changes @@ -0,0 +1,3 @@ +* Thu Dec 20 2012 Juho Hamalainen <[email protected]> - 2.1.2 +- Update mainvolume-module rate limit implementation. + old: ---- pulseaudio-modules-n900-2.1.1.tar.gz new: ---- pulseaudio-modules-n900-2.1.2.tar.gz spec files: ----------- --- pulseaudio-modules-n900.spec +++ pulseaudio-modules-n900.spec @@ -10,7 +10,7 @@ # << macros Summary: PulseAudio modules for Nemo -Version: 2.1.1 +Version: 2.1.2 Release: 0 Group: Multimedia/PulseAudio License: LGPLv2.1+ other changes: -------------- ++++++ pulseaudio-modules-n900-2.1.1.tar.gz -> pulseaudio-modules-n900-2.1.2.tar.gz --- m4/.gitignore +++ m4/.gitignore @@ -0,0 +1,5 @@ +libtool.m4 +ltoptions.m4 +ltsugar.m4 +ltversion.m4 +lt~obsolete.m4 --- src/.gitignore +++ src/.gitignore @@ -0,0 +1,5 @@ +.deps +.libs +*.la +*.lo +*.o --- src/mainvolume/mainvolume.h +++ src/mainvolume/mainvolume.h @@ -75,6 +75,7 @@ pa_time_event *signal_time_event; pa_usec_t last_signal_timestamp; + pa_usec_t last_step_set_timestamp; pa_dbus_protocol *dbus_protocol; char *dbus_path; --- src/mainvolume/module-meego-mainvolume.c +++ src/mainvolume/module-meego-mainvolume.c @@ -62,8 +62,11 @@ #define XMAEMO_CALL_STEPS "x-maemo.mainvolume.call" #define XMAEMO_MEDIA_STEPS "x-maemo.mainvolume.media" -/* Send dbus signals at most every SIGNAL_INTERVAL seconds. */ -#define SIGNAL_INTERVAL ((pa_usec_t)(1 * PA_USEC_PER_SEC)) +/* If multiple step change calls are coming in succession, wait SIGNAL_WAIT_TIME before + * sending change signal. */ +#define SIGNAL_WAIT_TIME ((pa_usec_t)(0.5 * PA_USEC_PER_SEC)) + +static void signal_steps(struct mv_userdata *u, pa_bool_t wait_for_mode_change); static void steps_set_free(struct mv_volume_steps_set *s, void *userdata) { pa_assert(s); @@ -89,13 +92,20 @@ signal_timer_stop(u); - /* signal changed step settings forward */ - dbus_signal_steps(u); + /* try signalling current steps again */ + signal_steps(u, FALSE); +} + +static void signal_timer_set(struct mv_userdata *u, const pa_usec_t time) { + pa_assert(u); + + /* only set time event if none currently pending */ + if (!u->signal_time_event) + u->signal_time_event = pa_core_rttime_new(u->core, time, signal_time_callback, u); } static void signal_steps(struct mv_userdata *u, pa_bool_t wait_for_mode_change) { pa_usec_t now; - pa_bool_t update_now; now = pa_rtclock_now(); @@ -107,21 +117,37 @@ * is changed from stream-restore, then stream-restore forwards that to us), we'll signal * our new step SIGNAL_INTERVAL late, but hopefully that's acceptable. (That scenario shouldn't * happen that often.) */ - if (wait_for_mode_change) - update_now = u->volume_change_ready && u->mode_change_ready; - else - update_now = TRUE; - if (update_now && now - u->last_signal_timestamp > SIGNAL_INTERVAL) { + /* always signal current steps during mode change */ + if (wait_for_mode_change) { + if (u->volume_change_ready && u->mode_change_ready) { + signal_timer_stop(u); + dbus_signal_steps(u); + } else + signal_timer_set(u, now + SIGNAL_WAIT_TIME); + return; + } + + /* if we haven't sent ack signal for a long time, send initial reply + * immediately */ + if (now - u->last_signal_timestamp >= SIGNAL_WAIT_TIME) { signal_timer_stop(u); - /* signal changed step settings forward */ dbus_signal_steps(u); return; } - if (!u->signal_time_event) - u->signal_time_event = pa_core_rttime_new(u->core, now + SIGNAL_INTERVAL, signal_time_callback, u); + /* Then if new set step events come really frequently, wait until step events stop before + * signaling */ + if (now - u->last_step_set_timestamp >= SIGNAL_WAIT_TIME) { + signal_timer_stop(u); + dbus_signal_steps(u); + return; + } else + /* keep last signal timestamp reseted so signals aren't sent every SIGNAL_WAIT_TIME */ + u->last_signal_timestamp = now; + + signal_timer_set(u, now + SIGNAL_WAIT_TIME); } static pa_hook_result_t call_state_cb(pa_call_state_tracker *t, void *active, struct mv_userdata *u) { @@ -543,6 +569,7 @@ pa_dbus_send_empty_reply(conn, msg); + u->last_step_set_timestamp = pa_rtclock_now(); signal_steps(u, FALSE); } ++++++ pulseaudio-modules-n900.yaml --- pulseaudio-modules-n900.yaml +++ pulseaudio-modules-n900.yaml @@ -1,6 +1,6 @@ Name: pulseaudio-modules-n900 Summary: PulseAudio modules for Nemo -Version: 2.1.1 +Version: 2.1.2 Release: 0 Group: Multimedia/PulseAudio License: LGPLv2.1+
