summaryrefslogtreecommitdiff
path: root/src
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 /src
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.
Diffstat (limited to 'src')
-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 8c2efa49..8a9d39f7 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 028c86f6..1e34abd4 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 6d36a6aa..ea88ebdf 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 b778019d..488f69fc 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 54fed658..40ef5bc1 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 d6ea43fd..10bc67f9 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 1fcea171..54dceb4e 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 aaf7189f..753c1a1f 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 d02bb6b5..39c2ab4b 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 3d794125..c4746ca9 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 2952216d..1816fee9 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 a5756e54..6f82ff41 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 */