创建Socket优先绑定本线程

This commit is contained in:
xiongziliang
2019-05-31 18:01:38 +08:00
parent f2e4eac5ef
commit c0f41167ba
7 changed files with 11 additions and 11 deletions

View File

@@ -252,7 +252,7 @@ void RtspPusher::sendSetup(unsigned int trackIndex) {
}
break;
case Rtsp::RTP_UDP: {
_apUdpSock[trackIndex].reset(new Socket());
_apUdpSock[trackIndex].reset(new Socket(getPoller()));
if (!_apUdpSock[trackIndex]->bindUdpSock(0, get_local_ip().data())) {
_apUdpSock[trackIndex].reset();
throw std::runtime_error("open udp sock err");
@@ -291,7 +291,7 @@ void RtspPusher::handleResSetup(const Parser &parser, unsigned int uiTrackIndex)
uint16_t port = atoi(FindField(port_str.data(), NULL, "-").data());
auto &pUdpSockRef = _apUdpSock[uiTrackIndex];
if(!pUdpSockRef){
pUdpSockRef.reset(new Socket());
pUdpSockRef.reset(new Socket(getPoller()));
}
struct sockaddr_in rtpto;