1
0
mirror of https://github.com/DigitalDevices/octonet.git synced 2023-10-10 13:36:52 +02:00

fix member timeout and handling of non-owner multicast playback

This commit is contained in:
Ralph Metzler 2016-02-02 20:17:47 +01:00
parent 6a446c0cf8
commit 289bde031c

View File

@ -501,8 +501,8 @@ void session_timeout(struct ossess *sess)
void session_mc_timeout(struct ossess *sess) void session_mc_timeout(struct ossess *sess)
{ {
mtime(&sess->mc_timeout); mtime(&sess->mc_timeout);
sess->timeout += 260; sess->mc_timeout += 260;
dbgprintf(DEBUG_IGMP, "new mc timeout %d\n", sess->timeout); dbgprintf(DEBUG_IGMP, "new mc timeout %d\n", sess->mc_timeout);
} }
void check_session_timeouts(struct octoserve *os) void check_session_timeouts(struct octoserve *os)
@ -1448,6 +1448,8 @@ static int setup_session(struct oscon *con, int newtrans)
} }
} else { } else {
if (pidchange && conform) { if (pidchange && conform) {
/* non-owner tried to change pids,
copy back owner pids and return error */
copy_params(sess, ownsess); copy_params(sess, ownsess);
return -455; return -455;
} }
@ -1456,7 +1458,6 @@ static int setup_session(struct oscon *con, int newtrans)
if (conform && !owner && sess->trans.mcast) { if (conform && !owner && sess->trans.mcast) {
if (!ownsess->trans.mcast) if (!ownsess->trans.mcast)
return -455; return -455;
sess->nsfd = ownsess->nsfd;
} else } else
#ifndef IGNORE_NS #ifndef IGNORE_NS
if (get_ns(sess) < 0) if (get_ns(sess) < 0)
@ -1465,9 +1466,7 @@ static int setup_session(struct oscon *con, int newtrans)
newtrans = 1; newtrans = 1;
} }
if (newtrans) { if (newtrans) {
if (str->session != sess && if (!owner && sess->trans.mcast && conform) {
sess->trans.mcast &&
conform) {
memcpy(&sess->trans, &str->session->trans, sizeof(struct ostrans)); memcpy(&sess->trans, &str->session->trans, sizeof(struct ostrans));
dbgprintf(DEBUG_RTSP, "non-owner tried to change transport parameters\n"); dbgprintf(DEBUG_RTSP, "non-owner tried to change transport parameters\n");
} }
@ -1525,8 +1524,10 @@ static int stop_session(struct ossess *sess)
static int start_session(struct ossess *sess) static int start_session(struct ossess *sess)
{ {
if (sess->playing) if (sess->playing) {
sess->playing |= 1;
return 0; return 0;
}
dbgprintf(DEBUG_SYS, "start session %d\n", sess->nr); dbgprintf(DEBUG_SYS, "start session %d\n", sess->nr);
if (sess->stream->ca) { if (sess->stream->ca) {
uint8_t canum = sess->stream->ca->nr - 1; uint8_t canum = sess->stream->ca->nr - 1;
@ -1546,12 +1547,16 @@ static int play_session(struct oscon *con)
struct dvb_params *p = &con->p; struct dvb_params *p = &con->p;
struct ostrans *trans = &con->trans; struct ostrans *trans = &con->trans;
struct octoserve *os = sess->os; struct octoserve *os = sess->os;
struct osstrm *str = sess->stream;
if (p) { if (p) {
res = setup_session(con, 0); res = setup_session(con, 0);
if (res < 0) if (res < 0)
return res; return res;
} }
if (sess->trans.mcast && conform)
sess = str->session;
#ifndef IGNORE_NS #ifndef IGNORE_NS
if (sess->nsfd < 0) if (sess->nsfd < 0)
return -455; return -455;
@ -1603,6 +1608,7 @@ void mc_check(struct ossess *sess, int update)
if (os->has_switch) if (os->has_switch)
update_switch_vec(sess); update_switch_vec(sess);
if (!sess->mccs.lh_first) if (!sess->mccs.lh_first)
//if (mtime() > sess->mc_timeout)
stop_session(sess); stop_session(sess);
} }
pthread_mutex_unlock(&os->lock); pthread_mutex_unlock(&os->lock);