summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <arun.raghavan@collabora.co.uk>2012-11-16 23:09:15 +0530
committerArun Raghavan <arun.raghavan@collabora.co.uk>2012-11-16 23:16:05 +0530
commite5953fb0ddf8c4a84c815f72755261e7dadbf00e (patch)
tree1abc72cd4175a895c2e0f3f575d119d8c209ef26
parent29f064aa3d3a83e275361aad3f9e7efdc84b8ad0 (diff)
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.
-rw-r--r--src/modules/bluetooth/module-bluetooth-device.c2
-rw-r--r--src/modules/jack/module-jack-sink.c2
-rw-r--r--src/modules/macosx/module-coreaudio-device.c2
-rw-r--r--src/modules/module-combine-sink.c2
-rw-r--r--src/modules/module-esound-sink.c2
-rw-r--r--src/modules/module-null-sink.c2
-rw-r--r--src/modules/module-pipe-sink.c2
-rw-r--r--src/modules/module-solaris.c2
-rw-r--r--src/modules/module-waveout.c2
-rw-r--r--src/modules/oss/module-oss.c2
-rw-r--r--src/modules/raop/module-raop-sink.c2
-rw-r--r--src/modules/xen/module-xenpv-sink.c2
12 files changed, 12 insertions, 12 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 8c2efa492..8a9d39f78 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -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) {
diff --git a/src/modules/jack/module-jack-sink.c b/src/modules/jack/module-jack-sink.c
index 028c86f61..1e34abd46 100644
--- a/src/modules/jack/module-jack-sink.c
+++ b/src/modules/jack/module-jack-sink.c
@@ -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)
diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c
index 6d36a6aa1..ea88ebdfd 100644
--- a/src/modules/macosx/module-coreaudio-device.c
+++ b/src/modules/macosx/module-coreaudio-device.c
@@ -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);
}
diff --git a/src/modules/module-combine-sink.c b/src/modules/module-combine-sink.c
index b778019d9..488f69fc2 100644
--- a/src/modules/module-combine-sink.c
+++ b/src/modules/module-combine-sink.c
@@ -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. */
diff --git a/src/modules/module-esound-sink.c b/src/modules/module-esound-sink.c
index 54fed658c..40ef5bc1d 100644
--- a/src/modules/module-esound-sink.c
+++ b/src/modules/module-esound-sink.c
@@ -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) {
diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c
index d6ea43fd3..10bc67f91 100644
--- a/src/modules/module-null-sink.c
+++ b/src/modules/module-null-sink.c
@@ -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 */
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 1fcea171b..54dceb4e7 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -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 */
diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c
index aaf7189fd..753c1a1fd 100644
--- a/src/modules/module-solaris.c
+++ b/src/modules/module-solaris.c
@@ -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)) {
diff --git a/src/modules/module-waveout.c b/src/modules/module-waveout.c
index d02bb6b5e..39c2ab4b0 100644
--- a/src/modules/module-waveout.c
+++ b/src/modules/module-waveout.c
@@ -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)) {
diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c
index 3d7941258..c4746ca97 100644
--- a/src/modules/oss/module-oss.c
+++ b/src/modules/oss/module-oss.c
@@ -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 */
diff --git a/src/modules/raop/module-raop-sink.c b/src/modules/raop/module-raop-sink.c
index 2952216d8..1816fee91 100644
--- a/src/modules/raop/module-raop-sink.c
+++ b/src/modules/raop/module-raop-sink.c
@@ -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) {
diff --git a/src/modules/xen/module-xenpv-sink.c b/src/modules/xen/module-xenpv-sink.c
index a5756e545..6f82ff41d 100644
--- a/src/modules/xen/module-xenpv-sink.c
+++ b/src/modules/xen/module-xenpv-sink.c
@@ -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 */