Esempio n. 1
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;
}
Esempio n. 2
0
bool iMX27RtpInterface::GetBinaryProperty(int prop_id, int index, Sid::Binary & value) {
	RTP_FUNCLOG;

	bool ret = false;
	switch (prop_id) {
	case GET_H264_SENDER_PARAMETERS:
	{
		value.reserve(sizeof(H264SenderParameters));
		H264SenderParameters *param = (H264SenderParameters *)value.data();
		if (index == 0) {
			memset(param, 0, sizeof(H264SenderParameters));
			param->profile_idc = 66;
			param->profile_iop = (H264ProfileIop)(PROFILE_IOP_CONSTRAINTS_SET0 |
					PROFILE_IOP_CONSTRAINTS_SET1 |
					PROFILE_IOP_CONSTRAINTS_SET2);
			param->level_idc = 30;

			ret = true;
		}
		break;
	}
	case GET_H264_RECEIVER_PARAMETERS:
	{
		value.reserve(sizeof(H264ReceiverParameters));
		H264ReceiverParameters *param = (H264ReceiverParameters *)value.data();
		if (index == 0) {
			memset(param, 0, sizeof(H264ReceiverParameters));
			param->profile_idc = 66;
			param->profile_iop = (H264ProfileIop)(PROFILE_IOP_CONSTRAINTS_SET0 |
					PROFILE_IOP_CONSTRAINTS_SET1 |
					PROFILE_IOP_CONSTRAINTS_SET2);
			param->level_idc = 30;
			param->max_br = Configuration::GetCfg()->GetIntVal("LimitReceiveBitrate");
			ret = true;
		}
		break;
	}
	default:
		break;
	}
	return ret;
}
Esempio n. 3
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;
}
Esempio n. 4
0
SkypeFunctions::user_info SkypeFunctions::getUserInfo(SEString userName){

    user_info ui;

    MyContact::Ref contact;
    if (!skype->GetContact(userName, contact)) throw SkypeException("Can't obtain contact.\n");

    Sid::Binary avatar;
    Sid::String name, city, country;

    contact->GetPropAvatarImage(avatar);
    contact->GetPropFullname(name);
    contact->GetPropCity(city);
    contact->GetPropCountry(country);

    int size = avatar.size();
    unsigned char puntero[size];
    wxImage theBitmap;

    if (size>0)
    {
        for (int i=0; i<size; i++)
            puntero[i] = (char)avatar[i];

        wxMemoryInputStream pngStream(puntero, size);
        theBitmap.LoadFile(pngStream, wxBITMAP_TYPE_JPEG);
    }
    else
        theBitmap.LoadFile(wxString(_("./img/avatar_prueba.jpg")));

    ui.avatar = theBitmap;
    ui.name = name;
    ui.location = city+", "+country;

    return ui;
}
Esempio n. 5
0
bool iMX27RtpInterface::SetBinaryProperty(int prop_id, int index, const Sid::Binary & value) {
	RTP_FUNCLOG;
	bool ret = false;
	switch (prop_id) {
	case SET_H264_SENDER_CONSTRAINTS:
	{
		H264SenderConstraints *snd_constr = (H264SenderConstraints *)((const char *)value);
		if (index != 0)
			break;
		if (value.size() != sizeof(H264SenderConstraints)) {
			printf("value.getSize() != sizeof(H264SenderConstraints)\n");
			break;
		}

		DBG("snd_constr->profile_idc: %d", snd_constr->profile_idc);
		DBG("snd_constr->profile_iop: %d", snd_constr->profile_iop);
		DBG("snd_constr->level_idc: %d", snd_constr->level_idc);
		DBG("snd_constr->max_mbps: %d", snd_constr->max_mbps);
		DBG("snd_constr->max_fs: %d", snd_constr->max_fs);
		DBG("snd_constr->max_cpb: %d", snd_constr->max_cpb);
		DBG("snd_constr->max_dpb: %d", snd_constr->max_dpb);
		DBG("snd_constr->max_br: %d", snd_constr->max_br);
		DBG("snd_constr->max_smbps: %d", snd_constr->max_smbps);
		DBG("snd_constr->redundant_pic_cap: %d", snd_constr->redundant_pic_cap);
		ret = true;
	}
	default:
		break;
	}

	if (!ret) {
		switch (prop_id) {
		case SET_H264_SENDER_CONSTRAINTS:
			printf("H264SenderConstraints struct broken!");
			break;
		default:
			printf("unknown property set");
			break;
		}
	}
	return ret;
}