mirror of
https://github.com/DigitalDevices/octonet.git
synced 2023-10-10 13:36:52 +02:00
issue 45 and 46
This commit is contained in:
parent
f6c13c7a6b
commit
9251fed043
@ -59,9 +59,14 @@ static void update_switch_vec(struct ossess *sess)
|
||||
{
|
||||
struct osmcc *mcc;
|
||||
uint32_t vec = 0;
|
||||
struct ossess *ownsess = sess->stream->session;
|
||||
|
||||
if (!sess->os->has_switch)
|
||||
return;
|
||||
for (mcc = sess->mccs.lh_first; mcc; mcc = mcc->mcc.le_next)
|
||||
vec |= mcc->port_vec;
|
||||
if (conform && ownsess->trans.mcast && (ownsess->playing & 2))
|
||||
vec |= 0x1f;
|
||||
if (vec != sess->mcc_port_vec_set || sess->port_vec != sess->port_vec_set) {
|
||||
sess->mcc_port_vec_set = vec;
|
||||
sess->port_vec_set = sess->port_vec;
|
||||
@ -469,6 +474,7 @@ static uint32_t session_is_playing(struct ossess *sess)
|
||||
pthread_mutex_lock(&os->lock);
|
||||
for (i = 0; i < MAX_SESSION; i++)
|
||||
if (os->session[i].state &&
|
||||
os->session[i].trans.mcast &&
|
||||
(os->session[i].stream == str)) {
|
||||
playing |= os->session[i].playing;
|
||||
dbgprintf(DEBUG_DEBUG, "playing[%u] = %u\n",
|
||||
@ -1591,7 +1597,6 @@ static int setup_session(struct oscon *con, int newtrans)
|
||||
set_pmt(str->ca, p->pmt);
|
||||
}
|
||||
if (con->session->trans.mcast) {
|
||||
if (con->os->has_switch)
|
||||
update_switch_vec(sess);
|
||||
}
|
||||
return 0;
|
||||
@ -1602,20 +1607,18 @@ static int stop_session(struct ossess *sess)
|
||||
if (!session_is_playing(sess))
|
||||
return 0;
|
||||
sess->playing &= ~1;
|
||||
if (session_is_playing(sess))
|
||||
return 0;
|
||||
if (!session_is_playing(sess)) {
|
||||
printf("stopping session %d\n", sess->nr);
|
||||
if (sess->nsfd >= 0)
|
||||
ioctl(sess->nsfd, NS_STOP);
|
||||
}
|
||||
update_switch_vec(sess);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int start_session(struct ossess *sess)
|
||||
{
|
||||
if (session_is_playing(sess)) {
|
||||
sess->playing |= 1;
|
||||
return 0;
|
||||
}
|
||||
if (!session_is_playing(sess)) {
|
||||
dbgprintf(DEBUG_SYS, "start session %d\n", sess->nr);
|
||||
if (sess->stream->ca) {
|
||||
uint8_t canum = sess->stream->ca->nr - 1;
|
||||
@ -1624,7 +1627,9 @@ static int start_session(struct ossess *sess)
|
||||
}
|
||||
if (sess->nsfd >= 0)
|
||||
ioctl(sess->nsfd, NS_START);
|
||||
}
|
||||
sess->playing |= 1;
|
||||
update_switch_vec(sess);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1658,8 +1663,10 @@ static int play_session(struct oscon *con)
|
||||
#endif
|
||||
start_session(sess);
|
||||
}
|
||||
dbgprintf(DEBUG_SYS, "%s set playing =2\n", __FUNCTION__);
|
||||
sess->playing |= 2;
|
||||
pthread_mutex_unlock(&os->lock);
|
||||
update_switch_vec(sess);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1672,6 +1679,8 @@ static struct ossess *match_session(struct octoserve *os, uint8_t *group)
|
||||
sess = &os->session[i];
|
||||
if (!sess->state || !sess->trans.mcast)
|
||||
continue;
|
||||
if (conform && sess->stream->session != sess)
|
||||
continue;
|
||||
if (!memcmp(sess->trans.mcip, group, 4))
|
||||
return sess;
|
||||
}
|
||||
@ -1699,7 +1708,6 @@ void mc_check(struct ossess *sess, int update)
|
||||
}
|
||||
}
|
||||
if (update) {
|
||||
if (os->has_switch)
|
||||
update_switch_vec(sess);
|
||||
if (!sess->mccs.lh_first)
|
||||
//if (mtime() > sess->mc_timeout)
|
||||
@ -1719,7 +1727,6 @@ void mc_del(struct ossess *sess)
|
||||
LIST_REMOVE(mcc, mcc);
|
||||
free(mcc);
|
||||
}
|
||||
if (os->has_switch)
|
||||
update_switch_vec(sess);
|
||||
pthread_mutex_unlock(&os->lock);
|
||||
}
|
||||
@ -1779,7 +1786,6 @@ void mc_join(struct octoserve *os, uint8_t *ip, uint8_t *mac, uint8_t *group)
|
||||
newmcc->port_vec = port;
|
||||
sess->mcc_port_vec |= port;
|
||||
}
|
||||
if (os->has_switch)
|
||||
update_switch_vec(sess);
|
||||
}
|
||||
if (!session_is_playing(sess))
|
||||
@ -1823,7 +1829,6 @@ void mc_leave(struct octoserve *os, uint8_t *ip, uint8_t *group)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (os->has_switch)
|
||||
update_switch_vec(sess);
|
||||
out:
|
||||
pthread_mutex_unlock(&os->lock);
|
||||
|
Loading…
Reference in New Issue
Block a user