资源简介
linux 语音实时 RTP 语音编码

代码片段和文件信息
/* 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 < rtcpfd) ? rtcpfd : 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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-04-01 13:18 voice_comm\
文件 404 2001-07-05 18:07 voice_comm\AUTHORS
文件 17992 2001-07-05 18:07 voice_comm\COPYING
文件 91 2001-07-05 18:07 voice_comm\ChangeLog
文件 7831 2001-07-05 18:07 voice_comm\INSTALL
文件 11007 2012-04-11 21:34 voice_comm\Makefile
文件 14 2001-07-05 18:07 voice_comm\Makefile.am
文件 10852 2001-11-20 16:47 voice_comm\Makefile.in
文件 54 2001-07-05 18:07 voice_comm\NEWS
文件 325 2001-07-05 18:07 voice_comm\README
文件 17956 2001-11-20 16:47 voice_comm\aclocal.m4
文件 2473 2012-04-11 21:30 voice_comm\config.cache
文件 31247 2001-07-05 18:07 voice_comm\config.guess
文件 1115 2012-04-11 20:47 voice_comm\config.h
文件 966 2001-07-05 18:16 voice_comm\config.h.in
文件 2893 2012-04-11 21:30 voice_comm\config.log
文件 10338 2012-04-11 21:30 voice_comm\config.status
文件 24171 2001-07-05 18:07 voice_comm\config.sub
文件 73728 2001-11-20 16:47 voice_comm\configure
文件 676 2001-11-20 16:46 voice_comm\configure.in
文件 5598 2001-07-05 18:07 voice_comm\install-sh
文件 142160 2012-04-11 21:30 voice_comm\libtool
文件 99553 2001-07-05 18:07 voice_comm\ltconfig
文件 138294 2001-07-05 18:07 voice_comm\ltmain.sh
文件 6283 2001-07-05 18:07 voice_comm\missing
文件 722 2001-07-05 18:07 voice_comm\mkinstalldirs
目录 0 2014-04-01 13:18 voice_comm\src\
文件 10816 2012-04-11 21:34 voice_comm\src\Makefile
文件 222 2001-07-05 19:32 voice_comm\src\Makefile.am
文件 10672 2001-11-20 16:47 voice_comm\src\Makefile.in
文件 6313 2001-10-20 23:42 voice_comm\src\comm.c
............此处省略53个文件信息
相关资源
- uboot到linux logo显示不间断 补丁
- UNIX/LINUX编程实践教程的源码
- Linux任务管理器
- linux应用层的华容道游戏源代码
- ubuntu9.10 可加载内核模块和字符设备驱
- MP3文件ID3v2ID3v2APEv2标签读取
- wifi局域网内双向语音实时通话
- 操作系统实验——虚存管理实验
- linux下的发包工具sendip
- 尚观培训linux许巍关于c 的笔记和讲义
- 尚观培训linux董亮老师关于数据结构的
- linux 线程池源码 c 版
- linux C 电梯程序练习
- linux下用多进程同步方法解决生产者
- Linux 操作系统实验(全)
- Linux From Scratch 中文手册
- linux 网络实验 ftp程序
- Linux命令大全离线版&在线版
- 操作系统共享内存实验
- dos 下运行Linux 命令--gnu_utils
- linux 0.12内核源代码
- linux简易shell C实现
- linux实验报告及心得体会
- 基于GTK的Linux环境下的简易任务管理器
- linux扫雷游戏代码
- CAN Linux驱动代码
- Linux系统教材
- intel 82579LM 网卡驱动Linux系统版 v1.9.
- SA1110处理器掌上电脑液晶显示器设计
- 基于Linux的串口服务器设计
评论
共有 条评论