Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert being thrown #281

Open
rcvangemert opened this issue May 20, 2023 · 0 comments
Open

Assert being thrown #281

rcvangemert opened this issue May 20, 2023 · 0 comments

Comments

@rcvangemert
Copy link

Regarding assert(packer->pkt.rtp.timestamp != timestamp || !packer->pkt.payload /first packet/);

I think the timestamp is set after assert so it may fail. see packer->pkt.rtp.timestamp = timestamp; // (uint32_t)time * packer->frequency / 1000; // ms -> 8KHZ

The payload also failed but have not located the reason.

int rtp_pack_input(void* p, const void* data, int bytes, uint32_t timestamp)
{
	int r, n;
	uint8_t *rtp;
	const uint8_t *ptr;
	struct rtp_packer_t *packer;

	r = 0;
	packer = (struct rtp_packer_t *)p;

	assert(packer->pkt.rtp.timestamp != timestamp || !packer->pkt.payload /*first packet*/);

	packer->pkt.rtp.timestamp = timestamp; // (uint32_t)time * packer->frequency / 1000; // ms -> 8KHZ
	packer->pkt.rtp.m = 0; // marker bit alway 0

	for(ptr = (const uint8_t *)data; 0 == r && bytes > 0; ++packer->pkt.rtp.seq)
	{
		packer->pkt.payload = ptr;
		packer->pkt.payloadlen = (bytes + RTP_FIXED_HEADER) <= packer->size ? bytes : (packer->size - RTP_FIXED_HEADER);
		ptr += packer->pkt.payloadlen;
		bytes -= packer->pkt.payloadlen;

		n = RTP_FIXED_HEADER + packer->pkt.payloadlen;
		rtp = (uint8_t*)packer->handler.alloc(packer->cbparam, n);
		if (!rtp) return -ENOMEM;

		n = rtp_packet_serialize(&packer->pkt, rtp, n);
		if (n != RTP_FIXED_HEADER + packer->pkt.payloadlen)
		{
			assert(0);
			return -1;
		}

		r = packer->handler.packet(packer->cbparam, rtp, n, packer->pkt.rtp.timestamp, 0);
		packer->handler.free(packer->cbparam, rtp);

		//packer->pkt.rtp.timestamp += packer->pkt.payloadlen * packer->frequency / 1000;
	}

	return r;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant