mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	rtpoll: Drop extra wait_op argument to pa_rtpoll_run()
is always true, not used Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
This commit is contained in:
		
							parent
							
								
									2638591497
								
							
						
					
					
						commit
						fa092af59c
					
				
					 17 changed files with 23 additions and 24 deletions
				
			
		| 
						 | 
					@ -1797,7 +1797,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
            pa_rtpoll_set_timer_disabled(u->rtpoll);
 | 
					            pa_rtpoll_set_timer_disabled(u->rtpoll);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Hmm, nothing to do. Let's sleep */
 | 
					        /* Hmm, nothing to do. Let's sleep */
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (rtpoll_sleep > 0) {
 | 
					        if (rtpoll_sleep > 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1516,7 +1516,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
            pa_rtpoll_set_timer_disabled(u->rtpoll);
 | 
					            pa_rtpoll_set_timer_disabled(u->rtpoll);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Hmm, nothing to do. Let's sleep */
 | 
					        /* Hmm, nothing to do. Let's sleep */
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (rtpoll_sleep > 0) {
 | 
					        if (rtpoll_sleep > 0) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1151,7 +1151,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
            pollfd->events = (short) (((u->sink && PA_SINK_IS_LINKED(u->sink->thread_info.state) && !writable) ? POLLOUT : 0) |
 | 
					            pollfd->events = (short) (((u->sink && PA_SINK_IS_LINKED(u->sink->thread_info.state) && !writable) ? POLLOUT : 0) |
 | 
				
			||||||
                                      (u->source && PA_SOURCE_IS_LINKED(u->source->thread_info.state) ? POLLIN : 0));
 | 
					                                      (u->source && PA_SOURCE_IS_LINKED(u->source->thread_info.state) ? POLLIN : 0));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) {
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0) {
 | 
				
			||||||
            pa_log_debug("pa_rtpoll_run failed with: %d", ret);
 | 
					            pa_log_debug("pa_rtpoll_run failed with: %d", ret);
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1498,7 +1498,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
            pollfd->events = (short) (((u->sink && PA_SINK_IS_LINKED(u->sink->thread_info.state) && !writable) ? POLLOUT : 0) |
 | 
					            pollfd->events = (short) (((u->sink && PA_SINK_IS_LINKED(u->sink->thread_info.state) && !writable) ? POLLOUT : 0) |
 | 
				
			||||||
                                      (u->source && PA_SOURCE_IS_LINKED(u->source->thread_info.state) ? POLLIN : 0));
 | 
					                                      (u->source && PA_SOURCE_IS_LINKED(u->source->thread_info.state) ? POLLIN : 0));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) {
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0) {
 | 
				
			||||||
            pa_log_debug("pa_rtpoll_run failed with: %d", ret);
 | 
					            pa_log_debug("pa_rtpoll_run failed with: %d", ret);
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -335,7 +335,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Hmm, nothing to do. Let's sleep */
 | 
					        /* Hmm, nothing to do. Let's sleep */
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) {
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0) {
 | 
				
			||||||
            pa_log_info("pa_rtpoll_run() = %i", ret);
 | 
					            pa_log_info("pa_rtpoll_run() = %i", ret);
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -307,7 +307,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
            pollfd->events = (short) (PA_SINK_IS_OPENED(u->sink->thread_info.state) ? POLLOUT : 0);
 | 
					            pollfd->events = (short) (PA_SINK_IS_OPENED(u->sink->thread_info.state) ? POLLOUT : 0);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ret == 0)
 | 
					        if (ret == 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -226,7 +226,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
            pa_rtpoll_set_timer_disabled(u->rtpoll);
 | 
					            pa_rtpoll_set_timer_disabled(u->rtpoll);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Hmm, nothing to do. Let's sleep */
 | 
					        /* Hmm, nothing to do. Let's sleep */
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ret == 0)
 | 
					        if (ret == 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -159,7 +159,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
            pa_rtpoll_set_timer_disabled(u->rtpoll);
 | 
					            pa_rtpoll_set_timer_disabled(u->rtpoll);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Hmm, nothing to do. Let's sleep */
 | 
					        /* Hmm, nothing to do. Let's sleep */
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ret == 0)
 | 
					        if (ret == 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -196,7 +196,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
        /* Hmm, nothing to do. Let's sleep */
 | 
					        /* Hmm, nothing to do. Let's sleep */
 | 
				
			||||||
        pollfd->events = (short) (u->sink->thread_info.state == PA_SINK_RUNNING ? POLLOUT : 0);
 | 
					        pollfd->events = (short) (u->sink->thread_info.state == PA_SINK_RUNNING ? POLLOUT : 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ret == 0)
 | 
					        if (ret == 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,7 +184,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
        /* Hmm, nothing to do. Let's sleep */
 | 
					        /* Hmm, nothing to do. Let's sleep */
 | 
				
			||||||
        pollfd->events = (short) (u->source->thread_info.state == PA_SOURCE_RUNNING ? POLLIN : 0);
 | 
					        pollfd->events = (short) (u->source->thread_info.state == PA_SOURCE_RUNNING ? POLLIN : 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ret == 0)
 | 
					        if (ret == 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -178,7 +178,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
            pa_rtpoll_set_timer_disabled(u->rtpoll);
 | 
					            pa_rtpoll_set_timer_disabled(u->rtpoll);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Hmm, nothing to do. Let's sleep */
 | 
					        /* Hmm, nothing to do. Let's sleep */
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ret == 0)
 | 
					        if (ret == 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -717,7 +717,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
            pa_sink_process_rewind(u->sink, 0);
 | 
					            pa_sink_process_rewind(u->sink, 0);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ret == 0)
 | 
					        if (ret == 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1131,7 +1131,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Hmm, nothing to do. Let's sleep */
 | 
					        /* Hmm, nothing to do. Let's sleep */
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ret == 0)
 | 
					        if (ret == 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -466,7 +466,7 @@ static void thread_func(void *userdata) {
 | 
				
			||||||
            pollfd->events = POLLOUT; /*PA_SINK_IS_OPENED(u->sink->thread_info.state)  ? POLLOUT : 0;*/
 | 
					            pollfd->events = POLLOUT; /*PA_SINK_IS_OPENED(u->sink->thread_info.state)  ? POLLOUT : 0;*/
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0)
 | 
					        if ((ret = pa_rtpoll_run(u->rtpoll)) < 0)
 | 
				
			||||||
            goto fail;
 | 
					            goto fail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ret == 0)
 | 
					        if (ret == 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -203,7 +203,7 @@ static void reset_all_revents(pa_rtpoll *p) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int pa_rtpoll_run(pa_rtpoll *p, bool wait_op) {
 | 
					int pa_rtpoll_run(pa_rtpoll *p) {
 | 
				
			||||||
    pa_rtpoll_item *i;
 | 
					    pa_rtpoll_item *i;
 | 
				
			||||||
    int r = 0;
 | 
					    int r = 0;
 | 
				
			||||||
    struct timeval timeout;
 | 
					    struct timeval timeout;
 | 
				
			||||||
| 
						 | 
					@ -285,7 +285,7 @@ int pa_rtpoll_run(pa_rtpoll *p, bool wait_op) {
 | 
				
			||||||
    pa_zero(timeout);
 | 
					    pa_zero(timeout);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Calculate timeout */
 | 
					    /* Calculate timeout */
 | 
				
			||||||
    if (wait_op && !p->quit && p->timer_enabled) {
 | 
					    if (!p->quit && p->timer_enabled) {
 | 
				
			||||||
        struct timeval now;
 | 
					        struct timeval now;
 | 
				
			||||||
        pa_rtclock_get(&now);
 | 
					        pa_rtclock_get(&now);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -298,7 +298,7 @@ int pa_rtpoll_run(pa_rtpoll *p, bool wait_op) {
 | 
				
			||||||
        pa_usec_t now = pa_rtclock_now();
 | 
					        pa_usec_t now = pa_rtclock_now();
 | 
				
			||||||
        p->awake = now - p->timestamp;
 | 
					        p->awake = now - p->timestamp;
 | 
				
			||||||
        p->timestamp = now;
 | 
					        p->timestamp = now;
 | 
				
			||||||
        if (wait_op && !p->quit && p->timer_enabled)
 | 
					        if (!p->quit && p->timer_enabled)
 | 
				
			||||||
            pa_log("poll timeout: %d ms ",(int) ((timeout.tv_sec*1000) + (timeout.tv_usec / 1000)));
 | 
					            pa_log("poll timeout: %d ms ",(int) ((timeout.tv_sec*1000) + (timeout.tv_usec / 1000)));
 | 
				
			||||||
        else if (q->quit)
 | 
					        else if (q->quit)
 | 
				
			||||||
            pa_log("poll timeout is ZERO");
 | 
					            pa_log("poll timeout is ZERO");
 | 
				
			||||||
| 
						 | 
					@ -313,10 +313,10 @@ int pa_rtpoll_run(pa_rtpoll *p, bool wait_op) {
 | 
				
			||||||
        struct timespec ts;
 | 
					        struct timespec ts;
 | 
				
			||||||
        ts.tv_sec = timeout.tv_sec;
 | 
					        ts.tv_sec = timeout.tv_sec;
 | 
				
			||||||
        ts.tv_nsec = timeout.tv_usec * 1000;
 | 
					        ts.tv_nsec = timeout.tv_usec * 1000;
 | 
				
			||||||
        r = ppoll(p->pollfd, p->n_pollfd_used, (!wait_op || p->quit || p->timer_enabled) ? &ts : NULL, NULL);
 | 
					        r = ppoll(p->pollfd, p->n_pollfd_used, (p->quit || p->timer_enabled) ? &ts : NULL, NULL);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
    r = pa_poll(p->pollfd, p->n_pollfd_used, (!wait_op || p->quit || p->timer_enabled) ? (int) ((timeout.tv_sec*1000) + (timeout.tv_usec / 1000)) : -1);
 | 
					    r = pa_poll(p->pollfd, p->n_pollfd_used, (p->quit || p->timer_enabled) ? (int) ((timeout.tv_sec*1000) + (timeout.tv_usec / 1000)) : -1);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    p->timer_elapsed = r == 0;
 | 
					    p->timer_elapsed = r == 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,11 +57,10 @@ pa_rtpoll *pa_rtpoll_new(void);
 | 
				
			||||||
void pa_rtpoll_free(pa_rtpoll *p);
 | 
					void pa_rtpoll_free(pa_rtpoll *p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Sleep on the rtpoll until the time event, or any of the fd events
 | 
					/* Sleep on the rtpoll until the time event, or any of the fd events
 | 
				
			||||||
 * is triggered. If "wait" is 0 we don't sleep but only update the
 | 
					 * is triggered. Returns negative on error, positive if the loop
 | 
				
			||||||
 * struct pollfd. Returns negative on error, positive if the loop
 | 
					 | 
				
			||||||
 * should continue to run, 0 when the loop should be terminated
 | 
					 * should continue to run, 0 when the loop should be terminated
 | 
				
			||||||
 * cleanly. */
 | 
					 * cleanly. */
 | 
				
			||||||
int pa_rtpoll_run(pa_rtpoll *f, bool wait);
 | 
					int pa_rtpoll_run(pa_rtpoll *f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void pa_rtpoll_set_timer_absolute(pa_rtpoll *p, pa_usec_t usec);
 | 
					void pa_rtpoll_set_timer_absolute(pa_rtpoll *p, pa_usec_t usec);
 | 
				
			||||||
void pa_rtpoll_set_timer_relative(pa_rtpoll *p, pa_usec_t usec);
 | 
					void pa_rtpoll_set_timer_relative(pa_rtpoll *p, pa_usec_t usec);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,7 @@ START_TEST (rtpoll_test) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_rtpoll_set_timer_relative(p, 10000000); /* 10 s */
 | 
					    pa_rtpoll_set_timer_relative(p, 10000000); /* 10 s */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_rtpoll_run(p, 1);
 | 
					    pa_rtpoll_run(p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_rtpoll_item_free(i);
 | 
					    pa_rtpoll_item_free(i);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@ START_TEST (rtpoll_test) {
 | 
				
			||||||
    pollfd->fd = 0;
 | 
					    pollfd->fd = 0;
 | 
				
			||||||
    pollfd->events = POLLIN;
 | 
					    pollfd->events = POLLIN;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_rtpoll_run(p, 1);
 | 
					    pa_rtpoll_run(p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_rtpoll_item_free(i);
 | 
					    pa_rtpoll_item_free(i);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue