ortp移植到hi3518eh.264封包rtp发送

ortp移植到hi3518eh.264封包rtp发送

看到ORTP是纯C实现的rtp库,于是移植到3518e试用一下. 1.下载源码 链接地址

里面有个tar res跳转链接跳转入 链接地址

下载最新的ortp-0.23.0.tar.gz,并解压 2.编译

./configure --prefix=/work/hi3518/ortp --host=arm-hisiv100nptl-linux make make install

配置只需指定安装目录prefix,编译平台host即可,这里host直接赋值arm-hisiv100nptl-linux-gcc前缀即可,注意不是arm-hisiv100nptl-linux-而是arm-hisiv100nptl-linux。 3.部署到开发板

将编译生成的库/work/hi3518/ortp/lib/libortp.so.9复制到开发板/usr/lib中

4.添加ortp库到mpp2中

在海思SDK mpp2目录下新建rtp目录,将/work/hi3518/ortp/

下全部内容复制到该目录下,

修改mpp2/sample/Makefile.param,添加: INC_FLAGS += -I$(MPP_PATH)/rtp/include -L$(MPP_PATH)/rtp/lib/ -lortp 5.修改代码

示例程序venc中有将视频进行264编码并保存为文件(nfs挂载),这里一步步分析sample_venc.c即可找到最终的保存是通过sample_comm_venc.c中的

SAMPLE_COMM_VENC_SaveH264函数完成的,这里只要修改该函数为封包发送即可。

下面是sample_comm_venc.c中需要添加的部分:

#include <ortp/ortp.h> #include <signal.h> #include <stdlib.h> #include <sys/types.h> #include <sys/time.h> #include <stdio.h>

#define Y_PLOAD_TYPE 96 //H.264 #define MAX_RTP_PKT_LENGTH 1400

#define DefaultTimestampIncrement 3600 //(90000/25) uint32_t g_userts=0;

RtpSession *pRtpSession = NULL; /** 初始化 *

* 主要用于对ortp以及其它参数进行初始化 * @param: char * ipStr 目的端IP地址描述串 * @param: iint port 目的端RTP监听端口 * @return: RtpSession * 返回指向RtpSession对象的指针,如果为NULL,则初始化失败 * @note: */

RtpSession * rtpInit( char * ipStr, int port) {

RtpSession *session; char *ssrc;

printf(\

ortp_init();

ortp_scheduler_init();

ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR);

session=rtp_session_new(RTP_SESSION_SENDONLY);

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4