b/f: disable streams with port == 0.

sayer/1.4-spce2.6
Raphael Coeffic 16 years ago
parent 291c9c5a3c
commit e3950674eb

@ -287,25 +287,32 @@ void AmB2BSession::updateRelayStreams(const string& content_type, const string&
unsigned int media_index = 0;
for (std::vector<SdpMedia>::iterator it =
parser_sdp.media.begin(); it != parser_sdp.media.end(); it++) {
if (media_index >= relay_rtp_streams_cnt) {
WARN("trying to relay SDP with more media lines than "
"relay streams initialized (%u)\n", relay_rtp_streams_cnt);
break;
}
string r_addr = it->conn.address;
if (r_addr.empty())
r_addr = parser_sdp.conn.address;
// TODO:
// - disable streams with port == 0
DBG("initializing RTP relay stream %u with remote <%s:%u>\n",
media_index, r_addr.c_str(), it->port);
relay_rtp_streams[media_index]->setRAddr(r_addr, it->port);
if (sdp.remote_active || rtp_relay_force_symmetric_rtp) {
relay_rtp_streams[media_index]->setPassiveMode(true);
if(it->port) {
DBG("initializing RTP relay stream %u with remote <%s:%u>\n",
media_index, r_addr.c_str(), it->port);
relay_rtp_streams[media_index]->setRAddr(r_addr, it->port);
if (sdp.remote_active || rtp_relay_force_symmetric_rtp) {
relay_rtp_streams[media_index]->setPassiveMode(true);
}
relay_rtp_streams[media_index]->resume();
}
else {
relay_rtp_streams[media_index]->pause();
DBG("disabled RTP relay stream %u\n",media_index);
}
media_index ++;
}
if (rtp_relay_force_symmetric_rtp) {
@ -340,21 +347,24 @@ bool AmB2BSession::replaceConnectionAddress(const string& content_type,
unsigned int media_index = 0;
for (std::vector<SdpMedia>::iterator it =
parser_sdp.media.begin(); it != parser_sdp.media.end(); it++) {
if (media_index >= relay_rtp_streams_cnt) {
WARN("trying to relay SDP with more media lines than "
"relay streams initialized (%u)\n", relay_rtp_streams_cnt);
break;
}
if (!it->conn.address.empty())
it->conn.address = advertisedIP();
try {
it->port = relay_rtp_streams[media_index]->getLocalPort();
replaced_ports += (!media_index) ? int2str(it->port) : "/"+int2str(it->port);
} catch (const string& s) {
ERROR("setting port: '%s'\n", s.c_str());
throw string("error setting RTP port\n");
}
if(it->port) { // if stream active
if (!it->conn.address.empty())
it->conn.address = advertisedIP();
try {
it->port = relay_rtp_streams[media_index]->getLocalPort();
replaced_ports += (!media_index) ? int2str(it->port) : "/"+int2str(it->port);
} catch (const string& s) {
ERROR("setting port: '%s'\n", s.c_str());
throw string("error setting RTP port\n");
}
}
media_index++;
}
@ -753,7 +763,6 @@ void AmB2BSession::setupRelayStreams(AmB2BSession* other_session) {
for (unsigned int i=0; i<relay_rtp_streams_cnt; i++) {
other_session->relay_rtp_streams[i]->setRelayStream(relay_rtp_streams[i]);
other_stream_fds[i] = other_session->relay_rtp_streams[i]->getLocalSocket();
// set local IP (todo: option for other interface!)
relay_rtp_streams[i]->setLocalIP(advertisedIP());
relay_rtp_streams[i]->enableRtpRelay();
}

@ -426,7 +426,6 @@ AmRtpStream::AmRtpStream(AmSession* _s, int _if)
memset(&r_saddr,0,sizeof(struct sockaddr_in));
memset(&l_saddr,0,sizeof(struct sockaddr_in));
#endif
//sched = AmRtpScheduler::instance();
#ifndef SUPPORT_IPV6
/* By default we listen on all interfaces */
@ -562,12 +561,14 @@ void AmRtpStream::init(const vector<SdpPayload*>& sdp_payloads)
void AmRtpStream::pause()
{
receiving = false;
}
void AmRtpStream::resume()
{
gettimeofday(&last_recv_time,NULL);
mem.clear();
receiving = true;
}
void AmRtpStream::setOnHold(bool on_hold) {
@ -697,8 +698,8 @@ int AmRtpStream::nextPacket(AmRtpPacket*& p)
AmConfig::DeadRtpTime &&
(diff.tv_sec > 0) &&
((unsigned int)diff.tv_sec > AmConfig::DeadRtpTime)){
WARN("RTP Timeout detected. Last received packet is too old.\n");
DBG("diff.tv_sec = %i\n",(unsigned int)diff.tv_sec);
WARN("RTP Timeout detected. Last received packet is too old "
"(diff.tv_sec = %i\n",(unsigned int)diff.tv_sec);
receive_mut.unlock();
return RTP_TIMEOUT;
}

Loading…
Cancel
Save