[asterisk-dev] app_mp3.c, timed_read, short frames

Paul Albrecht palbrecht at glccom.com
Fri Jul 12 09:04:05 CDT 2013


Think I found the reason the mp3 application sends short frames. Here's the relevant code:

static int timed_read(int fd, void *data, int datalen, int timeout)
	int res;
	struct pollfd fds[1]; 
	fds[0].fd = fd;
	fds[0].events = POLLIN; 
	res = ast_poll(fds, 1, timeout); 
	if (res < 1) {
		ast_log(LOG_NOTICE, "Poll timed out/errored out with %d\n", res);
		return -1;
	return read(fd, data, datalen); 

The read sometimes completes without reading datalen when the file descriptor
is a pipe/socket. So my question: bug or a feature?

Paul Albrecht

More information about the asterisk-dev mailing list