modules: Micro-optimisation for rewind_requested paths

Since some devices can be chatty with regards to how often they return
from poll(), this adds a PA_UNLIKELY() to all the the rewind_requested
checks in our sink modules to make the general case (no rewind was
requested) the fast path.
This commit is contained in:
Arun Raghavan 2012-11-16 23:09:15 +05:30
parent 29f064aa3d
commit e5953fb0dd
12 changed files with 12 additions and 12 deletions

View file

@ -1081,7 +1081,7 @@ static void thread_func(void *userdata) {
if (u->sink && PA_SINK_IS_LINKED(u->sink->thread_info.state)) {
if (u->sink->thread_info.rewind_requested)
if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
pa_sink_process_rewind(u->sink, 0);
if (pollfd) {

View file

@ -229,7 +229,7 @@ static void thread_func(void *userdata) {
for (;;) {
int ret;
if (u->sink->thread_info.rewind_requested)
if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
pa_sink_process_rewind(u->sink, 0);
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0)

View file

@ -665,7 +665,7 @@ static void thread_func(void *userdata) {
int ret;
PA_LLIST_FOREACH(ca_sink, u->sinks) {
if (ca_sink->pa_sink->thread_info.rewind_requested)
if (PA_UNLIKELY(ca_sink->pa_sink->thread_info.rewind_requested))
pa_sink_process_rewind(ca_sink->pa_sink, 0);
}

View file

@ -305,7 +305,7 @@ static void thread_func(void *userdata) {
for (;;) {
int ret;
if (u->sink->thread_info.rewind_requested)
if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
pa_sink_process_rewind(u->sink, 0);
/* If no outputs are connected, render some data and drop it immediately. */

View file

@ -213,7 +213,7 @@ static void thread_func(void *userdata) {
for (;;) {
int ret;
if (u->sink->thread_info.rewind_requested)
if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
pa_sink_process_rewind(u->sink, 0);
if (u->rtpoll_item) {

View file

@ -213,7 +213,7 @@ static void thread_func(void *userdata) {
if (PA_SINK_IS_OPENED(u->sink->thread_info.state))
now = pa_rtclock_now();
if (u->sink->thread_info.rewind_requested)
if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
process_rewind(u, now);
/* Render some data and drop it immediately */

View file

@ -180,7 +180,7 @@ static void thread_func(void *userdata) {
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
if (u->sink->thread_info.rewind_requested)
if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
pa_sink_process_rewind(u->sink, 0);
/* Render some data and write it to the fifo */

View file

@ -628,7 +628,7 @@ static void thread_func(void *userdata) {
for (;;) {
/* Render some data and write it to the dsp */
if (u->sink->thread_info.rewind_requested)
if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
process_rewind(u);
if (u->sink && PA_SINK_IS_OPENED(u->sink->thread_info.state)) {

View file

@ -256,7 +256,7 @@ static void thread_func(void *userdata) {
pa_bool_t need_timer = FALSE;
if (u->sink) {
if (u->sink->thread_info.rewind_requested)
if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
pa_sink_process_rewind(u->sink, 0);
if (PA_SINK_IS_OPENED(u->sink->thread_info.state)) {

View file

@ -891,7 +891,7 @@ static void thread_func(void *userdata) {
/* pa_log("loop"); */
if (u->sink && u->sink->thread_info.rewind_requested)
if (PA_UNLIKELY(u->sink && u->sink->thread_info.rewind_requested))
pa_sink_process_rewind(u->sink, 0);
/* Render some data and write it to the dsp */

View file

@ -327,7 +327,7 @@ static void thread_func(void *userdata) {
for (;;) {
int ret;
if (u->sink->thread_info.rewind_requested)
if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
pa_sink_process_rewind(u->sink, 0);
if (u->rtpoll_item) {

View file

@ -338,7 +338,7 @@ static void thread_func(void *userdata) {
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);
if (u->sink->thread_info.rewind_requested)
if (PA_UNLIKELY(u->sink->thread_info.rewind_requested))
pa_sink_process_rewind(u->sink, 0);
/* Render some data and write it to the fifo */