tcp客户端支持指定网卡

This commit is contained in:
xiongziliang 2018-05-21 23:18:17 +08:00
parent 3b73e77710
commit 18bf6ec201
5 changed files with 10 additions and 5 deletions

@ -1 +1 @@
Subproject commit f5c26c234dfee07b9c3406fb359a3052ce19cf1f
Subproject commit 61a84362acbd196355dcf0053d2e8f7f4d12e3dd

View File

@ -37,6 +37,7 @@ using namespace ZL::Rtsp;
namespace ZL {
namespace Player {
const char PlayerBase::kNetAdapter[] = "net_adapter";
PlayerBase::Ptr PlayerBase::createPlayer(const char* strUrl) {
string prefix = FindField(strUrl, NULL, "://");

View File

@ -51,7 +51,8 @@ public:
RTP_MULTICAST = 2,
} eRtpType;
static Ptr createPlayer(const char* strUrl);
static const char kNetAdapter[];
PlayerBase(){};
virtual ~PlayerBase(){};
virtual void play(const char* strUrl) {};
@ -79,8 +80,6 @@ public:
virtual float getDuration() const { return 0;};
virtual float getProgress() const { return 0;};
virtual void seekTo(float fProgress) {};
protected:
virtual void onShutdown(const SockException &ex) {};
virtual void onPlayResult(const SockException &ex) {};

View File

@ -75,7 +75,6 @@ void RtmpPlayer::teardown() {
shutdown();
}
}
void RtmpPlayer::play(const char* strUrl) {
teardown();
string strHost = FindField(strUrl, "://", "/");
@ -97,6 +96,9 @@ void RtmpPlayer::play(const char* strUrl) {
//服务器域名
strHost = FindField(strHost.c_str(), NULL, ":");
}
if(!(*this)[PlayerBase::kNetAdapter].empty()){
setNetAdapter((*this)[PlayerBase::kNetAdapter]);
}
startConnect(strHost, iPort);
}
void RtmpPlayer::onErr(const SockException &ex){

View File

@ -147,6 +147,9 @@ void RtspPlayer::play(const char* strUrl, const char *strUser, const char *strPw
}
m_strUrl = strUrl;
if(!(*this)[PlayerBase::kNetAdapter].empty()){
setNetAdapter((*this)[PlayerBase::kNetAdapter]);
}
startConnect(ip.data(), port);
}
void RtspPlayer::onConnect(const SockException &err){