mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
protocol-native: Stop auto timing updates if connected to suspended sink or source
This quite is an old patch. It was added to N900 to avoid unnecessary wake-ups when the phone is in power save mode (= blank screen and no user interaction). In this situation if the user had a browser window with flash animation open pulseaudio kept waking up every 10 seconds, causing a severe hit to use times. Anyway I do not see any reason to send timing updates if the sink or source where the stream is connected to is suspended.
This commit is contained in:
parent
d5cb59a8d6
commit
47b7ca830e
1 changed files with 24 additions and 4 deletions
|
|
@ -389,12 +389,18 @@ static void request_auto_timing_update(pa_stream *s, pa_bool_t force) {
|
|||
}
|
||||
|
||||
if (s->auto_timing_update_event) {
|
||||
if (force)
|
||||
s->auto_timing_interval_usec = AUTO_TIMING_INTERVAL_START_USEC;
|
||||
if (s->suspended && !force) {
|
||||
pa_assert(s->mainloop);
|
||||
s->mainloop->time_free(s->auto_timing_update_event);
|
||||
s->auto_timing_update_event = NULL;
|
||||
} else {
|
||||
if (force)
|
||||
s->auto_timing_interval_usec = AUTO_TIMING_INTERVAL_START_USEC;
|
||||
|
||||
pa_context_rttime_restart(s->context, s->auto_timing_update_event, pa_rtclock_now() + s->auto_timing_interval_usec);
|
||||
pa_context_rttime_restart(s->context, s->auto_timing_update_event, pa_rtclock_now() + s->auto_timing_interval_usec);
|
||||
|
||||
s->auto_timing_interval_usec = PA_MIN(AUTO_TIMING_INTERVAL_END_USEC, s->auto_timing_interval_usec*2);
|
||||
s->auto_timing_interval_usec = PA_MIN(AUTO_TIMING_INTERVAL_END_USEC, s->auto_timing_interval_usec*2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -475,6 +481,8 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t
|
|||
* if prebuf is non-zero! */
|
||||
}
|
||||
|
||||
static void auto_timing_update_callback(pa_mainloop_api *m, pa_time_event *e, const struct timeval *t, void *userdata);
|
||||
|
||||
void pa_command_stream_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
|
||||
pa_context *c = userdata;
|
||||
pa_stream *s;
|
||||
|
|
@ -562,6 +570,12 @@ void pa_command_stream_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
|
|||
|
||||
s->suspended = suspended;
|
||||
|
||||
if ((s->flags & PA_STREAM_AUTO_TIMING_UPDATE) && !suspended && !s->auto_timing_update_event) {
|
||||
s->auto_timing_interval_usec = AUTO_TIMING_INTERVAL_START_USEC;
|
||||
s->auto_timing_update_event = pa_context_rttime_new(s->context, pa_rtclock_now() + s->auto_timing_interval_usec, &auto_timing_update_callback, s);
|
||||
request_auto_timing_update(s, TRUE);
|
||||
}
|
||||
|
||||
check_smoother_status(s, TRUE, FALSE, FALSE);
|
||||
request_auto_timing_update(s, TRUE);
|
||||
|
||||
|
|
@ -680,6 +694,12 @@ void pa_command_stream_suspended(pa_pdispatch *pd, uint32_t command, uint32_t ta
|
|||
|
||||
s->suspended = suspended;
|
||||
|
||||
if ((s->flags & PA_STREAM_AUTO_TIMING_UPDATE) && !suspended && !s->auto_timing_update_event) {
|
||||
s->auto_timing_interval_usec = AUTO_TIMING_INTERVAL_START_USEC;
|
||||
s->auto_timing_update_event = pa_context_rttime_new(s->context, pa_rtclock_now() + s->auto_timing_interval_usec, &auto_timing_update_callback, s);
|
||||
request_auto_timing_update(s, TRUE);
|
||||
}
|
||||
|
||||
check_smoother_status(s, TRUE, FALSE, FALSE);
|
||||
request_auto_timing_update(s, TRUE);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue