bug fixed

This commit is contained in:
xiongziliang 2018-07-05 18:56:11 +08:00
parent 0237a337a0
commit d955b639d7
2 changed files with 4 additions and 5 deletions

View File

@ -126,7 +126,7 @@ RtpBroadCaster::RtpBroadCaster(const string &strLocalIp,const string &strVhost,c
} }
m_pReader = src->getRing()->attach(); m_pReader = src->getRing()->attach();
m_pReader->setReadCB([this](const RtpPacket::Ptr &pkt){ m_pReader->setReadCB([this](const RtpPacket::Ptr &pkt){
int i = (pkt->interleaved/2)%2; int i = (int)(pkt->type);
auto &pSock = m_apUdpSock[i]; auto &pSock = m_apUdpSock[i];
auto &peerAddr = m_aPeerUdpAddr[i]; auto &peerAddr = m_aPeerUdpAddr[i];
BufferRtp::Ptr buffer(new BufferRtp(pkt,4)); BufferRtp::Ptr buffer(new BufferRtp(pkt,4));
@ -148,9 +148,8 @@ RtpBroadCaster::RtpBroadCaster(const string &strLocalIp,const string &strVhost,c
<< strVhost << " " << strVhost << " "
<< strApp << " " << strStream; << strApp << " " << strStream;
} }
uint16_t RtpBroadCaster::getPort(int iTrackId){ uint16_t RtpBroadCaster::getPort(int trackType){
int i = iTrackId%2; return m_apUdpSock[trackType]->get_local_port();
return m_apUdpSock[i]->get_local_port();
} }
string RtpBroadCaster::getIP(){ string RtpBroadCaster::getIP(){
return inet_ntoa(m_aPeerUdpAddr[0].sin_addr); return inet_ntoa(m_aPeerUdpAddr[0].sin_addr);

View File

@ -74,7 +74,7 @@ public:
virtual ~RtpBroadCaster(); virtual ~RtpBroadCaster();
static Ptr get(const string &strLocalIp,const string &strVhost,const string &strApp,const string &strStream); static Ptr get(const string &strLocalIp,const string &strVhost,const string &strApp,const string &strStream);
void setDetachCB(void *listener,const onDetach &cb); void setDetachCB(void *listener,const onDetach &cb);
uint16_t getPort(int iTrackId); uint16_t getPort(int trackType);
string getIP(); string getIP();
private: private:
static recursive_mutex g_mtx; static recursive_mutex g_mtx;