Ejemplo n.º 1
0
void iMX27RtpInterface::FrameReceived(const Sid::Binary & data, int timestamp_ms) {
	PACKET_DBG("Received frame, len %d, count", data.size(), m_ReceiveFcnt);
	m_ReceiveFcnt++;

	m_ReceiveBStat.Update(data.getSize());
	if (m_ReceiveBStat.IsValid())
		RTP_DBG("Receive bitrate: %s", m_ReceiveBStat.GetStatStr());

	if (Configuration::GetCfg()->GetIntVal("UseLoopback")) {
		if (m_RecordingStarted) {
			VideoData frame;
			frame.SetBuf((const uint8_t*)data.data(), data.size());
			frame.SetTimestamp(timestamp_ms);
			TransportSendFrame(frame);
		}
		return;
	}

	if (m_pReceiveWrapper) {
		VideoData frame;
		frame.SetBuf((uint8_t *)data.data(), data.size());
		frame.SetTimestamp(timestamp_ms);
		m_pReceiveWrapper->SubmitFrame(frame);
	}
	return;
}
Ejemplo n.º 2
0
void iMX27RtpInterface::RtpPacketReceived(const Sid::Binary & data) {
	PACKET_DBG("Received rpt packet, len %d, count", data.size(), m_ReceivePcnt);

	m_ReceivePcnt++;
	m_ReceiveBStat.Update(data.size());
	if (m_ReceiveBStat.IsValid())
		RTP_DBG("Receive bitrate: %s", m_ReceiveBStat.GetStatStr());

	if (Configuration::GetCfg()->GetIntVal("UseLoopback")) {
		// if keyframe was requested then pretend that we send keyframe - otherwise the videolib keeps requesting the keyframes
		if (m_KeyFrameRequested) {
			((NalHeader *)((rtph *)(const char *)data)->GetDataPtr())->SetNri(3);
			if (((rtph *)(const char *)data)->GetMarker())
				m_KeyFrameRequested = 0;
		}
		if (m_RecordingStarted) {
			TransportSendRTPPacket((const char *)data, data.size());
		}

		return;
	}

	if (m_pReceiveWrapper) {
		m_pReceiveWrapper->SubmitPacket((uint8_t *)data.data(), data.getSize());
	}
	return;
}