Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Apr 2002 13:42:45 +0200
From:      Axel Scheepers <axel@axel.truedestiny.net>
To:        uwi mAn <uwiman3k@hotmail.com>
Cc:        questions@freebsd.org
Subject:   Re: mpg123
Message-ID:  <20020429134245.D61218@mars.thuis>
In-Reply-To: <F139TYSl1q4gtopWd7K00003bc2@hotmail.com>; from uwiman3k@hotmail.com on Thu, Apr 25, 2002 at 01:59:22PM -0400
References:  <F139TYSl1q4gtopWd7K00003bc2@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 25, 2002 at 01:59:22PM -0400, uwi mAn wrote:
> attempting to use mpg123 with cache:
> mpg123 -b 1024 mp3
> results the following
> 
> Yuck! Error in buffer handling....Undefined error:0
> 
> What can be done to solve the problem?

Hi,
Rather difficult to say, I looked into the source and it seems to go wrong on filling the buffer in time. 
buffer.c:
...
                        if(!done) {

                                cmd = xfermem_block(XF_READER, xf);

                                switch(cmd) {

                                        /* More input pending. */
                                        case XF_CMD_WAKEUP_INFO:
                                                continue;
                                        /* Yes, we know buffer is low but
                                         * know we don't care.
                                         */
                                        case XF_CMD_WAKEUP:
                                                break;  /* Proceed playing. */
                                        case XF_CMD_TERMINATE:
                                                /* Proceed playing without
                                                 * blocking any further.
                                                 */
                                                done=TRUE;
                                                break;
                                        case -1:
                                                if(errno==EINTR)
                                                        continue;
                                                perror("Yuck! Error in buffer handling...");
                                                done = TRUE;
                                                xf->readindex = xf->freeindex;
                                                xfermem_putcmd(xf->fd[XF_READER], XF_CMD_TERMINATE);
                                                break;
...

The xfermem_block( XF_READER(1), xf) call goes wrong, so lets see what's in it:

int xfermem_block (int readwrite, txfermem *xf)
{
        int myfd = xf->fd[readwrite];
        int result;

        xf->wakeme[readwrite] = TRUE;
        if (xf->wakeme[1 - readwrite])
                xfermem_putcmd (myfd, XF_CMD_WAKEUP);
        result = xfermem_getcmd(myfd, TRUE);
        xf->wakeme[readwrite] = FALSE;
        return ((result <= 0) ? -1 : result);
}

That shows us that the call to xfermem_getcmd returns a negative value, indicating something went wrong. 
When you browse xfermem.c and xfermem.h you'll see it is trying to read and write to a file by issueing those
calls, so it seems to me there's something wrong reading from the file. Does the problem occur on other mp3's as well?

It might also help to compile it with the -g option, so that debug information is generated, then you can execute
it using gdb:
freebsd# gdb mpg123
gdb> run -s 1024 test.mp3
Program exited with error code -1
gdb> bt

The output of the bt command shows us where exactly things start to go wrong, and might give some more clues about
what is going on at the time. You can also set a breakpoint at the xfermem_block function, so you can step through the
code and print the symbols values:
freebsd# gdb mpg123
gdb> b xfermem_block
Breakpoint set at 0x00231234 something
gdb> run -s 1024 test.mp3
Breakpoint #1: xfermem_block
gdb> print xf->fd[1]
gdb> n
int myfd = xf->fd[readwrite];
gdb>
etc.
...

gdb>
> 
> 
> Thanks.
> 
> 
> 
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos: 
> http://photos.msn.com/support/worldwide.aspx
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

Hope it's helpfull,
Gr,
-- 
Axel Scheepers
UNIX System Administrator

email: axel@axel.truedestiny.net
       a.scheepers@iae.nl
http://axel.truedestiny.net/~axel
------------------------------------------
Indifference will be the downfall of mankind, but who cares?
------------------------------------------

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020429134245.D61218>