作者kkjay (风尘骄子)
看板PangSir
标题Re: [问题] 作业一的问题
时间Mon Mar 10 00:33:21 2003
※ 引述《WindCloud (还有三天,看我七十二变!)》之铭言:
: RTPOpenPort()里头,预设是开启 9000 这个 port,所以对方一定要连到自己电脑
: 的 9000 这个 port,换句话说,对方的 target port 一定得是 9000。
: 问题来了,作业里又要求我们不能把 target port 写死在程式码里,
: 难不成只是开一个文字编辑区,然後只能输入 9000 这个值吗?
: 因为输入别的值,就连不到对方的 port 啦......
: 麻烦助教解答一下吧。 @_@
我 trace 了 cclRTP.h and cclRTP.c, 如果真的要改的话可能要去修改
rtp subproject 内的 rtp.c & rtcp.c 中的
RTP *rtp_open(u_int16 port, u_int32 ssrc)
RTCP *rtcp_open(u_int16 port, const char *cname)
里面是如果 port = 0, 程式会从 RTP_PORT_BASE=9000 开始开 port
然後 rtp = 9000 rtcp = 9001 , for example ...
所以你可以修改 cclRTP.h and cclRTP.c, 增加
RETCODE cclRTPOpen(int channel, int rtpPacketSiz, u_int16 port);
供你上层的程式使用...
RETCODE cclRTPOpen(int channel, int rtpPacketSiz, u_int16 port)
{
if( channel<0 || channel>=MAX_RTP_CHANS )
return -1;
if( rtp[channel] ) {
RTP_PACKET_SIZ[channel] = rtpPacketSiz;
return 1;
}
rtp[channel] = rtp_open(port,0);
if( !rtp[channel] )
return -1;
rtcp[channel] = rtcp_open(port+1,0);
if( !rtcp[channel] )
return -1;
return 0;
}
参考看看吧!!
--
※ 发信站: 批踢踢实业坊(ptt.csie.ntu.edu.tw)
◆ From: 218.160.22.87