[Icecast] Broken pipe of stdinpcm on asterisk-ices.xml

Zen Kato zenkato at pis.bekkoame.ne.jp
Fri Aug 26 22:19:22 UTC 2005


hi,

I installed icecast-2.2.0.tar.gz and ices-2.0.1.tar.gz on Fedora3
linux-2.6.12-1.1372_FC3). It works fine for playlist.ogg from
the other CPU, such as 'xmms http://192.168.0.3:8000/listplay.ogg'.

But when I use 'stdinpcm' like 'asterisk-ices.xml' which send 
voip's voice udp packets to 'asterisk-ices.xml' such as;

.......(snip)......

    <stream>
        <!-- metadata used for stream listing -->
        <metadata>
            <name>Example stream name</name>
            <genre>Example genre</genre>
            <description>A short description of your stream</description>
            <url>http://192.168.0.3</url>
        </metadata>

        <!--    Input module.

            This example uses the 'oss' module. It takes input from the
            OSS audio device (e.g. line-in), and processes it for live
            encoding.  -->
        <input>
            <module>stdinpcm</module>
            <param name="rate">8000</param>
            <param name="channels">1</param>
            <!-- Read metadata (from stdin by default, or -->
            <!-- filename defined below (if the latter, only on SIGUSR1)
            <param name="metadata">1</param>
            <param name="metadatafilename">test</param> -->
        </input>
...(snip)....

It always says" WARING[5929]: app_ices.c:152 ices_exec: Write failed to pipe: Broken pipe" from "app_ices.c" of asterisk. and then hangup, never start 
"asterisk-ices.xml".

The part of "app_ices.c" is as follows:
---------------------------------------------------------
static int ices_exec(struct ast_channel *chan, void *data)
{
	int res=0;
	struct localuser *u;
	int fds[2];
	int ms = -1;
	int pid = -1;
	int flags;
	int oreadformat;
	struct timeval last;
	struct ast_frame *f;
	char filename[256]="";
	char *c;
	last.tv_usec = 0;
	last.tv_sec = 0;
...(snip).....
	res = icesencode(filename, fds[0]);
	close(fds[0]);
	if (res >= 0) {
		pid = res;
		for (;;) {
			/* Wait for audio, and stream */
			ms = ast_waitfor(chan, -1);
			if (ms < 0) {
				ast_log(LOG_DEBUG, "Hangup detected\n");
				res = -1;
				break;
			}
			f = ast_read(chan);
			if (!f) {
				ast_log(LOG_DEBUG, "Null frame == hangup() detected\n");
				res = -1;
				break;
			}
			if (f->frametype == AST_FRAME_VOICE) {
				res = write(fds[1], f->data, f->datalen);
				if (res < 0) {
					if (errno != EAGAIN) {
						ast_log(LOG_WARNING, "Write failed to pipe: %s\n", strerror(errno));
						res = -1;
						break;
					}
				}
			}
			ast_frfree(f);
		}
	}
	close(fds[1]);
	LOCAL_USER_REMOVE(u);
	if (pid > -1)
		kill(pid, SIGKILL);
	if (!res && oreadformat)
		ast_set_read_format(chan, oreadformat);
	return res;
}

int unload_module(void)
{
	STANDARD_HANGUP_LOCALUSERS;
	return ast_unregister_application(app);
}

int load_module(void)
{
	return ast_register_application(app, ices_exec, synopsis, descrip);
}

char *description(void)
{
	return tdesc;
}

int usecount(void)
{
	int res;
	STANDARD_USECOUNT(res);
	return res;
}

char *key()
{
	return ASTERISK_GPL_KEY;
}

-------------------------------

Is this "broken pipe" means that I don't have "stdinpcim" on /dev?

My system has "stdin" but no "stdinpcm".

[zenkato at p4c8 dev]$ ls -al|grep stdin
lrwxrwxrwx   1 root    root         15  8 27  2005 stdin -> /proc/self/fd/0

Sorry I posted this on 'asterisk-users' ml, but there is no response there.
So, I posted this on this ml.

Regards,

Zen Kato







More information about the Icecast mailing list