⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtpsession.cpp

📁 最新的jrtplib
💻 CPP
📖 第 1 页 / 共 3 页
字号:
		uint32_t ssrc;	BUILDER_LOCK	ssrc = packetbuilder.GetSSRC();	BUILDER_UNLOCK	return ssrc;}int RTPSession::AddDestination(const RTPAddress &addr){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	return rtptrans->AddDestination(addr);}int RTPSession::DeleteDestination(const RTPAddress &addr){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	return rtptrans->DeleteDestination(addr);}void RTPSession::ClearDestinations(){	if (!created)		return;	rtptrans->ClearDestinations();}bool RTPSession::SupportsMulticasting(){	if (!created)		return false;	return rtptrans->SupportsMulticasting();}int RTPSession::JoinMulticastGroup(const RTPAddress &addr){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	return rtptrans->JoinMulticastGroup(addr);}int RTPSession::LeaveMulticastGroup(const RTPAddress &addr){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	return rtptrans->LeaveMulticastGroup(addr);}void RTPSession::LeaveAllMulticastGroups(){	if (!created)		return;	rtptrans->LeaveAllMulticastGroups();}int RTPSession::SendPacket(const void *data,size_t len){	int status;		if (!created)		return ERR_RTP_SESSION_NOTCREATED;	BUILDER_LOCK	if ((status = packetbuilder.BuildPacket(data,len)) < 0)	{		BUILDER_UNLOCK		return status;	}	if ((status = rtptrans->SendRTPData(packetbuilder.GetPacket(),packetbuilder.GetPacketLength())) < 0)	{		BUILDER_UNLOCK		return status;	}	BUILDER_UNLOCK	SOURCES_LOCK	sources.SentRTPPacket();	SOURCES_UNLOCK	PACKSENT_LOCK	sentpackets = true;	PACKSENT_UNLOCK	return 0;}int RTPSession::SendPacket(const void *data,size_t len,                uint8_t pt,bool mark,uint32_t timestampinc){	int status;	if (!created)		return ERR_RTP_SESSION_NOTCREATED;		BUILDER_LOCK	if ((status = packetbuilder.BuildPacket(data,len,pt,mark,timestampinc)) < 0)	{		BUILDER_UNLOCK		return status;	}	if ((status = rtptrans->SendRTPData(packetbuilder.GetPacket(),packetbuilder.GetPacketLength())) < 0)	{		BUILDER_UNLOCK		return status;	}	BUILDER_UNLOCK		SOURCES_LOCK	sources.SentRTPPacket();	SOURCES_UNLOCK	PACKSENT_LOCK	sentpackets = true;	PACKSENT_UNLOCK	return 0;}int RTPSession::SendPacketEx(const void *data,size_t len,                  uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords){	int status;		if (!created)		return ERR_RTP_SESSION_NOTCREATED;	BUILDER_LOCK	if ((status = packetbuilder.BuildPacketEx(data,len,hdrextID,hdrextdata,numhdrextwords)) < 0)	{		BUILDER_UNLOCK		return status;	}	if ((status = rtptrans->SendRTPData(packetbuilder.GetPacket(),packetbuilder.GetPacketLength())) < 0)	{		BUILDER_UNLOCK		return status;	}	BUILDER_UNLOCK	SOURCES_LOCK	sources.SentRTPPacket();	SOURCES_UNLOCK	PACKSENT_LOCK	sentpackets = true;	PACKSENT_UNLOCK	return 0;}int RTPSession::SendPacketEx(const void *data,size_t len,                  uint8_t pt,bool mark,uint32_t timestampinc,                  uint16_t hdrextID,const void *hdrextdata,size_t numhdrextwords){	int status;		if (!created)		return ERR_RTP_SESSION_NOTCREATED;		BUILDER_LOCK	if ((status = packetbuilder.BuildPacketEx(data,len,pt,mark,timestampinc,hdrextID,hdrextdata,numhdrextwords)) < 0)	{		BUILDER_UNLOCK		return status;	}	if ((status = rtptrans->SendRTPData(packetbuilder.GetPacket(),packetbuilder.GetPacketLength())) < 0)	{		BUILDER_UNLOCK		return status;	}	BUILDER_UNLOCK	SOURCES_LOCK	sources.SentRTPPacket();	SOURCES_UNLOCK	PACKSENT_LOCK	sentpackets = true;	PACKSENT_UNLOCK	return 0;}#ifdef RTP_SUPPORT_SENDAPPint RTPSession::SendRTCPAPPPacket(uint8_t subtype, const uint8_t name[4], const void *appdata, size_t appdatalen){	int status;	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	BUILDER_LOCK	uint32_t ssrc = packetbuilder.GetSSRC();	BUILDER_UNLOCK		RTCPCompoundPacketBuilder pb(GetMemoryManager());	status = pb.InitBuild(maxpacksize);		if(status < 0)		return status;	//first packet in an rtcp compound packet should always be SR or RR	if((status = pb.StartReceiverReport(ssrc)) < 0)		return status;	//add SDES packet with CNAME item	if ((status = pb.AddSDESSource(ssrc)) < 0)		return status;		BUILDER_LOCK	size_t owncnamelen = 0;	uint8_t *owncname = rtcpbuilder.GetLocalCNAME(&owncnamelen);	if ((status = pb.AddSDESNormalItem(RTCPSDESPacket::CNAME,owncname,owncnamelen)) < 0)	{		BUILDER_UNLOCK		return status;	}	BUILDER_UNLOCK		//add our application specific packet	if((status = pb.AddAPPPacket(subtype, ssrc, name, appdata, appdatalen)) < 0)		return status;	if((status = pb.EndBuild()) < 0)		return status;	//send packet	status = rtptrans->SendRTCPData(pb.GetCompoundPacketData(),pb.GetCompoundPacketLength());	if(status < 0)		return status;	PACKSENT_LOCK	sentpackets = true;	PACKSENT_UNLOCK	return pb.GetCompoundPacketLength();}#endif // RTP_SUPPORT_SENDAPPint RTPSession::SetDefaultPayloadType(uint8_t pt){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;		int status;		BUILDER_LOCK	status = packetbuilder.SetDefaultPayloadType(pt);	BUILDER_UNLOCK	return status;}int RTPSession::SetDefaultMark(bool m){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	int status;	BUILDER_LOCK	status = packetbuilder.SetDefaultMark(m);	BUILDER_UNLOCK	return status;}int RTPSession::SetDefaultTimestampIncrement(uint32_t timestampinc){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	int status;	BUILDER_LOCK	status = packetbuilder.SetDefaultTimestampIncrement(timestampinc);	BUILDER_UNLOCK	return status;}int RTPSession::IncrementTimestamp(uint32_t inc){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	int status;	BUILDER_LOCK	status = packetbuilder.IncrementTimestamp(inc);	BUILDER_UNLOCK	return status;}int RTPSession::IncrementTimestampDefault(){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	int status;		BUILDER_LOCK	status = packetbuilder.IncrementTimestampDefault();	BUILDER_UNLOCK	return status;}int RTPSession::SetPreTransmissionDelay(const RTPTime &delay){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	int status;	BUILDER_LOCK	status = rtcpbuilder.SetPreTransmissionDelay(delay);	BUILDER_UNLOCK	return status;}RTPTransmissionInfo *RTPSession::GetTransmissionInfo(){	if (!created)		return 0;	return rtptrans->GetTransmissionInfo();}void RTPSession::DeleteTransmissionInfo(RTPTransmissionInfo *inf){	RTPDelete(inf,GetMemoryManager());}int RTPSession::Poll(){	int status;		if (!created)		return ERR_RTP_SESSION_NOTCREATED;	if (usingpollthread)		return ERR_RTP_SESSION_USINGPOLLTHREAD;	if ((status = rtptrans->Poll()) < 0)		return status;	return ProcessPolledData();}int RTPSession::WaitForIncomingData(const RTPTime &delay,bool *dataavailable){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	if (usingpollthread)		return ERR_RTP_SESSION_USINGPOLLTHREAD;	return rtptrans->WaitForIncomingData(delay,dataavailable);}int RTPSession::AbortWait(){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	if (usingpollthread)		return ERR_RTP_SESSION_USINGPOLLTHREAD;	return rtptrans->AbortWait();}RTPTime RTPSession::GetRTCPDelay(){	if (!created)		return RTPTime(0,0);	if (usingpollthread)		return RTPTime(0,0);	SOURCES_LOCK	SCHED_LOCK	RTPTime t = rtcpsched.GetTransmissionDelay();	SCHED_UNLOCK	SOURCES_UNLOCK	return t;}int RTPSession::BeginDataAccess(){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	SOURCES_LOCK	return 0;}bool RTPSession::GotoFirstSource(){	if (!created)		return false;	return sources.GotoFirstSource();}bool RTPSession::GotoNextSource(){	if (!created)		return false;	return sources.GotoNextSource();}bool RTPSession::GotoPreviousSource(){	if (!created)		return false;	return sources.GotoPreviousSource();}bool RTPSession::GotoFirstSourceWithData(){	if (!created)		return false;	return sources.GotoFirstSourceWithData();}bool RTPSession::GotoNextSourceWithData(){	if (!created)		return false;	return sources.GotoNextSourceWithData();}bool RTPSession::GotoPreviousSourceWithData(){	if (!created)		return false;	return sources.GotoPreviousSourceWithData();}RTPSourceData *RTPSession::GetCurrentSourceInfo(){	if (!created)		return 0;	return sources.GetCurrentSourceInfo();}RTPSourceData *RTPSession::GetSourceInfo(uint32_t ssrc){	if (!created)		return 0;	return sources.GetSourceInfo(ssrc);}RTPPacket *RTPSession::GetNextPacket(){	if (!created)		return 0;	return sources.GetNextPacket();}void RTPSession::DeletePacket(RTPPacket *p){	RTPDelete(p,GetMemoryManager());}int RTPSession::EndDataAccess(){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	SOURCES_UNLOCK	return 0;}int RTPSession::SetReceiveMode(RTPTransmitter::ReceiveMode m){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	return rtptrans->SetReceiveMode(m);}int RTPSession::AddToIgnoreList(const RTPAddress &addr){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	return rtptrans->AddToIgnoreList(addr);}int RTPSession::DeleteFromIgnoreList(const RTPAddress &addr){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	return rtptrans->DeleteFromIgnoreList(addr);}void RTPSession::ClearIgnoreList(){	if (!created)		return;	rtptrans->ClearIgnoreList();}int RTPSession::AddToAcceptList(const RTPAddress &addr){	if (!created)		return ERR_RTP_SESSION_NOTCREATED;	return rtptrans->AddToAcceptList(addr);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -