Browse Source

fix minor invisible buglet with POLLERR, and add more timed debugging for clients

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@243 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
pbd 23 years ago
parent
commit
d632faed44
3 changed files with 32 additions and 12 deletions
  1. +1
    -1
      configure.in
  2. +26
    -6
      drivers/alsa/alsa_driver.c
  3. +5
    -5
      libjack/client.c

+ 1
- 1
configure.in View File

@@ -5,7 +5,7 @@ AC_CONFIG_AUX_DIR(.)


JACK_MAJOR_VERSION=0 JACK_MAJOR_VERSION=0
JACK_MINOR_VERSION=37 JACK_MINOR_VERSION=37
JACK_MICRO_VERSION=1
JACK_MICRO_VERSION=2


BETA= BETA=




+ 26
- 6
drivers/alsa/alsa_driver.c View File

@@ -42,6 +42,8 @@ extern void store_wait_time (int);
extern void show_wait_times (); extern void show_wait_times ();
extern void show_work_times (); extern void show_work_times ();


#undef DEBUG_WAKEUP

static void static void
alsa_driver_release_channel_dependent_memory (alsa_driver_t *driver) alsa_driver_release_channel_dependent_memory (alsa_driver_t *driver)


@@ -242,7 +244,8 @@ alsa_driver_configure_stream (alsa_driver_t *driver,
int err; int err;


if ((err = snd_pcm_hw_params_any (handle, hw_params)) < 0) { if ((err = snd_pcm_hw_params_any (handle, hw_params)) < 0) {
jack_error ("ALSA: no playback configurations available");
jack_error ("ALSA: no playback configurations available (%s)",
snd_strerror (err));
return -1; return -1;
} }


@@ -318,7 +321,7 @@ alsa_driver_configure_stream (alsa_driver_t *driver,


snd_pcm_sw_params_current (handle, sw_params); snd_pcm_sw_params_current (handle, sw_params);


if ((err = snd_pcm_sw_params_set_start_threshold (handle, sw_params, ~0U)) < 0) {
if ((err = snd_pcm_sw_params_set_start_threshold (handle, sw_params, 0U)) < 0) {
jack_error ("ALSA: cannot set start mode for %s", stream_name); jack_error ("ALSA: cannot set start mode for %s", stream_name);
return -1; return -1;
} }
@@ -827,7 +830,7 @@ alsa_driver_wait (alsa_driver_t *driver, int extra_fd, int *status, float *delay
/* ALSA doesn't set POLLERR in some versions of 0.9.X */ /* ALSA doesn't set POLLERR in some versions of 0.9.X */
for (i = 0; i < nfds; i++) { for (i = 0; i < nfds; i++) {
driver->pfd[nfds].events |= POLLERR;
driver->pfd[i].events |= POLLERR;
} }


if (extra_fd >= 0) { if (extra_fd >= 0) {
@@ -876,7 +879,7 @@ alsa_driver_wait (alsa_driver_t *driver, int extra_fd, int *status, float *delay
/* we timed out on the extra fd */ /* we timed out on the extra fd */


*status = -4; *status = -4;
#if 0
#ifdef DEBUG_WAKEUP
printf ("checked %d fds, at %Lu %.9f usecs since poll entered\n", printf ("checked %d fds, at %Lu %.9f usecs since poll entered\n",
nfds, nfds,
poll_ret, poll_ret,
@@ -901,11 +904,17 @@ alsa_driver_wait (alsa_driver_t *driver, int extra_fd, int *status, float *delay
if (driver->pfd[i].revents == 0) { if (driver->pfd[i].revents == 0) {
p_timed_out++; p_timed_out++;
#ifdef DEBUG_WAKEUP
fprintf (stderr, "%Lu playback stream timed out\n", poll_ret);
#endif
} }
} }

if (p_timed_out == 0) { if (p_timed_out == 0) {
need_playback = 0; need_playback = 0;
#ifdef DEBUG_WAKEUP
fprintf (stderr, "%Lu playback stream ready\n", poll_ret);
#endif
} }
} }
@@ -919,11 +928,17 @@ alsa_driver_wait (alsa_driver_t *driver, int extra_fd, int *status, float *delay
if (driver->pfd[i].revents == 0) { if (driver->pfd[i].revents == 0) {
c_timed_out++; c_timed_out++;
#ifdef DEBUG_WAKEUP
fprintf (stderr, "%Lu capture stream timed out\n", poll_ret);
#endif
} }
} }
if (c_timed_out == 0) { if (c_timed_out == 0) {
need_capture = 0; need_capture = 0;
#ifdef DEBUG_WAKEUP
fprintf (stderr, "%Lu capture stream ready\n", poll_ret);
#endif
} }
} }
@@ -968,7 +983,12 @@ alsa_driver_wait (alsa_driver_t *driver, int extra_fd, int *status, float *delay
*status = 0; *status = 0;


avail = capture_avail < playback_avail ? capture_avail : playback_avail; avail = capture_avail < playback_avail ? capture_avail : playback_avail;

#ifdef DEBUG_WAKEUP
fprintf (stderr, "wakup complete, avail = %lu, pavail = %lu cavail = %lu\n",
avail, playback_avail, capture_avail);
#endif

/* constrain the available count to the nearest (round down) number of /* constrain the available count to the nearest (round down) number of
periods. periods.
*/ */


+ 5
- 5
libjack/client.c View File

@@ -547,7 +547,7 @@ jack_client_thread (void *arg)
status = -1; status = -1;
break; break;
} }
if (client->pollfd[0].revents & ~POLLIN) { if (client->pollfd[0].revents & ~POLLIN) {
jack_error ("engine has shut down socket; thread exiting"); jack_error ("engine has shut down socket; thread exiting");
if (client->on_shutdown) { if (client->on_shutdown) {
@@ -626,10 +626,10 @@ jack_client_thread (void *arg)
} }


if (client->pollfd[1].revents & POLLIN) { if (client->pollfd[1].revents & POLLIN) {
DEBUG ("client told to process() (wakeup on graph_wait_fd==%d)", client->pollfd[1].fd);

control->signalled_at = get_cycles(); control->signalled_at = get_cycles();


DEBUG ("client told to process() at %Lu (wakeup on graph_wait_fd==%d)", control->signalled_at, client->pollfd[1].fd);

control->state = Running; control->state = Running;


if (control->process) { if (control->process) {
@@ -644,7 +644,7 @@ jack_client_thread (void *arg)


/* pass the execution token along */ /* pass the execution token along */


DEBUG ("client finished processing, writing on graph_next_fd==%d", client->graph_next_fd);
DEBUG ("client finished processing at %Lu, writing on graph_next_fd==%d", control->finished_at, client->graph_next_fd);


if (write (client->graph_next_fd, &c, sizeof (c)) != sizeof (c)) { if (write (client->graph_next_fd, &c, sizeof (c)) != sizeof (c)) {
jack_error ("cannot continue execution of the processing graph (%s)", strerror(errno)); jack_error ("cannot continue execution of the processing graph (%s)", strerror(errno));
@@ -652,7 +652,7 @@ jack_client_thread (void *arg)
break; break;
} }


DEBUG ("client reading on graph_wait_fd==%d", client->graph_wait_fd);
DEBUG ("client sent message to next stage by %Lu, client reading on graph_wait_fd==%d", get_cycles(), client->graph_wait_fd);


if ((read (client->graph_wait_fd, &c, sizeof (c)) != sizeof (c))) { if ((read (client->graph_wait_fd, &c, sizeof (c)) != sizeof (c))) {
DEBUG ("WARNING: READ FAILED!"); DEBUG ("WARNING: READ FAILED!");


Loading…
Cancel
Save