]> code.delx.au - pulseaudio/commitdiff
modules: Micro-optimisation for rewind_requested paths
authorArun Raghavan <arun.raghavan@collabora.co.uk>
Fri, 16 Nov 2012 17:39:15 +0000 (23:09 +0530)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Fri, 16 Nov 2012 17:46:05 +0000 (23:16 +0530)
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.

12 files changed:
src/modules/bluetooth/module-bluetooth-device.c
src/modules/jack/module-jack-sink.c
src/modules/macosx/module-coreaudio-device.c
src/modules/module-combine-sink.c
src/modules/module-esound-sink.c
src/modules/module-null-sink.c
src/modules/module-pipe-sink.c
src/modules/module-solaris.c
src/modules/module-waveout.c
src/modules/oss/module-oss.c
src/modules/raop/module-raop-sink.c
src/modules/xen/module-xenpv-sink.c

index 8c2efa4924d895ae8a6630fba28716d8bae50209..8a9d39f784ab21e3ee5645306e59b89311efbc03 100644 (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) {
index 028c86f6199afe074ad5d6a08012b967dd42edfb..1e34abd46e9458c573b0eb0862e761267acfb24e 100644 (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)
index 6d36a6aa1465596e62c65de11081a2dcb5adcaac..ea88ebdfd829120ce77a15a8f3f1e7aeac595bf4 100644 (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);
         }
 
index b778019d9119de14a0daa5c55e17345c711c7d1e..488f69fc23bae4e630a6e96798b66a55ab8fa7af 100644 (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. */
index 54fed658c60f9b5e69d3f9893d720bf828e962cf..40ef5bc1dcfc5653815e2d22c5b8138b2dba3788 100644 (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) {
index d6ea43fd3bca5f3172889fa63fc533865201d687..10bc67f91504ed9727450280aab72bba2f948d9d 100644 (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 */
index 1fcea171b85a639126989dc2797a4457fd0d7a66..54dceb4e7fc18708958f22537945f725d40ce731 100644 (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 */
index aaf7189fdebcd24a7519aecae49ea7acaf4a4888..753c1a1fd5c1593f0780ac3d150086c2d47a1042 100644 (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)) {
index d02bb6b5e0342a9ba33f93fe55e1cac4ac017c68..39c2ab4b0a38904ce5f2d6fe16aa255c41d54518 100644 (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)) {
index 3d7941258ee9f0d8deab35d965d413abb7f739a7..c4746ca9761c316db640f340708e6d3c00038d16 100644 (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 */
index 2952216d8128092a27255d16703e587ae823966c..1816fee915401b5b8160edd251bfcd59c33ff630 100644 (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) {
index a5756e5457fb412e587ef24a0d7b398f251305d6..6f82ff41d64a56e38cd0d704760499eac7867d0f 100644 (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 */