資源簡(jiǎn)介
在linux下的實(shí)時(shí)語(yǔ)音聊天程序,使用了adpcm編碼,同時(shí)還使用了RTP實(shí)時(shí)傳輸協(xié)議,是一個(gè)很好的學(xué)習(xí)實(shí)時(shí)傳輸協(xié)議的程序。- chats the procedure under the linux real-time pronunciation, has used the adpcm code, meanwhile has used the RTP real-time transmission agreement, is a very good study real-time transmission agreement procedure.
src
...\comm.c
...\comm.h
...\e-comm
...\e-comm.c
...\e-comm.h
...\global.h
...\lib
...\...\adpcm.c
...\...\adpcm.h
...\...\alloc.c
...\...\alloc.h
...\...\config.h
...\...\Makefile.am
...\...\Makefile.in
...\...\md5.c
...\...\md5.h
...\...\mwc1616.c
...\...\mwc1616.h
...\...\ohtbl.c
...\...\ohtbl.h
...\...\phtbl.c
...\...\phtbl.h
...\...\rand32.c
...\...\rand32.h
...\...\rtp.c
...\...\rtp.h
...\...\seterror.c
...\...\seterror.h
...\...\vstr.c
...\...\vstr.h
...\Makefile.am
...\Makefile.in
...\sound.c
...\sound.h

代碼片段和文件信息
/*?comm.h?-?Communication?input/output?modules
?*
?*?This?program?is?free?software;?you?can?redistribute?it?and/or?modify?it
?*?under?the?terms?of?the?GNU?General?Public?License?as?published?by?the?Free
?*?Software?Foundation;?either?version?2?of?the?License?or?(at?your?option)
?*?any?later?version.
?*
?*?This?program?is?distributed?in?the?hope?that?it?will?be
?*?useful?but?WITHOUT?ANY?WARRANTY;?without?even?the?implied
?*?warranty?of?MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR
?*?PURPOSE.??See?the?GNU?General?Public?License?for?more
?*?details?(available?in?COPYING).
?*/
#include?
#include?
extern?rtp_t?rtp;
extern?int?open_soundcard?(int?oflag);
void?*mod_cin?(void?*ptr)
{
??int?rtpfd;????????????????????/*?RTP?socket?file?descriptor?*/
??int?rtcpfd;???????????????????/*?RTCP?socket?file?descriptor?*/
??int?addr_len;?????????????????/*?Data?size?Bytes?received?*/
??struct?sockaddr_in?rtps;??????/*?RTP?socket?*/
??struct?sockaddr_in?rtcps;?????/*?RTCP?socket?*/
??struct?sockaddr_in?remote;????/*?Remote?address?information?*/
??vstr_t?recv_data;?????????????/*?Received?data?*/
??rtp_packet_t?*packet;?????????/*?Parsed?RTP?packet?*/
??fd_set?readset;
??int?fdmax;
??fprintf(stderr?“+?Communication?input?module?loaded.\n“);
??vstr_init?(&recv_data?RTP_MTU_SIZE);
??if?((rtpfd?=?socket(AF_INET?SOCK_DGRAM?0))?0)?{
????perror(“Error?opening?socket“);
????exit(1);
??}
??if?((rtcpfd?=?socket(AF_INET?SOCK_DGRAM?0))?0)?{
????perror(“Error?opening?socket“);
????exit(1);
??}
??rtps.sin_family?=?AF_INET; /*?Internet?protocol?*/
??rtps.sin_port?=?htons(RTP_PORT); /*?Port?*/
??rtps.sin_addr.s_addr?=?htonl(INADDR_ANY); /*?rtps?address?*/
??memset(&(rtps.sin_zero)?‘\0‘?8); /*?Zero?the?rest?*/
??if?(bind(rtpfd?(struct?sockaddr?*)?&rtps?sizeof(struct?sockaddr))?0)?{
????perror(“Error?binding?socket“);
????exit(1);
??}
??rtcps.sin_family?=?AF_INET; /*?Internet?protocol?*/
??rtcps.sin_port?=?htons(RTCP_PORT); /*?Port?*/
??rtcps.sin_addr.s_addr?=?htonl(INADDR_ANY); /*?rtcps?address?*/
??memset(&(rtcps.sin_zero)?‘\0‘?8); /*?Zero?the?rest?*/
??if?(bind(rtcpfd?(struct?sockaddr?*)?&rtcps?sizeof(struct?sockaddr))?0)?{
????perror(“Error?binding?socket“);
????exit(1);
??}
??fprintf(stderr?“+?RTP?Listening?at?%s:%d...\n“
????????inet_ntoa(rtps.sin_addr)?ntohs(rtps.sin_port));
??fprintf(stderr?“+?RTCP?Listening?at?%s:%d...\n“
????????inet_ntoa(rtcps.sin_addr)?ntohs(rtcps.sin_port));
??addr_len?=?sizeof(struct?sockaddr);
??while(1)
??{
????FD_ZERO?(&readset);
????FD_SET?(rtpfd?&readset);
????FD_SET?(rtcpfd?&readset);
????fdmax?=?(rtpfd?
????select?(fdmax?+?1?&readset?NULL?NULL?NULL);
????if?(FD_ISSET(rtpfd?&readset))?{
??????/*?Receive?data?from?network?*/
??????recv_data.size?=?recvfrom?(rtpfd?recv_data.data?RTP_MTU_SIZE?0?&remote?&addr_len);
??????vstr_adv_tail?(&recv_data?
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????17956??2001-11-20?16:47??e-comm-0.71\aclocal.m4
?????文件????????404??2001-07-05?18:07??e-comm-0.71\AUTHORS
?????文件?????????91??2001-07-05?18:07??e-comm-0.71\ChangeLog
?????文件???????2473??2012-04-11?21:30??e-comm-0.71\config.cache
?????文件??????31247??2001-07-05?18:07??e-comm-0.71\config.guess
?????文件???????1115??2012-04-11?20:47??e-comm-0.71\config.h
?????文件????????966??2001-07-05?18:16??e-comm-0.71\config.h.in
?????文件???????2893??2012-04-11?21:30??e-comm-0.71\config.log
?????文件??????10338??2012-04-11?21:30??e-comm-0.71\config.status
?????文件??????24171??2001-07-05?18:07??e-comm-0.71\config.sub
?????文件??????73728??2001-11-20?16:47??e-comm-0.71\configure
?????文件????????676??2001-11-20?16:46??e-comm-0.71\configure.in
?????文件??????17992??2001-07-05?18:07??e-comm-0.71\COPYING
?????文件???????7831??2001-07-05?18:07??e-comm-0.71\INSTALL
?????文件???????5598??2001-07-05?18:07??e-comm-0.71\install-sh
?????文件?????142160??2012-04-11?21:30??e-comm-0.71\libtool
?????文件??????99553??2001-07-05?18:07??e-comm-0.71\ltconfig
?????文件?????138294??2001-07-05?18:07??e-comm-0.71\ltmain.sh
?????文件??????11007??2012-04-11?21:34??e-comm-0.71\Makefile
?????文件?????????14??2001-07-05?18:07??e-comm-0.71\Makefile.am
?????文件??????10852??2001-11-20?16:47??e-comm-0.71\Makefile.in
?????文件???????6283??2001-07-05?18:07??e-comm-0.71\missing
?????文件????????722??2001-07-05?18:07??e-comm-0.71\mkinstalldirs
?????文件?????????54??2001-07-05?18:07??e-comm-0.71\NEWS
?????文件????????325??2001-07-05?18:07??e-comm-0.71\README
?????文件???????6313??2001-10-20?23:42??e-comm-0.71\src\comm.c
?????文件????????900??2001-10-20?22:00??e-comm-0.71\src\comm.h
?????文件???????4264??2012-04-11?21:34??e-comm-0.71\src\comm.o
?????文件??????29172??2012-04-11?21:34??e-comm-0.71\src\e-comm
?????文件???????2712??2001-10-20?20:55??e-comm-0.71\src\e-comm.c
............此處省略57個(gè)文件信息
評(píng)論
共有 條評(píng)論