problem w/ esound



any suggestion will be appreciated.

i've been working at this problem for a long time now.  i have no idea
what is going wrong.

in an attempt to figure this out, i've implemented a simple
function to send an array of zeroes to ESounD.  _fd is set to
esd_play_stream_fallback( ... ).

-----------
size_t
AudioDevice::esound_test(){
  int size = 1024;
  size_t total = sizeof(short) * size;
  short *buffer = (short*) calloc (size,sizeof(short));
  int wrote = write(_fd, buffer, total);
  delete[] buffer;
  return wrote;
}
----------

the method esound_test is called twice consecutively.  both times,
the value of the ESD file descriptor is 14 (_fd = 14), thereby _fd is
still open when it is called the 2nd time.  however, the 2nd
time esound_test is called, the program and esound both crash.  i must not
understand something about how esound works.  the following is what was
printed out when i ran strace on my program.  after that is the strace on
esound.

--strace on my program--
write(2, "E:Playing\n", 10)             = 10
gettimeofday({1028570787, 179530}, NULL) = 0
ioctl(4, FIONREAD, [0])                 = 0
poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN},
{fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=12, events=POLLOUT,
revents=POLLOUT}], 6, 0) = 1
write(2, "play this, then pop it\n", 23) = 23
write(12, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
2048) = 2048
gettimeofday({1028570787, 184191}, NULL) = 0
ioctl(4, FIONREAD, [0])                 = 0
poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN},
{fd=10, events=POLLIN}, {fd=11, events=POLLIN}, {fd=12, events=POLLOUT,
revents=POLLOUT|POLLHUP}], 6, 0) = 1
write(2, "play this, then pop it\n", 23) = 23
write(12, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
2048) = -1 EPIPE (Broken pipe)
--- SIGPIPE (Broken pipe) ---
write(4, "f\0\3\0\200\0\0\0\1\0\0\0<\0\2\0\0\0`\4+\0\1\0", 24) = 24
read(4, "\1\1q\0\0\0\0\0\5\0 \2\0\0\0\0\0\0\0\0\0\0\0\0\1\0\0\0"..., 32) =
32
shutdown(4, 2 /* send and receive */)   = 0
close(4)                                = 0
_exit(0)                                = ?


--strace on esound--
select(8, [7], NULL, NULL, {0, 0})      = 1 (in [7], left {0, 0})
read(7, "galaudio\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 128)
= 128
setsockopt(7, SOL_SOCKET, SO_SNDBUF, [45158], 4) = 0
setsockopt(7, SOL_SOCKET, SO_RCVBUF, [45158], 4) = 0
select(8, [7], NULL, NULL, {0, 0})      = 0 (Timeout)
select(8, [5 7], NULL, NULL, {0, 11000}) = 1 (in [7], left {0, 10000})
accept(5, 0x7ffff448, [16])             = -1 EAGAIN (Resource temporarily
unavailable)
select(8, [7], NULL, NULL, {0, 0})      = 1 (in [7], left {0, 0})
read(7, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 744)
= 744
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++


-Tim




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]