• crtmpserver分析与组网


    转自:http://blog.chinaunix.net/uid-26000296-id-4273860.html

    简介:
    crtmpserver是一款不错的开源流媒体服务器,用c++语言编写,跨平台。
    官方介绍crtmpserver不仅支持adobe rtmp协议,还支持其它常用的协议:
    . To and from Flash (RTMP,RTMPE, RTMPS, RTMPT, RTMPTE)
    . To and from embedded devices: Android, IP cameras, Hardware encoders
    . From iOS devices
    . IP-TV using MPEG-TS and RTSP/RTCP/RTP protocols

    一、结构图
    crtmpserver从生产环境使用的情况来看,每天都在用,从几十M到上百M的流量不等,运行几个月无宕机,
    CPU, 内存各方面性能指标稳定,还是比较满意的。
    当然官方还提示有改进的商业版的版本“EvoStream”,如果不差钱,可以买商业版,也算支持作者辛苦的付出。
    日常使用,开源版本已经足够。

    下图1是我整理的画的crtmpserver结构图,按层次划分。分为以下几大部分:
    . 网络层: 操作系统的网络模型相关, Linux平台epoll, FreeBSD平台kqueue, Windows平台select
    . 协议层: RTMP,SIP SDP,HTTP,TS, RTP等协议的处理
    . 媒体层: 处理媒体的codec, 如mp3, mp4, flv, aac H.264等
    . 应用层: 一系列应用,如admin, http/https, liveflv, dns等,
    我们也可以扩展自己的协议,如图中应用层红色模块部分所示:


    二、组网
    crtmpserver还支持简单的负载集群,只需要把配置文件中配置主从关系,
    推到主上的媒体流自然从上面也有,Viewer可以分散开从从服务器上拉媒体流。
    如下图所示:

    具体配置示例如下:
    修改主服务器的crtmpserver.lua
        {
          name="proxypublish",
          description="Application for forwarding streams to another RTMP server",
          protocol="dynamiclinklibrary",
          acceptors =
          {
            {
              ip="0.0.0.0",
              port=6665,                             -- 主服务器接收RTMP流的端口
              --protocol="inboundLiveFlv"
              protocol="inboundRtmp"
            },
          },
          abortOnConnectError=true,
          targetServers =
          {
            {
              targetUri="rtmp://192.168.1.115/live",   -- 从服务器的URL
              targetStreamType="live", -- (live, record or append)
              localStreamName="proxytest",            -- 推送到从服务器的流
              keepAlive=true
            },
          },
        },

    启动主,多服务器;这样,推送到主服务器的流“proxytest",在从服务器上也能观看了;

  • 相关阅读:
    Java虚拟机一览表
    Java程序员的10道XML面试题
    bzoj 1644: [Usaco2007 Oct]Obstacle Course 障碍训练课【spfa】
    bzoj 1703: [Usaco2007 Mar]Ranking the Cows 奶牛排名【bitset+Floyd传递闭包】
    bzoj 1664: [Usaco2006 Open]County Fair Events 参加节日庆祝【dp+树状数组】
    bzoj 2100: [Usaco2010 Dec]Apple Delivery【spfa】
    bzoj 2015: [Usaco2010 Feb]Chocolate Giving【spfa】
    bzoj 1741: [Usaco2005 nov]Asteroids 穿越小行星群【最大点覆盖】
    bzoj 1645: [Usaco2007 Open]City Horizon 城市地平线【线段树+hash】
    bzoj 2060: [Usaco2010 Nov]Visiting Cows 拜访奶牛【树形dp】
  • 原文地址:https://www.cnblogs.com/georgewangii/p/4604162.html
Copyright © 2020-2023  润新知