[Live-devel] Streaming Redirection
Jeff Oliver
Jeffrey.Oliver at mascorp.com
Fri Jan 30 10:20:03 PST 2004
I actually got the redirection code working last night...apparently I
had a problem with my Transport Header parsing and it was picking up the
wrong ports for the client side. Well it works as well as I need it to.
But here's a list of things I had to change to get this to work. I
think its fairly straight forward.
1) I completely rewrote the parseTransportHeader to get more
information. Multicast/Unicast, Destination, TTL, Client_Port.
2) Modified the getStreamParameters function to create a socket to the
destinationAddress instead of the client address. Commented out the
destinationAddress = clientAddress.
3) Before the call to getStreamParameters, determined if the destination
parameter was used. if not, then copied the client address into the
destination address.
That was about it. I used a different pc to do the RTSP request and
told my server to send the data to a different client to decode the
stream. pretty sweet. I haven't tried reroute to a multicast address
yet, but if it doesn't work, i figure it shouldn't be much work to get
that going.
I hope i can post code snippets here. This snippet is acutally in the
handleCmd_PLAY function. In my version of the server we stripped out
the describe and setup commands...
// Look for a "Transport:" header in the request string,
// to extract client RTP and RTCP ports, if present:
unsigned short clientRTPPortNum = 0; // default
unsigned short clientRTCPPortNum = 1; // default
Boolean isMulticast;
netAddressBits destinationAddress = 0;
u_int8_t destinationTTL = 255;
char *transportHeader = strstr(fullRequestStr, "Transport:");
if (transportHeader != NULL)
{
parseTransportHeader(transportHeader, clientRTPPortNum,
clientRTCPPortNum,
isMulticast, destinationAddress,
destinationTTL);
Port clientRTPPort(clientRTPPortNum);
Port clientRTCPPort(clientRTCPPortNum);
Port serverRTPPort(0);
Port serverRTCPPort(0);
// Direct stream to the destination, if the dest wasnt
specified, then
// send it to the client.
if (destinationAddress == 0)
{
destinationAddress = fClientAddr.sin_addr.s_addr;
}
subsession->getStreamParameters(fClientAddr.sin_addr.s_addr,
clientRTPPort, clientRTCPPort,
isMulticast, destinationAddress,
destinationTTL,
serverRTPPort, serverRTCPPort,
fStreamStates[streamNum].streamToken);
sprintf((char*)transportResponse, "Transport:
RTP/AVP;unicast;client_port=%d-%d;server_port=%d-%d\r\n"
"Media: vpid=?;apid=?;len=?\r\n",
ntohs(clientRTPPort.num()), ntohs(clientRTCPPort.num()),
ntohs(serverRTPPort.num()), ntohs(serverRTCPPort.num()));
}
Im not sure how portable this is, but i figure if someone wants to make
it more portable they can.
Jeff Oliver
Cavalera Claudio wrote:
>>-----Original Message-----
>>From: Jeff Oliver [mailto:Jeffrey.Oliver at mascorp.com]
>>Sent: martedì 27 gennaio 2004 22.25
>>To: LIVE.COM Streaming Media - development & use
>>Subject: Re: [Live-devel] Streaming Redirection
>>
>>
>>I too am interested in the redirection feature. I was playing around
>>with some of the code to get this to work, but I don't have anything
>>working yet. I added code to parse the destination field and changed
>>around the code that opens up the sockets, but i couldn't get the
>>streamer to actually send the RTP data. If I get a chance I'll take
>>another look at it and see if I can get it working.
>>
>>
>
>You mean you have already modified Open RTSP to use the destination field?
>Have you tested only with the live streaming server or also with other platforms?
>Thanks
>Claudio
>
>_______________________________________________
>live-devel mailing list
>live-devel at lists.live.com
>http://lists.live.com/mailman/listinfo/live-devel
>
>
>
>
Disclaimer: The information contained in this transmission, including any
attachments, may contain confidential information of Matsushita Avionics
Systems Corporation. This transmission is intended only for the use of the
addressee(s) listed above. Unauthorized review, dissemination or other use
of the information contained in this transmission is strictly prohibited.
If you have received this transmission in error or have reason to believe
you are not authorized to receive it, please notify the sender by return
email and promptly delete the transmission
More information about the live-devel
mailing list