示例#1
0
void CBufferOutputAudioEngine::RequestCompenPacket(UInt32 iSequenceId,bool bA)
{
		for (int i=0;i<BUFFER_COMPENSATION_NUMBER;i++){
			Packet* pPacket = RelayCompenPacket::makePacket(-1,m_iRoomId,m_iFromUin,iSequenceId,bA);
			pPacket->AddReference();
			UdpChannel::RequestCompenPacket(m_iRoomId,m_iFromUin,pPacket);
		}
}
示例#2
0
void CBufferOutputVideoEngine::RequestCompenPacket(UInt32 iSequenceId,bool bA)
{
		//BufferTrace("CBufferOutputVideoEngine::RequestCompenPacket() begin %d\n",GetTickCount());
		Packet* pPacket = RelayCompenPacket::makePacket(-1,m_iRoomId,m_iFromUin,iSequenceId,bA);
		for (int i=0;i<BUFFER_COMPENSATION_NUMBER;i++)
		{
			pPacket->AddReference();
			UdpChannel::RequestCompenPacket(m_iRoomId,m_iFromUin,pPacket);
		}
}
示例#3
0
void CBufferOutputAudioEngine::PlayPackets()
{
		//BufferTrace("CBufferOutputAudioEngine m_mapOutputAudioBuf.size()=%d,m_iMinSequenceId=%d,m_iMaxSequenceId=%d\n", 
		//	m_mapOutputAudioBuf.size(),m_iMinSequenceId,m_iMaxSequenceId);
		Packet* pPacket = NULL;
		MutexLocker locker(&m_mutex);//播放线程 网络线程 m_mapOutputAudioBuf
		if(m_iMinSequenceId<=m_iMaxSequenceId && m_iMaxSequenceId!=0){
			pPacket = GetPlayPacket(m_iMinSequenceId++);//播放数据包,即使丢包也算一次
		}
		if (!pPacket)
		{
			UInt8 cTemp; //数据包不存在 发送空包。。。。。cygnus
			for (int i=0;i<PER_FRAME_OF_SAMEPLE;i++)
			{
				pPacket = AudioPacket::makePacket(-1,AUDIO_RTP_PACKET_TYPE,0, &cTemp);
				pPacket->AddReference();
				Assert(pPacket->GetReference());
				try{
					BAD_MEM_WRITE_EX(pPacket->getPacketContent(),pPacket->getPacketLen(),"CBufferOutputAudioEngine::PlayPackets() pPacket mem") ;
					UdpChannel::PlayAudioPacket(m_iRoomId,m_iFromUin,pPacket,m_iMinSequenceId);
				}catch (...){
					ErrTrace("CBufferOutputAudioEngine::PlayPackets() UdpChannel::PlayAudioPacket Error!");
				}
				pPacket->RemoveReference();
				ErrTrace("数据包不存在 发送空包.....m_iMinSequenceId=%d\n",m_iMinSequenceId);
			}
			return;
		}
		Assert(pPacket->GetReference());
		try{
			BAD_MEM_WRITE_EX(pPacket->getPacketContent(),pPacket->getPacketLen(),"CBufferOutputAudioEngine::PlayPackets() pPacket mem") ;
			UdpChannel::PlayAudioPacket(m_iRoomId,m_iFromUin,pPacket,m_iMinSequenceId);
		}catch (...){
			ErrTrace("CBufferOutputAudioEngine::PlayPackets() UdpChannel::PlayAudioPacket Error!");
		}
		pPacket->RemoveReference();
}