建议IPC采用RTMP(server+rtmppush)的流媒体框架。

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/freeman1975/article/details/50439073

建议IPC采用RTMP(server+rtmppush)的流媒体框架。此技术方案的优势:

1、RTMP协议是标准的。

2、通过服务器中转的方式,完全没有NAT穿透的问题。可以在VPS上面安装srs(Simple Rtmp Server)就行。

3、FMS同时支持iOS和android手机自带的原生播放器。

设备上实现的rtmp push,由server来控制其是否开始push to FMS。这样当没有使用时,就不会平白消耗服务器的CPU及带宽。这样的运营成本应该是可以接受的。

 

测试一:ubuntu上面建立FMS,IPC采集音视频,通过rtmp push到FMS上面。然后在win7上面用flash player来观看。

http://winlinvip.github.io/srs.release/trunk/research/players/srs_player.html?server=192.168.2.9&app=live&stream=livestream&port=1935

URL: rtmp://192.168.2.9:1935/live/liveview

 

可以看出,延时在900ms左右。

 

http://winlinvip.github.io/srs.release/trunk/research/players/srs_player.html?server=192.168.2.10&app=live&stream=liveview&port=1935#

 

 

 

问题记录

一、在arm-linux平台上面启动srs失败

# mkdir objs

# ./srs -c srs.conf 

[1970-01-01 00:49:54.489][trace][610][0]config parse complete

[1970-01-01 00:49:54.491][trace][610][0]write log to file ./objs/srs.log

[1970-01-01 00:49:54.491][trace][610][0]you can: tailf ./objs/srs.log

[1970-01-01 00:49:54.492][trace][610][0]@see: https://github.com/ossrs/srs/wiki/v1_CN_SrsLog

# ls objs/

srs.log

# cat objs/srs.log

[1970-01-01 00:49:54.493][trace][610][0]srs checking config...

[1970-01-01 00:49:54.546][trace][610][0]retrieve local ipv4 ip=192.168.2.10, index=0

[1970-01-01 00:49:54.546][trace][610][0]detect intranet address: 192.168.2.10, ifname=eth0

[1970-01-01 00:49:54.547][warn][610][0][2]stats network use index=0, ip=192.168.2.10

[1970-01-0100:49:54.548][warn][610][0][2] stats disk list: sda sdb xvda xvdb

[1970-01-01 00:49:54.549][trace][610][0]write log to file ./objs/srs.log

[1970-01-01 00:49:54.549][trace][610][0]you can: tailf ./objs/srs.log

[1970-01-01 00:49:54.551][trace][610][0]@see: https://github.com/ossrs/srs/wiki/v1_CN_SrsLog

[1970-01-01 00:49:54.552][trace][610][0]srs(ossrs) 2.0.200

[1970-01-01 00:49:54.553][trace][610][0]license: The MIT License (MIT), Copyright (c) 2013-2015 SRS(ossrs)

[1970-01-01 00:49:54.553][trace][610][0]primary/master: SRS/1.0release

[1970-01-01 00:49:54.553][trace][610][0]authors: winlin,wenjie.zhao

[1970-01-01 00:49:54.554][trace][610][0]contributors: winlin<winlin@vip.126.com>wenjie.zhao<740936897@qq.com> xiangcheng.liu<liuxc0116@foxmail.com>naijia.liu<youngcow@youngcow.net> alcoholyi<alcoholyi@qq.com>byteman<wangchen2011@gmail.com> chad.wang<chad.wang.cn@gmail.com>suhetao<suhetao@gmail.com> Johnny<fengjihu@163.com>karthikeyan<keyanmca@gmail.com> StevenLiu<lq@chinaffmpeg.org>zhengfl<zhengfl_1989@126.com> tufang14<breadbean1449@gmail.com> allspace<allspace@gmail.com>niesongsong<nie950@gmail.com> rudeb0t<nimrod@themanxgroup.tw>

[1970-01-01 00:49:54.554][trace][610][0]uname: Linux freeman-desktop 2.6.32-74-generic #142-Ubuntu SMP Tue Apr 2810:02:35 UTC 2015 i686 GNU/Linux

[1970-01-01 00:49:54.555][trace][610][0]build: 2015-12-30 16:08:34, little-endian

[1970-01-01 00:49:54.555][trace][610][0]configure:  --disable-all --with-hls--without-ssl --with-nginx --with-http-api --with-ingest --without-ffmpeg--with-http-server

[1970-01-01 00:49:54.556][trace][610][0]features: --prefix=/usr/local/srs --with-hls --without-hds --without-dvr--with-nginx --without-ssl --without-ffmpeg --without-transcode --with-ingest--without-stat --without-http-callback --with-http-server--without-stream-caster --with-http-api --without-librtmp --without-research--without-utest --without-gperf --without-gmc --without-gmp --without-gcp--without-gprof --without-arm-ubuntu12 --without-mips-ubuntu12 --log-trace

[1970-01-01 00:49:54.557][trace][610][0]conf: srs.conf, limit: 1000

[1970-01-01 00:49:54.557][trace][610][0]writev limits write 1024 iovs a time

[1970-01-01 00:49:54.557][warn][610][0][2]SRS 2.0.200 is not stable, please use stable branch 1.0release instead

[1970-01-01 00:49:54.558][trace][610][0]cpu is arm, glibc 2.2

[1970-01-01 00:49:54.558][warn][610][0][2]check feature rtmp handshake: off

[1970-01-01 00:49:54.559][trace][610][0]check feature hls: on

[1970-01-01 00:49:54.559][warn][610][0][2]check feature hds: off

[1970-01-01 00:49:54.559][warn][610][0][2]check feature http callback: off

[1970-01-01 00:49:54.560][trace][610][0]check feature http api: on

[1970-01-01 00:49:54.560][trace][610][0]check feature http server: on

[1970-01-01 00:49:54.561][trace][610][0]check feature http parser: on

[1970-01-01 00:49:54.561][warn][610][0][2]check feature dvr: off

[1970-01-01 00:49:54.562][warn][610][0][2]check feature transcode: off

[1970-01-01 00:49:54.562][trace][610][0]check feature ingest: on

[1970-01-01 00:49:54.562][warn][610][0][2]check feature system stat: off

[1970-01-01 00:49:54.563][trace][610][0]check feature compile nginx: on

[1970-01-01 00:49:54.563][warn][610][0][2]check feature compile ffmpeg: off

[1970-01-01 00:49:54.563][warn][610][0][2]stream caster: off

[1970-01-01 00:49:54.564][trace][610][0]MR(merged-read): on, @see https://github.com/ossrs/srs/issues/241

[1970-01-01 00:49:54.564][trace][610][0]MR(merged-read) default 0 sleep 350

[1970-01-01 00:49:54.564][trace][610][0]MW(merged-write) default sleep 350

[1970-01-01 00:49:54.565][trace][610][0]read chunk stream cache cid [0, 16)

[1970-01-01 00:49:54.565][trace][610][0]default gop cache 1, play queue 30s

[1970-01-01 00:49:54.566][trace][610][0]complex send algorithm enabled.

[1970-01-01 00:49:54.566][warn][610][0][2]TCP_NODELAY enabled, may hurts performance.

[1970-01-01 00:49:54.566][trace][610][0]auto guess socket send buffer by merged write

[1970-01-01 00:49:54.567][trace][610][0]system default latency in ms: mw(0-350) + mr(0-350) + play-queue(0-30000)

[1970-01-01 00:49:54.569][trace][610][0]http: root mount to ./objs/nginx/html

[1970-01-01 00:49:54.570][trace][610][0]start deamon mode...

[1970-01-01 00:49:54.579][trace][611][0]father process exit. ret=0

[1970-01-01 00:49:54.628][trace][610][0]grandpa process exit.

 Linux. ret=1013(No such file or directory)

[1970-01-01 00:49:54.588][error][612][0][2]init st failed. ret=1013(No such file or directory)

#

跟进去发现:

#ifdef __linux__

   // check epoll, some old linux donot support epoll.

   // @see https://github.com/ossrs/srs/issues/162

   if (!srs_st_epoll_is_supported()) {

       ret = ERROR_ST_SET_EPOLL;

       srs_error("epoll required on Linux. ret=%d", ret);

       return ret;

    }

#endif

#define ERROR_ST_SET_EPOLL                  1013

这说明是linux内核没有启动epoll

 

二、可以发布rtmp url,但连上去没有流。

--with-http-callback –with-ssl必须包括在里面。

 

展开阅读全文

没有更多推荐了,返回首页