[Live-devel] RTP, change of the incoming PORT

Paul luk666 at wp.pl
Tue Feb 20 03:49:41 PST 2007


Hi,  
  
I impelmented a module, in which RTPClient and RTPServer communicate  
usimg pipe. The RTPClient receive RTP stream write it to pipe and 
the  
RTPServer (other process) read pipe and stream it to VLC Player. I  
am using FreeBsd and C++ as prorgamming language. I would like to  
implement the following functionality: I stream two RTP streams 
(using testMPEG2TransportStream server) to the same IP address but 
to two different ports. My module will listen to one of them and 
then (lets say after 15 seconds) will switch to the other port and 
forward the second stream to VLC player. I think the best way to 
implement this is to change on the fly the incoming PORT of the RTP 
Client.  
  
I  implemeted successfully the dynamic change of the outgoing port  
of RTPServer. It works fine using the following code:  
  
//CHANGING OF OUTGOING PORT  
sinkStream->startPlaying(*sourceStream, RTPServer::stop, this);  
      
watch='c';  
while(1){  
	uEnv->taskScheduler().doEventLoop(&watch);	  
	if (watch=='c')  
	{  
		fprintf(stderr,"watch variable changed \n");  
		changeRTPPort(9500);  
		watch=0;  
	}  
}	  
.  
and the fucntion which change Port.  
  
.void RTPServer::changeRTPPort(int newPort)  
{  
	//set rtp port number  
	rtpPortNumber=newPort;  
	rtcpPortNumber=newPort+1;  
  
	if (rtpPort)  
	{  
		delete(rtpPort);  
	}  
	rtpPort=new Port(rtpPortNumber);  
	if (rtcpPort)  
	{  
		delete(rtcpPort);  
	}  
	struct in_addr temp_address;  
	temp_address.s_addr = our_inet_addr("192.168.16.233");  
	//temp_address=address  
	int temp_timeToLive=1	;	  
	rtcpPort =new Port(rtcpPortNumber);  
  
	rtpGroupsock->changeDestinationParameters(temp_address,  
*rtpPort, temp_timeToLive);  
  
	rtcpGroupsock->changeDestinationParameters(temp_address,  
*rtcpPort, temp_timeToLive);  
  
}   
  
When I tried to implemented changing of incoming port of the  
RTPClinet in the similar way it does not work. Does anybody has any 
idea why it is not working? Thanks for any help or suggestions.   
  
Regards,  
  
Paul  

----------------------------------------------------
Płyta Franka Sinatry "Songs From The Heart" 
to kolekcja najromantyczniejszych przebojów 
gwiazdy Hollywood! Posłuchaj "My Funny Valentine"  
i "All The Way" i zakochaj się http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fsinatra.html&sid=1027




More information about the live-devel mailing list