X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=ortp_recv.c;h=d9b260980e89f0a0c06d9de72cb390de0075aeef;hp=99b53ad07e3106486fe314576c3a06eadd974b70;hb=685a2bc66e77978104039b8173a6039a80d8b733;hpb=39ef1da5509461b18beb5b8f16ff6118c20c0ac6 diff --git a/ortp_recv.c b/ortp_recv.c index 99b53ad0..d9b26098 100644 --- a/ortp_recv.c +++ b/ortp_recv.c @@ -40,7 +40,6 @@ extern int msg_to_buf(mblk_t *, char *, int); * \sa receiver receiver_node */ struct private_ortp_recv_data { - /** * * @@ -74,7 +73,7 @@ static void ortp_recv_pre_select(struct sched *s, struct task *t) struct private_ortp_recv_data *pord = rn->private_data; struct timeval tmp; - if (tv_diff(&s->now, &pord->next_chunk, &tmp) >= 0) { + if (tv_diff(now, &pord->next_chunk, &tmp) >= 0) { tmp.tv_sec = 0; tmp.tv_usec = 1000; } @@ -97,7 +96,7 @@ static void compute_next_chunk(unsigned chunk_time, pord->next_chunk.tv_usec); } -static void ortp_recv_post_select(struct sched *s, struct task *t) +static void ortp_recv_post_select(__a_unused struct sched *s, struct task *t) { struct receiver_node *rn = t->private_data; struct private_ortp_recv_data *pord = rn->private_data; @@ -106,10 +105,15 @@ static void ortp_recv_post_select(struct sched *s, struct task *t) char tmpbuf[CHUNK_SIZE + 3]; unsigned chunk_time; -// PARA_DEBUG_LOG("rn: %p, pord: %p, session: %p\n", rn, pord, pord->session); +// PARA_INFO_LOG("rn: %p, pord: %p, session: %p\n", rn, pord, pord->session); + t->ret = -E_ORTP_RECV_EOF; + if (rn->output_eof && *rn->output_eof) { + rn->eof = 1; + return; + } t->ret = 1; if (pord->start.tv_sec) - if (tv_diff(&s->now, &pord->next_chunk, NULL) < 0) + if (tv_diff(now, &pord->next_chunk, NULL) < 0) return; mp = rtp_session_recvm_with_ts(pord->session, pord->timestamp); if (!mp) { @@ -121,12 +125,12 @@ static void ortp_recv_post_select(struct sched *s, struct task *t) if ((pord->c_bad > 5000 && pord->start.tv_sec) || pord->c_bad > 10000) return; t->ret = 1; - tv_add(&s->now, &min_delay, &pord->next_chunk); + tv_add(now, &min_delay, &pord->next_chunk); return; } /* okay, we have a chunk of data */ if (!pord->start.tv_sec) - pord->start = s->now; + pord->start = *now; t->ret = msg_to_buf(mp, tmpbuf, CHUNK_SIZE); if (t->ret < ORTP_AUDIO_HEADER_LEN) { rn->eof = 1; @@ -200,13 +204,13 @@ success: freemsg(mp); if (pord->c_bad) { pord->c_bad = 0; - pord->next_chunk = s->now; + pord->next_chunk = *now; } compute_next_chunk(chunk_time, pord); return; err_out: + rn->eof = 1; freemsg(mp); - return; } static void ortp_shutdown(void)