|
-
September 16th, 2008, 07:53 AM
#1
Building and sending RTP Packet
Hi @ all,
i´m just tryin to build an rtp packet. Thats my Packet
typedef struct
{
u_int16_t profile_data;
u_int16_t length;
}rtp_xtn_hdr_t;
#pragma pack(push, 1)
typedef struct
{
u_int16_t v:2; /* protocol version */
u_int16_t p:1; /* padding flag */
u_int16_t x:1; /* header extension flag */
u_int16_t cc:4; /* CSRC count */
u_int16_t m:1; /* marker bit */
u_int16_t pt:7; /* payload type */
u_int16_t seq:16; /* sequence number */
u_int32_t ts; /* timestamp */
u_int32_t ssrc; /* synchronization source */
// u_int32_t *csrc;
}rtp_header;
typedef struct RTPPack
{
rtp_header rtphdr;
rtp_xtn_hdr_t *xtnhdr;
BYTE datap[198];
}RTPPACK, *PRTPPACK;
union DataPacket
{
RTPPACK rtpPack;
BYTE data[214];
};
#pragma pack(pop)
Now I want to send this with the sendto method from winsock.
that I do so after filling
m_rtpPack.rtpPack.rtphdr.v = 2;
m_rtpPack.rtpPack.rtphdr.seq = 12525;
m_rtpPack.rtpPack.rtphdr.cc = 0;
m_rtpPack.rtpPack.rtphdr.x = 0;
m_rtpPack.rtpPack.rtphdr.m = 1;
m_rtpPack.rtpPack.rtphdr.pt = 0;
m_rtpPack.rtpPack.rtphdr.p = 0;
m_rtpPack.rtpPack.rtphdr.ssrc = 25255563;
m_rtpPack.rtpPack.rtphdr.ts = GetTickCount();
m_rtpPack.rtpPack.xtnhdr = 0;
...
Getting Audio Sample
...
//Filling the DataBuffer
strcpy((char*)m_rtpPack.rtpPack.datap,szBuffer);
//sending packet to server via UDP Socket.
nSend = sendto(m_Socket, m_rtpPack.data, strlen(m_rtpPack), 0, (SOCKADDR*)&m_saRemote, sizeof(SOCKADDR));
But anything is wrong here. I can´t find out what but if i proof the network stream with packetyzer he can´t read the packet.
Can anyone see what I´m doing wrong or explain what is all to do to send a RTP packet through the net?
Greetings CrazyPlaya
-
September 17th, 2008, 02:04 AM
#2
Re: Building and sending RTP Packet
So problem is fixed. After changing the network byte order it works correctly. My order was for BIG ENDIAN and needed the order for LITTLE.
That´s all
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|