Minor RTP video fixes, be more careful about closing fd's in meetme (bug #1743)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3111 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Mark Spencer 22 years ago
parent 5ef2ef8a1d
commit 0f5ed60d51

@ -466,6 +466,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
int ret = -1; int ret = -1;
int x; int x;
int menu_active = 0; int menu_active = 0;
int using_pseudo = 0;
struct ast_app *app; struct ast_app *app;
char *agifile; char *agifile;
@ -561,6 +562,7 @@ zapretry:
ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno)); ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
goto outrun; goto outrun;
} }
using_pseudo = 1;
/* Make non-blocking */ /* Make non-blocking */
flags = fcntl(fd, F_GETFL); flags = fcntl(fd, F_GETFL);
if (flags < 0) { if (flags < 0) {
@ -885,7 +887,7 @@ zapretry:
} }
} }
} }
if (fd != chan->fds[0]) if (using_pseudo)
close(fd); close(fd);
else { else {
/* Take out of conference */ /* Take out of conference */

@ -544,6 +544,8 @@ struct ast_frame *ast_rtp_read(struct ast_rtp *rtp)
rtp->lastividtimestamp = timestamp; rtp->lastividtimestamp = timestamp;
rtp->f.samples = timestamp - rtp->lastividtimestamp; rtp->f.samples = timestamp - rtp->lastividtimestamp;
rtp->lastividtimestamp = timestamp; rtp->lastividtimestamp = timestamp;
rtp->f.delivery.tv_sec = 0;
rtp->f.delivery.tv_usec = 0;
if (mark) if (mark)
rtp->f.subclass |= 0x1; rtp->f.subclass |= 0x1;
@ -1043,14 +1045,16 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec
/* Re-calculate last TS */ /* Re-calculate last TS */
rtp->lastts = rtp->lastts + ms * 90; rtp->lastts = rtp->lastts + ms * 90;
/* If it's close to our prediction, go for it */ /* If it's close to our prediction, go for it */
if (!f->delivery.tv_sec && !f->delivery.tv_usec) {
if (abs(rtp->lastts - pred) < 7200) { if (abs(rtp->lastts - pred) < 7200) {
rtp->lastts = pred; rtp->lastts = pred;
rtp->lastovidtimestamp += f->samples; rtp->lastovidtimestamp += f->samples;
} else { } else {
ast_log(LOG_DEBUG, "Difference is %d, ms is %d\n", abs(rtp->lastts - pred), ms); ast_log(LOG_DEBUG, "Difference is %d, ms is %d (%d), pred/ts/samples %d/%d/%d\n", abs(rtp->lastts - pred), ms, ms * 90, rtp->lastts, pred, f->samples);
rtp->lastovidtimestamp = rtp->lastts; rtp->lastovidtimestamp = rtp->lastts;
} }
} }
}
/* Get a pointer to the header */ /* Get a pointer to the header */
rtpheader = (unsigned int *)(f->data - hdrlen); rtpheader = (unsigned int *)(f->data - hdrlen);
rtpheader[0] = htonl((2 << 30) | (codec << 16) | (rtp->seqno++) | (mark << 23)); rtpheader[0] = htonl((2 << 30) | (codec << 16) | (rtp->seqno++) | (mark << 23));

Loading…
Cancel
Save