crtmpserver实现防盗流和流推送验证

Protecting your streams from webpage copy&paste flash code, listing or recording 
保护流,防止在页面上被复制&粘贴,解析或录制 
by Rani 
      
目录表 Table of Contents 
I.    简要说明和目的  Brief description and our goals 
II.   设置rtmpd服务器 Setting up rtmpd server 
III.  测试设置项      Testing our setup 
IV.   抓住“小偷”    Catching the thieves 
V.    通过FMLE测试设置,实现和流推送端来共同保护流  
      Combining protected streams (from above) with PUBLISHING streams via FMLE Testing server setup 
VI.   附录            ANEXA 
IMPORTANT 
Global stuff 
I.  Scenario 
II. Scenario 
V.  Scenario 
. Due to latest changes, rev. 781 being latest when i write this,  
  you must update your rtmpappprotocolhandler.cpp as: 
. Adding filter for pageURL (webpage where resides the webplayer, dinamic or static webpages) 
. Show total number of connections after a connection is made 
. Add posibility to configure a global number of connections that rtmpd could accept 

I. Brief description and our goals 
简要说明和目的  
We want to stream some media files into our ready-made website. We have just heard about  
rtmpd which is great and we want to give it a try. We download it, we compile & make it  
and finally run it. Everything seems to be just fine but someday, by chance, browsing  
the web we saw our stream posted into several website accross the net. It seems to working  
from these websites too. Well, that could be pain in the ass. More connections, more bandwidth  
consumption on our server side and very hard to control it. I called this copy&paste code.  
Since they put our code into their webpages and it is working they could simply list our  
media folder to see what's there or even record them. So we got angry and we put a login  
system on the website. Since it was for public and everyone just had to sign up for an free  
account the problem did not get away. Why ? Because they got logged in and browsing source  
code for our flash streaming code. Need to build a swf player with security enhanced options ?  
No way, that could be “tricked” as well (as i was told). In a matter of speech we need to do  
validation on the SERVER SIDE not on CLIENT SIDE. 
我们想将媒体文件以流的方式发布到网页上。 
我们使用rtmpd来搭建这套系统,通过编译,测试,运行,看起来都正常工作了; 
但有一天,偶然的机会,发现我们的流被贴在别的网站上,而且看起来也运行正常; 
这个就麻烦大了,别的网站的链接,带宽开销都得由我们承担--为别人做嫁衣了;而且无法进行管控; 
我将这种称之为拷贝&粘贴代码; 
因为他们将我们的代码复制到他们的页面上,并列出相应的媒体文件或流,就能正常工作并且录制; 
对于这种,我们可能会想到要给这套系统添加登录功能,但这个对于用户来说太麻烦了; 
而且也没有解决问题,他们可以正常登录再解决播放页面; 
要不要添加播放器验证机制?实际上也没有用, 他们可以通过反工程进行破解并为伪造; 
而在这个文章中真正要讲的方案是在服务端进行验证,而不是在客户端; 


Our goal is to be sure that our stream can be streamed only from our website, website that  
in first scenario when both website and rtmpd server are hosted on the same machine and  
in second scenario is hosted on different machine and different subnet as rtmpd server  
No matter if they copy&paste our code, or if they try to connect with other flash player  
or try to record our stream with some software we have to be sure that they COULD NOT.  
How could we do that ? 
我们的目的是要使我们的流只能在我们自己的网页上播放; 
在第一种场景中,网页和rtmpd服务器都托管在同一台机器上; 
在第二种场景中,网页和rtmpd服务器托管在不同子网的不同机器上, 
无论他们是想复制&粘贴我们的代码, 
还是使用其它的flash播放器来连接, 
或是使用软件来录流, 
我们都能保证他们不能工作; 
那么要如何做呢? 
  
II. Setting up rtmpd server 
设置rtmpd服务器 

I am going to show this on a ready-made real live server so that this example could be  
more real for you, if i may say so. We will overwrite default playground application -  
flvplayback for simplicity. There are some parameters which we are interested to: 
我所举的例子会尽可能接近实际应用; 
为了简便,我们会要覆盖默认的播放应用--flvplayback; 
有一些参数需要先说明下: 


tcUrl   = contains value of what are you calling your application, like 
          包含了将要调用的应用的值,如:  
          rtmp:myhost/myapp 
swfUrl  = contains value of flash player absolute address, like  
          包含了flash播放器的绝对地址,如: 
          http://myhost/flowplayer/flowplayer.swf  
pageUrl = contains value of absolute address of page from where are you calling your app, like:  
          将要调用的应用的页面的绝对地址,如: 
          http://myhost/mypage.php 

AND 

parameter which we are interested very much: 
URI <parameter> = 
desired URI from one of above parameter like pageUrl and it is anything in the form of: 
schema: 
username:password@domain_or_ip/some/doc/path?and=some&more=parameters  

      schema can be http,rtmp,rtsp,etc 
      URi contains values like: 
      uri.fullUri; 
      uri.scheme; 
      uri.host; 
      uri.ip; 
      uri.port; 
      uri.userName; 
      uri.password; 
      uri.fullDocumentPath; 
      uri.documentPath; 
      uri.document; 
      uri.parameters; 
    
If you have multiple domains on same server or across several servers, from my point of view,  
it is better to choose uri.ip for validation, and this tutorial it is based on this. 
如果在同一台服务器上有多个域名,或者是多个服务器有多个域名, 以我的观点来看,  
最好是使用 uri.ip 来做验证, 
本教程就是这样做的; 

We are going to use some prerequests: 
下面是预先的环境设置:  
a. rtmpd dir:                /usr/local/ameeean  
b. media folder for testing: /usr/local/media/ 

download source code 
下载源码: 

ameeran / # cd /usr/local/ 
ameeran local # mail local # svn co --username anonymous  
https://svn.rtmpd.com/crtmpserver/branches/1.0 ameeran 
....... 
....... 
A    ameeran/constants 
A    ameeran/constants/constants.lua 
A    ameeran/README 
Checked out revision 294. 
ameeran local # 


adding proper code to some source files 
修改源文件 
To succed our goal we need to make some modification over ProcessInvokeConnect method  
so that we need to modify 2 files (did not take into account rtmpserver.lua):  
为了实现我们的目的,需要修改 ProcessInvokeConnect 这个成员函数; 
修改的源文件有: 

/usr/local/ameeran/sources/applications/flvplayback/include/rtmpappprotocolhandler.h 
/usr/local/ameeran/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp 

1. FIRST SCENARIO = both website and rtmpd server are hosted on the same machine 
第一种场景 = 页面和rtmpd都托管在同一台机器 

预设置 PREREQUEST: 
a. rtmpd public ip:      86.123.101.7  
b. webserver ip:         86.123.101.7 ( domain example: www.bfy.ro ) 
c. flash player address: http://www.bfy.ro/flowplayer/flowplayer-3.2.5.swf 
d. application name (alias for flvplayback): ameeran 
e. media folder:         /usr/local/media 

1. modify default rtmpappprotocolhandler.h like this: 
修改rtmpappprotocolhandler.h文件如下: 

show code 
/* 
 *  Copyright (c) 2010, 
 *  Gavriloaie Eugen-Andrei (shiretu@gmail.com) 
 * 
 *  This file is part of crtmpserver. 
 *  crtmpserver 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 3 of the License, or 
 *  (at your option) any later version. 
 * 
 *  crtmpserver 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. 
 * 
 *  You should have received a copy of the GNU General Public License 
 *  along with crtmpserver.  If not, see <http://www.gnu.org/licenses/>. 
 */ 
  
  
#ifdef HAS_PROTOCOL_RTMP 
#ifndef _RTMPAPPPROTOCOLHANDLER_H 
#define _RTMPAPPPROTOCOLHANDLER_H 
  
#include "protocols/rtmp/basertmpappprotocolhandler.h" 
  
namespace app_flvplayback { 


  class RTMPAppProtocolHandler 
  : public BaseRTMPAppProtocolHandler { 
  public: 
    RTMPAppProtocolHandler(Variant &configuration); 
    virtual ~RTMPAppProtocolHandler(); 
  
    virtual bool ProcessInvokeGeneric(BaseRTMPProtocol *pFrom, Variant &request); 
  
    virtual bool ProcessInvokeConnect(BaseRTMPProtocol *pFrom, Variant &request); 
  private: 
    bool ProcessGetAvailableFlvs(BaseRTMPProtocol *pFrom, Variant &request); 
    bool ProcessInsertMetadata(BaseRTMPProtocol *pFrom, Variant &request); 
  }; 

#endif  /* _RTMPAPPPROTOCOLHANDLER_H */ 
#endif /* HAS_PROTOCOL_RTMP */  


RAW file could be found here: http://pastebin.com/raw.php?i=ptrcWpyh 


2. modify default rtmpappprotocolhandler.cpp like this: 
修改文件rtmpappprotocolhandler.cpp如下: 


show code 
/* 
 *  Copyright (c) 2010, 
 *  Gavriloaie Eugen-Andrei (shiretu@gmail.com) 
 * 
 *  This file is part of crtmpserver. 
 *  crtmpserver 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 3 of the License, or 
 *  (at your option) any later version. 
 * 
 *  crtmpserver 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. 
 * 
 *  You should have received a copy of the GNU General Public License 
 *  along with crtmpserver.  If not, see <http://www.gnu.org/licenses/>. 
 */ 
  
  
#ifdef HAS_PROTOCOL_RTMP 
#include "rtmpappprotocolhandler.h" 
#include "protocols/rtmp/basertmpprotocol.h" 
#include "protocols/rtmp/messagefactories/messagefactories.h" 
#include "application/baseclientapplication.h" 
#include "streaming/baseinnetstream.h" 
#include "streaming/streamstypes.h" 
using namespace app_flvplayback; 
  
RTMPAppProtocolHandler::RTMPAppProtocolHandler(Variant &configuration) 
: BaseRTMPAppProtocolHandler(configuration) { 
  

  
RTMPAppProtocolHandler::~RTMPAppProtocolHandler() { 

  
bool RTMPAppProtocolHandler::ProcessInvokeGeneric(BaseRTMPProtocol *pFrom, 
  Variant &request) { 
  
  string functionName = M_INVOKE_FUNCTION(request); 
  if (functionName == "getAvailableFlvs") { 
    return ProcessGetAvailableFlvs(pFrom, request); 
  } else if (functionName == "insertMetadata") { 
    return ProcessInsertMetadata(pFrom, request); 
  } else { 
    return BaseRTMPAppProtocolHandler::ProcessInvokeGeneric(pFrom, request); 
  } 

  
bool RTMPAppProtocolHandler::ProcessGetAvailableFlvs(BaseRTMPProtocol *pFrom, Variant &request) { 
        Variant parameters; 
        parameters.PushToArray(Variant()); 
        parameters.PushToArray(Variant()); 
  
        vector<string> files; 
        if (!ListFolder(_configuration[CONF_APPLICATION_MEDIAFOLDER], files)) { 
                FATAL("Unable to list folder %s", 
                                STR(_configuration[CONF_APPLICATION_MEDIAFOLDER])); 
                return false; 
        } 
  
        string file, name, extension; 
  
        FOR_VECTOR_ITERATOR(string, files, i) { 
                file = VECTOR_VAL(i); 
  
                splitFileName(file, name, extension); 
                extension = lowercase(extension); 
  
                if (extension != MEDIA_TYPE_FLV 
                                && extension != MEDIA_TYPE_MP3 
                                && extension != MEDIA_TYPE_MP4 
                                && extension != MEDIA_TYPE_M4A 
                                && extension != MEDIA_TYPE_M4V 
                                && extension != MEDIA_TYPE_MOV 
                                && extension != MEDIA_TYPE_F4V 
                                && extension != MEDIA_TYPE_TS 
                                && extension != MEDIA_TYPE_MKV) 
                        continue; 
                string flashName = ""; 
                if (extension == MEDIA_TYPE_FLV) { 
                        flashName = name; 
                } else if (extension == MEDIA_TYPE_MP3) { 
                        flashName = extension + ":" + name; 
                } else { 
                        if (extension == MEDIA_TYPE_MP4 
                                        || extension == MEDIA_TYPE_M4A 
                                        || extension == MEDIA_TYPE_M4V 
                                        || extension == MEDIA_TYPE_MOV 
                                        || extension == MEDIA_TYPE_F4V) { 
                                flashName = MEDIA_TYPE_MP4":" + name + "." + extension; 
                        } else { 
                                flashName = extension + ":" + name + "." + extension; 
                        } 
                } 
  
  
                //        FINEST("Parsing `%s`", STR(flashName)); 
                //        Variant v = GetMetaData(flashName, true); 
                //        if (v != V_NULL) 
                parameters[(uint32_t) 1].PushToArray(flashName); 
        } 
  
        map<uint32_t, BaseStream *> allInboundStreams = 
                        GetApplication()->GetStreamsManager()->FindByType(ST_IN_NET, true); 
  
        FOR_MAP(allInboundStreams, uint32_t, BaseStream *, i) { 
                parameters[(uint32_t) 1].PushToArray(MAP_VAL(i)->GetName()); 
        } 
  
        Variant message = GenericMessageFactory::GetInvoke(3, 0, 0, false, 0, 
                        "SetAvailableFlvs", parameters); 
  
        return SendRTMPMessage(pFrom, message); 

  
bool RTMPAppProtocolHandler::ProcessInvokeConnect(BaseRTMPProtocol *pFrom, 
               Variant &request) { 
       //0. Dump the request on console, just to see its structure 
       FINEST("Initial request: %s", STR(request.ToString())); 
  
       //1. Get the connect params from the connect invoke 
       Variant connectParams = M_INVOKE_PARAM(request, 0); 
  
       //2. This should be a key-value map 
       if (connectParams != V_MAP) { 
               FATAL("Incorrect invoke params: %s", STR(request.ToString())); 
               return false; 
       } 
  
        //3. Let's extract few values. Make sure we extract them using non-case-sensitive keys 
        Variant tcUrl = connectParams.GetValue(RM_INVOKE_PARAMS_CONNECT_TCURL, false); 
  
        //If you are sure about case-sensitive settings, you can extract it directly like this 
        Variant swfUrl = connectParams[RM_INVOKE_PARAMS_CONNECT_SWFURL]; 
        //Variant tcUrl = connectParams[RM_INVOKE_PARAMS_CONNECT_TCURL]; 
        Variant pageUrl = connectParams[RM_INVOKE_PARAMS_CONNECT_PAGEURL]; 
  
  
        //4. Do some validation on them. 
  
        if (pageUrl != V_STRING) { 
               FATAL("Incorrect "RM_INVOKE_PARAMS_CONNECT_PAGEURL": %s", STR(request.ToString())); 
                return false; 
        } 
  
        if (tcUrl != V_STRING) { 
                FATAL("Incorrect "RM_INVOKE_PARAMS_CONNECT_TCURL": %s", STR(request.ToString())); 
                return false; 
        } 
  
        string rawURI; 
        URI uri; 
        if (!URI::FromString(pageUrl, true, uri)) { 
                FATAL("Unable to parse the uri %s", STR(rawURI)); 
                return false; 
        } 
        // as proto we are going to validate rtmp/rtmpe - media.bfy.ro=86.123.101.7 
        if (((string) tcUrl) != "rtmp://media.bfy.ro/ameeran") { 
              if (((string) tcUrl) != "rtmpe://media.bfy.ro/ameeran") { 
                FATAL("Incorrect "RM_INVOKE_PARAMS_CONNECT_TCURL": %s", STR(request.ToString())); 
                return false; 
         } 
        } 
        // we use our static flowplayer which is always on the same address 
        if (((string) swfUrl) != "http://www.bfy.ro/flowplayer/flowplayer-3.2.5.swf") { 
               FATAL("Incorrect "RM_INVOKE_PARAMS_CONNECT_SWFURL": %s", STR(request.ToString())); 
                return false; 
        } 
        // ip which resolve our calling webpage(s)/website(s) 
        if (((string) uri.ip) != "86.123.101.7") { 
                FATAL("Incorrect "RM_INVOKE_PARAMS_CONNECT_PAGEURL": %s", STR(request.ToString())); 
                 return false; 
        } 
  
        //TODO: continue here 
  
       //5. If everything looks right, continue default processing :) 
       return BaseRTMPAppProtocolHandler::ProcessInvokeConnect(pFrom, request); 

  
bool RTMPAppProtocolHandler::ProcessInsertMetadata(BaseRTMPProtocol *pFrom, Variant &request) { 
        //STREAMING REFACTORING 
        //    //FINEST("request: %s", STR(request.ToString())); 
        // 
        //    //1. Get the stream name 
        //    if ((VariantType) M_INVOKE_PARAM(request, 1) != V_STRING) 
        //        return true; 
        //    string streamName = M_INVOKE_PARAM(request, 1); 
        // 
        //    //2. Get the stream 
        //    vector<BaseOutboundStream *> streams = FindOSByName(streamName); 
        //    BaseInboundStream *pInboundStream = NULL; 
        // 
        //    FOR_VECTOR(streams, i) { 
        //        if (streams[i]->GetProtocol()->GetId() == pFrom->GetId()) { 
        //            pInboundStream = streams[i]->GetInboundStream(); 
        //            break; 
        //        } 
        //    } 
        //    if (pInboundStream == NULL) { 
        //        FINEST("This stream is not yet bound"); 
        //        return true; 
        //    } 
        //    if (pInboundStream->IsEnqueueForDelete()) { 
        //        FINEST("This stream will be deleted soon"); 
        //        return true; 
        //    } 
        // 
        //    //3. Prepare the FlexStreamSend message 
        //    Variant params; 
        //    params.PushToArray(M_INVOKE_PARAM(request, 2)); 
        //    return pInboundStream->SendStreamMessage("onMetaData", params); 
        NYIR; 

#endif /* HAS_PROTOCOL_RTMP */ 

raw file could be found here: http://pastebin.com/raw.php?i=mUFevs6g 

3. a very simple rtmpserver.lua config file only for flv/mp4 streaming based  
only for flvplayback app: 
下面的相应的一个lua文件,仅用于实现flv/mp4流: 

show code 
-- Start of the configuration. This is the only node in the config file. 
-- The rest of them are sub-nodes 
configuration= 

  -- if true, the server will run as a daemon. 
  -- NOTE: all console appenders will be ignored if this is a daemon 
  daemon=false, 
  -- the OS's path separator. Used in composing paths 
  pathSeparator="/", 
  -- this is the async DNS resolver. This is a "clinet" connection 
  -- to the server. 
  dnsResolver= 
  { 
    -- the DNS resolver will connect to ip:port. 
    -- Whe a request of resolving a domain is made, instead of 
    -- using gethostbyname, we will pass that request to ip:port 
    -- This way, the request is async. Of course, it can be looped back 
    ip="127.0.0.1", 
    port=9311, 
    acceptors = 
    { 
      { 
        ip="0.0.0.0", 
        port=9311, 
        protocol="inboundDns" 
      }, 
    } 
  }, 
  -- this is the place where all the logging facilities are setted up 
  -- you can add/remove any number of locations 
  logAppenders= 
  { 
    { 
       -- name of the appender. Not too important, but is mandatory 
       name="console appender", 
       -- type of the appender. We can have the following values: 
       -- console, coloredConsole and file 
       -- NOTE: console appenders will be ignored if we run the server 
       -- as a daemon 
       type="coloredConsole", 
       -- the level of logging. 6 is the FINEST message, 0 is FATAL message. 
       -- The appender will "catch" all the messages below or equal to this level 
       -- bigger the level, more messages are recorded 
       level=6 
    }, 
    { 
       name="file appender", 
       type="file", 
       level=6, 
       -- the file where the log messages are going to land 
       fileName="/tmp/rtmpserver.log" 
    } 
  }, 
  
  -- this node holds all the RTMP applications 
  applications= 
  { 
    -- this is the root directory of all applications 
    -- usually this is relative to the binary execuable 
    rootDirectory="applications", 
  
    --this is where the applications array starts 
    { 
      -- The name of the application. It is mandatory and must be unique 
      name="appselector", 
      -- Short description of the application. Optional 
      description="Application for selecting the rest of the applications", 
  
      -- The type of the application. Possible values are: 
      -- dynamiclinklibrary - the application is a shared library 
      protocol="dynamiclinklibrary", 
      -- the complete path to the library. This is optional. If not provided, 
      -- the server will try to load the library from here 
      -- <rootDirectory>/<name>/lib<name>.{so|dll|dylib} 
      -- library="/some/path/to/some/shared/library.so" 
  
      -- Tells the server to validate the clien's handshake before going further. 
      -- It is optional, defaulted to true 
      validateHandshake=true, 
      -- this is the folder from where the current application gets it's content. 
      -- It is optional. If not specified, it will be defaulted to: 
      -- <rootDirectory>/<name>/mediaFolder 
      -- mediaFolder="/some/directory/where/media/files/are/stored" 
      -- the application will also be known by that names. It is optional 
      --aliases= 
      --{ 
      --      "simpleLive", 
      --      "vod", 
      --      "live", 
      --}, 
      -- This flag designates the default application. The default application 
      -- is responsable of analyzing the "connect" request and distribute 
      -- the future connection to the correct application. 
      default=true, 
      acceptors = 
      { 
        { 
          ip="0.0.0.0", 
          port=1935, 
          protocol="inboundRtmp" 
        }, 
        { 
          ip="0.0.0.0", 
          port=8081, 
          protocol="inboundRtmps", 
          sslKey="server.key", 
          sslCert="server.crt" 
        }, 
        { 
          ip="0.0.0.0", 
          port=8080, 
          protocol="inboundRtmpt" 
        }, 
      } 
    }, 
    { 
      description="FLV Playback Sample", 
      name="flvplayback", 
      protocol="dynamiclinklibrary", 
      mediaFolder="/usr/local/media", 
      aliases= 
      { 
        "vod", 
        "live", 
        "ameeran", 
      }, 
      acceptors = 
      { 
        { 
          ip="0.0.0.0", 
          port=1935, 
          protocol="inboundRtmfp" 
        }, 
  
        { 
          ip="0.0.0.0", 
          port=6666, 
          protocol="inboundLiveFlv", 
          waitForMetadata=true, 
        }, 
        { 
          ip="0.0.0.0", 
          port=9999, 
          protocol="inboundTcpTs" 
        }, 
      }, 
      externalStreams = 
      { 
      }, 
      validateHandshake=true, 
      keyframeSeek=true, 
      seekGranularity=60, --in seconds, between 0.1 and 600 
      clientSideBuffer=12, --in seconds, between 5 and 30 
      --generateMetaFiles=true, --this will generate seek/meta files on application startup 
      --authentication= 
      --{ 
      --      type="adobe", 
      --      encoderAgents= 
      --      { 
      --              "FMLE/3.0 (compatible; FMSc/1.0)", 
      --              "my 3rd party encoder", 
      --              "some other encoder", 
      --      } 
      --      --usersFile="users.lua", 
      --} 
    }, 
    { 
      name="admin", 
      description="Application for administering", 
      protocol="dynamiclinklibrary", 
      aliases= 
      { 
        "ameeran_admin", 
      }, 
      acceptors = 
      { 
        { 
          ip="0.0.0.0", 
          port=1112, 
          protocol="inboundJsonCli", 
          useLengthPadding=true 
  
        }, 
      } 
      --validateHandshake=true, 
      --default=true, 
    }, 
    --#INSERTION_MARKER# DO NOT REMOVE THIS. USED BY appscaffold SCRIPT. 
  } 


4. Compiling and making rtmpd 
编译并生成rtmpd 


show code 
ameeran / # cd /usr/local/ameeran/builders/cmake/ 
ameeran cmake # cmake . 
-- The C compiler identification is GNU 
-- The CXX compiler identification is GNU 
-- Check for working C compiler: /usr/bin/gcc 
-- Check for working C compiler: /usr/bin/gcc -- works 
-- Detecting C compiler ABI info 
-- Detecting C compiler ABI info - done 
-- Check for working CXX compiler: /usr/bin/c++ 
-- Check for working CXX compiler: /usr/bin/c++ -- works 
-- Detecting CXX compiler ABI info 
-- Detecting CXX compiler ABI info - done 
-- Looking for openssl headers - found 
-- Looking for openssl library - found 
-- Looking for crypto library - found 
-- Looking for dl 
-- Looking for libdl headers - found 
-- Looking for libdl library - found 
-- We have support for precompiled headers 
-- Check if the system is big endian 
-- Searching 16 bit integer 
-- Looking for sys/types.h 
-- Looking for sys/types.h - found 
-- Looking for stdint.h 
-- Looking for stdint.h - found 
-- Looking for stddef.h 
-- Looking for stddef.h - found 
-- Check size of unsigned short 
-- Check size of unsigned short - done 
-- Using unsigned short 
-- Check if the system is big endian - little endian 
-- We have a Linux-2.6.32-gentoo-r7 system 
-- Defines are in place 
-- Configuring done 
-- Generating done 
-- Build files have been written to: /usr/local/ameeran/builders/cmake 
ameeran cmake # make 
..... 
..... 
Linking CXX shared library libthelib.so 
[ 76%] Built target thelib 
Scanning dependencies of target rtmpserver 
[ 76%] Building CXX object rtmpserver/CMakeFiles/rtmpserver.dir/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp.o 
Linking CXX executable rtmpserver 
[ 76%] Built target rtmpserver 
Scanning dependencies of target flvplayback 
[ 77%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/rtspappprotocolhandler.cpp.o 
[ 77%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/rtpappprotocolhandler.cpp.o 
[ 77%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp.o 
[ 78%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/liveflvappprotocolhandler.cpp.o 
[ 78%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/tsappprotocolhandler.cpp.o 
[ 78%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/rtmfpappprotocolhandler.cpp.o 
[ 79%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/flvplaybackapplication.cpp.o 
[ 79%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/flvplayback.cpp.o 
Linking CXX shared library libflvplayback.so 
[ 79%] Built target flvplayback 
Scanning dependencies of target appselector 
[ 79%] Building CXX object applications/appselector/CMakeFiles/appselector.dir/usr/local/ameeran/sources/applications/appselector/src/appselector.cpp.o 
[ 79%] Building CXX object applications/appselector/CMakeFiles/appselector.dir/usr/local/ameeran/sources/applications/appselector/src/rtmpappprotocolhandler.cpp.o 
[ 80%] Building CXX object applications/appselector/CMakeFiles/appselector.dir/usr/local/ameeran/sources/applications/appselector/src/httpappprotocolhandler.cpp.o 
[ 80%] Building CXX object applications/appselector/CMakeFiles/appselector.dir/usr/local/ameeran/sources/applications/appselector/src/appselectorapplication.cpp.o 
Linking CXX shared library libappselector.so 
[ 80%] Built target appselector 
Scanning dependencies of target samplefactory 
[ 80%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/dbaccessprotocolhandler.cpp.o 
[ 81%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/samplefactory.cpp.o 
[ 81%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/rtmpappprotocolhandler.cpp.o 
[ 81%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/dbaccessprotocol.cpp.o 
[ 82%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/samplefactoryapplication.cpp.o 
[ 82%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/controller.cpp.o 
[ 82%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/protocolfactory.cpp.o 
Linking CXX shared library libsamplefactory.so 
[ 82%] Built target samplefactory 
Scanning dependencies of target vptests 
[ 83%] Building CXX object applications/vptests/CMakeFiles/vptests.dir/usr/local/ameeran/sources/applications/vptests/src/variantappprotocolhandler.cpp.o 
[ 83%] Building CXX object applications/vptests/CMakeFiles/vptests.dir/usr/local/ameeran/sources/applications/vptests/src/rtmpappprotocolhandler.cpp.o 
[ 83%] Building CXX object applications/vptests/CMakeFiles/vptests.dir/usr/local/ameeran/sources/applications/vptests/src/vptests.cpp.o 
[ 84%] Building CXX object applications/vptests/CMakeFiles/vptests.dir/usr/local/ameeran/sources/applications/vptests/src/vptestsapplication.cpp.o 
Linking CXX shared library libvptests.so 
[ 84%] Built target vptests 
Scanning dependencies of target admin 
[ 84%] Building CXX object applications/admin/CMakeFiles/admin.dir/usr/local/ameeran/sources/applications/admin/src/adminapplication.cpp.o 
[ 84%] Building CXX object applications/admin/CMakeFiles/admin.dir/usr/local/ameeran/sources/applications/admin/src/rtmpappprotocolhandler.cpp.o 
[ 84%] Building CXX object applications/admin/CMakeFiles/admin.dir/usr/local/ameeran/sources/applications/admin/src/cliappprotocolhandler.cpp.o 
[ 85%] Building CXX object applications/admin/CMakeFiles/admin.dir/usr/local/ameeran/sources/applications/admin/src/admin.cpp.o 
Linking CXX shared library libadmin.so 
[ 85%] Built target admin 
Scanning dependencies of target proxypublish 
[ 85%] Building CXX object applications/proxypublish/CMakeFiles/proxypublish.dir/usr/local/ameeran/sources/applications/proxypublish/src/rtspappprotocolhandler.cpp.o 
[ 85%] Building CXX object applications/proxypublish/CMakeFiles/proxypublish.dir/usr/local/ameeran/sources/applications/proxypublish/src/rtpappprotocolhandler.cpp.o 
[ 86%] Building CXX object applications/proxypublish/CMakeFiles/proxypublish.dir/usr/local/ameeran/sources/applications/proxypublish/src/rtmpappprotocolhandler.cpp.o 
[ 86%] Building CXX object applications/proxypublish/CMakeFiles/proxypublish.dir/usr/local/ameeran/sources/applications/proxypublish/src/liveflvappprotocolhandler.cpp.o 
[ 86%] Building CXX object applications/proxypublish/CMakeFiles/proxypublish.dir/usr/local/ameeran/sources/applications/proxypublish/src/proxypublishapplication.cpp.o 
[ 87%] Building CXX object applications/proxypublish/CMakeFiles/proxypublish.dir/usr/local/ameeran/sources/applications/proxypublish/src/proxypublish.cpp.o 
Linking CXX shared library libproxypublish.so 
[ 87%] Built target proxypublish 
Scanning dependencies of target stresstest 
[ 88%] Building CXX object applications/stresstest/CMakeFiles/stresstest.dir/usr/local/ameeran/sources/applications/stresstest/src/rtmpappprotocolhandler.cpp.o 
[ 88%] Building CXX object applications/stresstest/CMakeFiles/stresstest.dir/usr/local/ameeran/sources/applications/stresstest/src/stresstestapplication.cpp.o 
[ 88%] Building CXX object applications/stresstest/CMakeFiles/stresstest.dir/usr/local/ameeran/sources/applications/stresstest/src/stresstest.cpp.o 
Linking CXX shared library libstresstest.so 
[ 88%] Built target stresstest 
Scanning dependencies of target applestreamingclient 
[ 88%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/applestreamingclientapplication.cpp.o 
[ 88%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/applestreamingclient.cpp.o 
[ 89%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/eventsink/varianteventsink.cpp.o 
[ 89%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/eventsink/rtmpeventsink.cpp.o 
[ 89%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/eventsink/baseeventsink.cpp.o 
[ 90%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/jnihelpers.cpp.o 
[ 90%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/rtp/rtspappprotocolhandler.cpp.o 
[ 90%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/rtmp/rtmpappprotocolhandler.cpp.o 
[ 91%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/genericprotocol.cpp.o 
[ 91%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/key/inboundkeyprotocol.cpp.o 
[ 91%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/key/keyappprotocolhandler.cpp.o 
[ 92%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/ts/tsappprotocolhandler.cpp.o 
[ 92%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/httpbuff/httpbuffappprotocolhandler.cpp.o 
[ 92%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/httpbuff/httpbufferprotocol.cpp.o 
[ 93%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/timer/scheduletimerprotocol.cpp.o 
[ 93%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/timer/finetimer.cpp.o 
[ 93%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/aes/inboundaesprotocol.cpp.o 
[ 94%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/aes/aesappprotocolhandler.cpp.o 
[ 94%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/variant/variantappprotocolhandler.cpp.o 
[ 94%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/protocolfactory.cpp.o 
[ 95%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/m3u8/basem3u8protocol.cpp.o 
[ 95%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/m3u8/childm3u8protocol.cpp.o 
[ 95%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/m3u8/m3u8appprotocolhandler.cpp.o 
[ 96%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/m3u8/masterm3u8protocol.cpp.o 
[ 96%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/clientcontext.cpp.o 
[ 96%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/playlist.cpp.o 
[ 97%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/speedcomputer.cpp.o 
Linking CXX shared library libapplestreamingclient.so 
[ 97%] Built target applestreamingclient 
Scanning dependencies of target vm 
[ 97%] Building CXX object vm/CMakeFiles/vm.dir/usr/local/ameeran/sources/vm/src/vmlua/basevmlua.cpp.o 
[ 98%] Building CXX object vm/CMakeFiles/vm.dir/usr/local/ameeran/sources/vm/src/basevm.cpp.o 
Linking CXX shared library libvm.so 
[ 98%] Built target vm 
Scanning dependencies of target vmtests 
[ 98%] Building CXX object vmtests/CMakeFiles/vmtests.dir/usr/local/ameeran/sources/vmtests/src/testvmlua.cpp.o 
[ 98%] Building CXX object vmtests/CMakeFiles/vmtests.dir/usr/local/ameeran/sources/vmtests/src/main.cpp.o 
Linking CXX executable vmtests 
[ 98%] Built target vmtests 
Scanning dependencies of target tests 
[ 99%] Building CXX object tests/CMakeFiles/tests.dir/usr/local/ameeran/sources/tests/src/commontestssuite.cpp.o 
[ 99%] Building CXX object tests/CMakeFiles/tests.dir/usr/local/ameeran/sources/tests/src/thelibtestssuite.cpp.o 
[ 99%] Building CXX object tests/CMakeFiles/tests.dir/usr/local/ameeran/sources/tests/src/varianttestssuite.cpp.o 
[ 99%] Building CXX object tests/CMakeFiles/tests.dir/usr/local/ameeran/sources/tests/src/basetestssuite.cpp.o 
[100%] Building CXX object tests/CMakeFiles/tests.dir/usr/local/ameeran/sources/tests/src/main.cpp.o 
Linking CXX executable tests 
[100%] Built target tests 
ameeran cmake #  


5. starting up 
启动rtmpd 


show code 
ameeran cmake #./rtmpserver/rtmpserver ./rtmpserver/rtmpserver.lua 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:168 Plug in the default protocol factory 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:175 Initialize I/O handlers manager: epoll 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:178 Initialize DNS resolver 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 0->1 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 1->2 IOHT_TCP_CONNECTOR 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:184 Initialize applications 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 2->3 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 3->4 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 4->5 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/configuration/configfile.cpp:787 Application "appselector" is up and running 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 5->6 IOHT_UDP_CARRIER 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 6->7 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 7->8 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/configuration/configfile.cpp:787 Application "flvplayback" (vod,live,ameeran) is up and running 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 8->9 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/configuration/configfile.cpp:787 Application "admin" (ameeran_admin) is up and running 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:190 Install the quit signal 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:193 Install the conf re-read signal 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:200 
+-----------------------------------------------------------------------------+ 
|                                                                     Services| 
+---+---------------+-----+-------------------------+-------------------------+ 
| c |      ip       | port|   protocol stack name   |     application name    | 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 9311|               inboundDns|                   #none#| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 1935|              inboundRtmp|              appselector| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 8081|             inboundRtmps|              appselector| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 8080|             inboundRtmpt|              appselector| 
+---+---------------+-----+-------------------------+-------------------------+ 
|udp|        0.0.0.0| 1935|             inboundRtmfp|              flvplayback| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 6666|           inboundLiveFlv|              flvplayback| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 9999|             inboundTcpTs|              flvplayback| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 1112|           inboundJsonCli|                    admin| 
+---+---------------+-----+-------------------------+-------------------------+ 


/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:201 GO! GO! GO! (22807) 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 9->10 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/netio/epoll/tcpacceptor.cpp:134 Client connected: 127.0.0.1:53720 -> 0.0.0.0:9311 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 10->11 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:105 Handlers count changed: 11->10 IOHT_TCP_CONNECTOR 


2. SECOND SCENARIO = both website and rtmpd server are hosted on the different machines  
on a different subnets 
第二种场景 = 页面和rtmpd托管在不同子网的不同机器上 


预设置 PREREQUEST: 
a. rtmpd public ip:        86.123.101.7  
b. webserver ip:           86.122.125.158 ( domain example: www.a-queens.ro ) 
c. flash player address:   http://www.a-queens.ro/flowplayer/flowplayer-3.2.5.swf 
d. application name (alias for flvplayback): ameeran 
e. media folder:           /usr/local/media 


1. rtmpappprotocolhandler.h file remains the same as in FIRST SCENARIO  
   rtmpappprotocolhandler.h和第一种场景的相同 
2. modify default rtmpappprotocolhandler.cpp like this:  
   修改rtmpappprotocolhandler.cpp如下: 


show code 
/* 
 *  Copyright (c) 2010, 
 *  Gavriloaie Eugen-Andrei (shiretu@gmail.com) 
 * 
 *  This file is part of crtmpserver. 
 *  crtmpserver 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 3 of the License, or 
 *  (at your option) any later version. 
 * 
 *  crtmpserver 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. 
 * 
 *  You should have received a copy of the GNU General Public License 
 *  along with crtmpserver.  If not, see <http://www.gnu.org/licenses/>. 
 */ 
  
  
#ifdef HAS_PROTOCOL_RTMP 
#include "rtmpappprotocolhandler.h" 
#include "protocols/rtmp/basertmpprotocol.h" 
#include "protocols/rtmp/messagefactories/messagefactories.h" 
#include "application/baseclientapplication.h" 
#include "streaming/baseinnetstream.h" 
#include "streaming/streamstypes.h" 
using namespace app_flvplayback; 
  
RTMPAppProtocolHandler::RTMPAppProtocolHandler(Variant &configuration) 
: BaseRTMPAppProtocolHandler(configuration) { 
  

  
RTMPAppProtocolHandler::~RTMPAppProtocolHandler() { 

  
bool RTMPAppProtocolHandler::ProcessInvokeGeneric(BaseRTMPProtocol *pFrom, 
                Variant &request) { 
  
        string functionName = M_INVOKE_FUNCTION(request); 
        if (functionName == "getAvailableFlvs") { 
                return ProcessGetAvailableFlvs(pFrom, request); 
        } else if (functionName == "insertMetadata") { 
                return ProcessInsertMetadata(pFrom, request); 
        } else { 
                return BaseRTMPAppProtocolHandler::ProcessInvokeGeneric(pFrom, request); 
        } 

  
bool RTMPAppProtocolHandler::ProcessGetAvailableFlvs(BaseRTMPProtocol *pFrom, Variant &request) { 
        Variant parameters; 
        parameters.PushToArray(Variant()); 
        parameters.PushToArray(Variant()); 
  
        vector<string> files; 
        if (!ListFolder(_configuration[CONF_APPLICATION_MEDIAFOLDER], files)) { 
                FATAL("Unable to list folder %s", 
                                STR(_configuration[CONF_APPLICATION_MEDIAFOLDER])); 
                return false; 
        } 
  
        string file, name, extension; 
  
        FOR_VECTOR_ITERATOR(string, files, i) { 
                file = VECTOR_VAL(i); 
  
                splitFileName(file, name, extension); 
                extension = lowercase(extension); 
  
                if (extension != MEDIA_TYPE_FLV 
                                && extension != MEDIA_TYPE_MP3 
                                && extension != MEDIA_TYPE_MP4 
                                && extension != MEDIA_TYPE_M4A 
                                && extension != MEDIA_TYPE_M4V 
                                && extension != MEDIA_TYPE_MOV 
                                && extension != MEDIA_TYPE_F4V 
                                && extension != MEDIA_TYPE_TS 
                                && extension != MEDIA_TYPE_MKV) 
                        continue; 
                string flashName = ""; 
                if (extension == MEDIA_TYPE_FLV) { 
                        flashName = name; 
                } else if (extension == MEDIA_TYPE_MP3) { 
                        flashName = extension + ":" + name; 
                } else { 
                        if (extension == MEDIA_TYPE_MP4 
                                        || extension == MEDIA_TYPE_M4A 
                                        || extension == MEDIA_TYPE_M4V 
                                        || extension == MEDIA_TYPE_MOV 
                                        || extension == MEDIA_TYPE_F4V) { 
                                flashName = MEDIA_TYPE_MP4":" + name + "." + extension; 
                        } else { 
                                flashName = extension + ":" + name + "." + extension; 
                        } 
                } 
  
  
                //        FINEST("Parsing `%s`", STR(flashName)); 
                //        Variant v = GetMetaData(flashName, true); 
                //        if (v != V_NULL) 
                parameters[(uint32_t) 1].PushToArray(flashName); 
        } 
  
        map<uint32_t, BaseStream *> allInboundStreams = 
                        GetApplication()->GetStreamsManager()->FindByType(ST_IN_NET, true); 
  
        FOR_MAP(allInboundStreams, uint32_t, BaseStream *, i) { 
                parameters[(uint32_t) 1].PushToArray(MAP_VAL(i)->GetName()); 
        } 
  
        Variant message = GenericMessageFactory::GetInvoke(3, 0, 0, false, 0, 
                        "SetAvailableFlvs", parameters); 
  
        return SendRTMPMessage(pFrom, message); 

  
bool RTMPAppProtocolHandler::ProcessInvokeConnect(BaseRTMPProtocol *pFrom, 
               Variant &request) { 
       //0. Dump the request on console, just to see its structure 
       FINEST("Initial request: %s", STR(request.ToString())); 
  
       //1. Get the connect params from the connect invoke 
       Variant connectParams = M_INVOKE_PARAM(request, 0); 
  
       //2. This should be a key-value map 
       if (connectParams != V_MAP) { 
               FATAL("Incorrect invoke params: %s", STR(request.ToString())); 
               return false; 
       } 
  
        //3. Let's extract few values. Make sure we extract them using non-case-sensitive keys 
        Variant tcUrl = connectParams.GetValue(RM_INVOKE_PARAMS_CONNECT_TCURL, false); 
  
        //If you are sure about case-sensitive settings, you can extract it directly like this 
        Variant swfUrl = connectParams[RM_INVOKE_PARAMS_CONNECT_SWFURL]; 
        //Variant tcUrl = connectParams[RM_INVOKE_PARAMS_CONNECT_TCURL]; 
        Variant pageUrl = connectParams[RM_INVOKE_PARAMS_CONNECT_PAGEURL]; 
  
  
        //4. Do some validation on them. 
  
        if (pageUrl != V_STRING) { 
               FATAL("Incorrect "RM_INVOKE_PARAMS_CONNECT_PAGEURL": %s", STR(request.ToString())); 
                return false; 
        } 
  
        if (tcUrl != V_STRING) { 
                FATAL("Incorrect "RM_INVOKE_PARAMS_CONNECT_TCURL": %s", STR(request.ToString())); 
                return false; 
        } 
  
        string rawURI; 
        URI uri; 
        if (!URI::FromString(pageUrl, true, uri)) { 
                FATAL("Unable to parse the uri %s", STR(rawURI)); 
                return false; 
        } 
        // as proto we are going to validate rtmp/rtmpe - media.bfy.ro=86.123.101.7 
        if (((string) tcUrl) != "rtmp://media.bfy.ro/ameeran") { 
              if (((string) tcUrl) != "rtmpe://media.bfy.ro/ameeran") { 
                FATAL("Incorrect "RM_INVOKE_PARAMS_CONNECT_TCURL": %s", STR(request.ToString())); 
                return false; 
         } 
        } 
        // we use our static flowplayer which is always on the same address 
        if (((string) swfUrl) != "http://www.a-queens.ro/flowplayer/flowplayer-3.2.5.swf") { 
               FATAL("Incorrect "RM_INVOKE_PARAMS_CONNECT_SWFURL": %s", STR(request.ToString())); 
                return false; 
        } 
        // ip which resolve our calling webpage(s)/website(s) 
        if (((string) uri.ip) != "86.122.125.158") { 
                FATAL("Incorrect "RM_INVOKE_PARAMS_CONNECT_PAGEURL": %s", STR(request.ToString())); 
                 return false; 
        } 
  
        //TODO: continue here 
  
       //5. If everything looks right, continue default processing :) 
       return BaseRTMPAppProtocolHandler::ProcessInvokeConnect(pFrom, request); 

  
bool RTMPAppProtocolHandler::ProcessInsertMetadata(BaseRTMPProtocol *pFrom, Variant &request) { 
        //STREAMING REFACTORING 
        //    //FINEST("request: %s", STR(request.ToString())); 
        // 
        //    //1. Get the stream name 
        //    if ((VariantType) M_INVOKE_PARAM(request, 1) != V_STRING) 
        //        return true; 
        //    string streamName = M_INVOKE_PARAM(request, 1); 
        // 
        //    //2. Get the stream 
        //    vector<BaseOutboundStream *> streams = FindOSByName(streamName); 
        //    BaseInboundStream *pInboundStream = NULL; 
        // 
        //    FOR_VECTOR(streams, i) { 
        //        if (streams[i]->GetProtocol()->GetId() == pFrom->GetId()) { 
        //            pInboundStream = streams[i]->GetInboundStream(); 
        //            break; 
        //        } 
        //    } 
        //    if (pInboundStream == NULL) { 
        //        FINEST("This stream is not yet bound"); 
        //        return true; 
        //    } 
        //    if (pInboundStream->IsEnqueueForDelete()) { 
        //        FINEST("This stream will be deleted soon"); 
        //        return true; 
        //    } 
        // 
        //    //3. Prepare the FlexStreamSend message 
        //    Variant params; 
        //    params.PushToArray(M_INVOKE_PARAM(request, 2)); 
        //    return pInboundStream->SendStreamMessage("onMetaData", params); 
        NYIR; 

#endif /* HAS_PROTOCOL_RTMP */ 


RAW file could be found here: http://pastebin.com/raw.php?i=DwwVm7vV 


3. rtmpserver.lua file remains the same as in FIRST SCENARIO  
   rtmpserver.lua文件和第一种场景的相同 
4. Compiling and making rtmpd 
   编译和生成rtmpd 


show code 
ameeran / # cd /usr/local/ameeran/builders/cmake/ 
ameeran cmake # cmake . 
-- The C compiler identification is GNU 
-- The CXX compiler identification is GNU 
-- Check for working C compiler: /usr/bin/gcc 
-- Check for working C compiler: /usr/bin/gcc -- works 
-- Detecting C compiler ABI info 
-- Detecting C compiler ABI info - done 
-- Check for working CXX compiler: /usr/bin/c++ 
-- Check for working CXX compiler: /usr/bin/c++ -- works 
-- Detecting CXX compiler ABI info 
-- Detecting CXX compiler ABI info - done 
-- Looking for openssl headers - found 
-- Looking for openssl library - found 
-- Looking for crypto library - found 
-- Looking for dl 
-- Looking for libdl headers - found 
-- Looking for libdl library - found 
-- We have support for precompiled headers 
-- Check if the system is big endian 
-- Searching 16 bit integer 
-- Looking for sys/types.h 
-- Looking for sys/types.h - found 
-- Looking for stdint.h 
-- Looking for stdint.h - found 
-- Looking for stddef.h 
-- Looking for stddef.h - found 
-- Check size of unsigned short 
-- Check size of unsigned short - done 
-- Using unsigned short 
-- Check if the system is big endian - little endian 
-- We have a Linux-2.6.32-gentoo-r7 system 
-- Defines are in place 
-- Configuring done 
-- Generating done 
-- Build files have been written to: /usr/local/ameeran/builders/cmake 
ameeran cmake # make 
..... 
..... 
Linking CXX shared library libthelib.so 
[ 76%] Built target thelib 
Scanning dependencies of target rtmpserver 
[ 76%] Building CXX object rtmpserver/CMakeFiles/rtmpserver.dir/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp.o 
Linking CXX executable rtmpserver 
[ 76%] Built target rtmpserver 
Scanning dependencies of target flvplayback 
[ 77%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/rtspappprotocolhandler.cpp.o 
[ 77%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/rtpappprotocolhandler.cpp.o 
[ 77%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp.o 
[ 78%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/liveflvappprotocolhandler.cpp.o 
[ 78%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/tsappprotocolhandler.cpp.o 
[ 78%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/rtmfpappprotocolhandler.cpp.o 
[ 79%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/flvplaybackapplication.cpp.o 
[ 79%] Building CXX object applications/flvplayback/CMakeFiles/flvplayback.dir/usr/local/ameeran/sources/applications/flvplayback/src/flvplayback.cpp.o 
Linking CXX shared library libflvplayback.so 
[ 79%] Built target flvplayback 
Scanning dependencies of target appselector 
[ 79%] Building CXX object applications/appselector/CMakeFiles/appselector.dir/usr/local/ameeran/sources/applications/appselector/src/appselector.cpp.o 
[ 79%] Building CXX object applications/appselector/CMakeFiles/appselector.dir/usr/local/ameeran/sources/applications/appselector/src/rtmpappprotocolhandler.cpp.o 
[ 80%] Building CXX object applications/appselector/CMakeFiles/appselector.dir/usr/local/ameeran/sources/applications/appselector/src/httpappprotocolhandler.cpp.o 
[ 80%] Building CXX object applications/appselector/CMakeFiles/appselector.dir/usr/local/ameeran/sources/applications/appselector/src/appselectorapplication.cpp.o 
Linking CXX shared library libappselector.so 
[ 80%] Built target appselector 
Scanning dependencies of target samplefactory 
[ 80%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/dbaccessprotocolhandler.cpp.o 
[ 81%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/samplefactory.cpp.o 
[ 81%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/rtmpappprotocolhandler.cpp.o 
[ 81%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/dbaccessprotocol.cpp.o 
[ 82%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/samplefactoryapplication.cpp.o 
[ 82%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/controller.cpp.o 
[ 82%] Building CXX object applications/samplefactory/CMakeFiles/samplefactory.dir/usr/local/ameeran/sources/applications/samplefactory/src/protocolfactory.cpp.o 
Linking CXX shared library libsamplefactory.so 
[ 82%] Built target samplefactory 
Scanning dependencies of target vptests 
[ 83%] Building CXX object applications/vptests/CMakeFiles/vptests.dir/usr/local/ameeran/sources/applications/vptests/src/variantappprotocolhandler.cpp.o 
[ 83%] Building CXX object applications/vptests/CMakeFiles/vptests.dir/usr/local/ameeran/sources/applications/vptests/src/rtmpappprotocolhandler.cpp.o 
[ 83%] Building CXX object applications/vptests/CMakeFiles/vptests.dir/usr/local/ameeran/sources/applications/vptests/src/vptests.cpp.o 
[ 84%] Building CXX object applications/vptests/CMakeFiles/vptests.dir/usr/local/ameeran/sources/applications/vptests/src/vptestsapplication.cpp.o 
Linking CXX shared library libvptests.so 
[ 84%] Built target vptests 
Scanning dependencies of target admin 
[ 84%] Building CXX object applications/admin/CMakeFiles/admin.dir/usr/local/ameeran/sources/applications/admin/src/adminapplication.cpp.o 
[ 84%] Building CXX object applications/admin/CMakeFiles/admin.dir/usr/local/ameeran/sources/applications/admin/src/rtmpappprotocolhandler.cpp.o 
[ 84%] Building CXX object applications/admin/CMakeFiles/admin.dir/usr/local/ameeran/sources/applications/admin/src/cliappprotocolhandler.cpp.o 
[ 85%] Building CXX object applications/admin/CMakeFiles/admin.dir/usr/local/ameeran/sources/applications/admin/src/admin.cpp.o 
Linking CXX shared library libadmin.so 
[ 85%] Built target admin 
Scanning dependencies of target proxypublish 
[ 85%] Building CXX object applications/proxypublish/CMakeFiles/proxypublish.dir/usr/local/ameeran/sources/applications/proxypublish/src/rtspappprotocolhandler.cpp.o 
[ 85%] Building CXX object applications/proxypublish/CMakeFiles/proxypublish.dir/usr/local/ameeran/sources/applications/proxypublish/src/rtpappprotocolhandler.cpp.o 
[ 86%] Building CXX object applications/proxypublish/CMakeFiles/proxypublish.dir/usr/local/ameeran/sources/applications/proxypublish/src/rtmpappprotocolhandler.cpp.o 
[ 86%] Building CXX object applications/proxypublish/CMakeFiles/proxypublish.dir/usr/local/ameeran/sources/applications/proxypublish/src/liveflvappprotocolhandler.cpp.o 
[ 86%] Building CXX object applications/proxypublish/CMakeFiles/proxypublish.dir/usr/local/ameeran/sources/applications/proxypublish/src/proxypublishapplication.cpp.o 
[ 87%] Building CXX object applications/proxypublish/CMakeFiles/proxypublish.dir/usr/local/ameeran/sources/applications/proxypublish/src/proxypublish.cpp.o 
Linking CXX shared library libproxypublish.so 
[ 87%] Built target proxypublish 
Scanning dependencies of target stresstest 
[ 88%] Building CXX object applications/stresstest/CMakeFiles/stresstest.dir/usr/local/ameeran/sources/applications/stresstest/src/rtmpappprotocolhandler.cpp.o 
[ 88%] Building CXX object applications/stresstest/CMakeFiles/stresstest.dir/usr/local/ameeran/sources/applications/stresstest/src/stresstestapplication.cpp.o 
[ 88%] Building CXX object applications/stresstest/CMakeFiles/stresstest.dir/usr/local/ameeran/sources/applications/stresstest/src/stresstest.cpp.o 
Linking CXX shared library libstresstest.so 
[ 88%] Built target stresstest 
Scanning dependencies of target applestreamingclient 
[ 88%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/applestreamingclientapplication.cpp.o 
[ 88%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/applestreamingclient.cpp.o 
[ 89%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/eventsink/varianteventsink.cpp.o 
[ 89%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/eventsink/rtmpeventsink.cpp.o 
[ 89%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/eventsink/baseeventsink.cpp.o 
[ 90%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/jnihelpers.cpp.o 
[ 90%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/rtp/rtspappprotocolhandler.cpp.o 
[ 90%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/rtmp/rtmpappprotocolhandler.cpp.o 
[ 91%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/genericprotocol.cpp.o 
[ 91%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/key/inboundkeyprotocol.cpp.o 
[ 91%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/key/keyappprotocolhandler.cpp.o 
[ 92%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/ts/tsappprotocolhandler.cpp.o 
[ 92%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/httpbuff/httpbuffappprotocolhandler.cpp.o 
[ 92%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/httpbuff/httpbufferprotocol.cpp.o 
[ 93%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/timer/scheduletimerprotocol.cpp.o 
[ 93%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/timer/finetimer.cpp.o 
[ 93%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/aes/inboundaesprotocol.cpp.o 
[ 94%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/aes/aesappprotocolhandler.cpp.o 
[ 94%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/variant/variantappprotocolhandler.cpp.o 
[ 94%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/protocolfactory.cpp.o 
[ 95%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/m3u8/basem3u8protocol.cpp.o 
[ 95%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/m3u8/childm3u8protocol.cpp.o 
[ 95%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/m3u8/m3u8appprotocolhandler.cpp.o 
[ 96%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/protocols/m3u8/masterm3u8protocol.cpp.o 
[ 96%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/clientcontext.cpp.o 
[ 96%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/playlist.cpp.o 
[ 97%] Building CXX object applications/applestreamingclient/CMakeFiles/applestreamingclient.dir/usr/local/ameeran/sources/applications/applestreamingclient/src/speedcomputer.cpp.o 
Linking CXX shared library libapplestreamingclient.so 
[ 97%] Built target applestreamingclient 
Scanning dependencies of target vm 
[ 97%] Building CXX object vm/CMakeFiles/vm.dir/usr/local/ameeran/sources/vm/src/vmlua/basevmlua.cpp.o 
[ 98%] Building CXX object vm/CMakeFiles/vm.dir/usr/local/ameeran/sources/vm/src/basevm.cpp.o 
Linking CXX shared library libvm.so 
[ 98%] Built target vm 
Scanning dependencies of target vmtests 
[ 98%] Building CXX object vmtests/CMakeFiles/vmtests.dir/usr/local/ameeran/sources/vmtests/src/testvmlua.cpp.o 
[ 98%] Building CXX object vmtests/CMakeFiles/vmtests.dir/usr/local/ameeran/sources/vmtests/src/main.cpp.o 
Linking CXX executable vmtests 
[ 98%] Built target vmtests 
Scanning dependencies of target tests 
[ 99%] Building CXX object tests/CMakeFiles/tests.dir/usr/local/ameeran/sources/tests/src/commontestssuite.cpp.o 
[ 99%] Building CXX object tests/CMakeFiles/tests.dir/usr/local/ameeran/sources/tests/src/thelibtestssuite.cpp.o 
[ 99%] Building CXX object tests/CMakeFiles/tests.dir/usr/local/ameeran/sources/tests/src/varianttestssuite.cpp.o 
[ 99%] Building CXX object tests/CMakeFiles/tests.dir/usr/local/ameeran/sources/tests/src/basetestssuite.cpp.o 
[100%] Building CXX object tests/CMakeFiles/tests.dir/usr/local/ameeran/sources/tests/src/main.cpp.o 
Linking CXX executable tests 
[100%] Built target tests 
ameeran cmake #  

5. starting up 
启动rtmpd 

show code 
ameeran cmake #./rtmpserver/rtmpserver ./rtmpserver/rtmpserver.lua 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:168 Plug in the default protocol factory 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:175 Initialize I/O handlers manager: epoll 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:178 Initialize DNS resolver 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 0->1 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 1->2 IOHT_TCP_CONNECTOR 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:184 Initialize applications 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 2->3 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 3->4 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 4->5 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/configuration/configfile.cpp:787 Application "appselector" is up and running 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 5->6 IOHT_UDP_CARRIER 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 6->7 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 7->8 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/configuration/configfile.cpp:787 Application "flvplayback" (vod,live,ameeran) is up and running 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 8->9 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/configuration/configfile.cpp:787 Application "admin" (ameeran_admin) is up and running 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:190 Install the quit signal 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:193 Install the conf re-read signal 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:200 
+-----------------------------------------------------------------------------+ 
|                                                                     Services| 
+---+---------------+-----+-------------------------+-------------------------+ 
| c |      ip       | port|   protocol stack name   |     application name    | 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 9311|               inboundDns|                   #none#| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 1935|              inboundRtmp|              appselector| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 8081|             inboundRtmps|              appselector| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 8080|             inboundRtmpt|              appselector| 
+---+---------------+-----+-------------------------+-------------------------+ 
|udp|        0.0.0.0| 1935|             inboundRtmfp|              flvplayback| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 6666|           inboundLiveFlv|              flvplayback| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 9999|             inboundTcpTs|              flvplayback| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 1112|           inboundJsonCli|                    admin| 
+---+---------------+-----+-------------------------+-------------------------+ 


/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:201 GO! GO! GO! (22807) 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 9->10 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/netio/epoll/tcpacceptor.cpp:134 Client connected: 127.0.0.1:53720 -> 0.0.0.0:9311 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 10->11 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:105 Handlers count changed: 11->10 IOHT_TCP_CONNECTOR 


III. Testing our setup 
测试上面的设置 

For testing our setup we will use  
a simple .flv encoded file,  
flowplayer v3.2.5 and  
2 simple html files that contain embbed flash code for streaming. 
为了测试我们设置,约定如下: 
一个简单的 .flv编码的文件; 
flowplayer v3.2.5 
两个嵌入了flash代码的html文件; 

1. wild.flv file, we put it into /usr/local/media directory 
wild.flv文件,存储在 /usr/local/media 目录 
PIG.1 wild.flv 
 


FIRST SCENARIO : 
we create a simple .html - testswf.html - file and we put it on www.bfy.ro webroot directory  
as follows: 
创建页面 testswf.html 并将文件存放在 www.bfy.ro 页面根目录下: 


show code 
    <html> 
    <head><title>SCENARIO 1 - test file</title> 
    <body> 
    <div style="margin-left: 15px; margin-top: 55px;"> 
    <object width="690" height="410" data="http://www.bfy.ro/flowplayer/flowplayer-3.2.5.swf" type="application/x-shockwave-flash"> 
    <param name="movie" value="http://www.bfy.ro/flowplayer/flowplayer-3.2.5.swf" /> 
    <param name="version" value="[9,115]" /> 
    <param name="allowfullscreen" value="true" /> 
    <param name="allowscriptaccess" value="sameDomain" /> 
    <param name="quality" value="high" /> 
    <param name="flashvars" value='config={"clip":{"url":"wild","provider":"influxis", "autoPlay":0, "autoBuffering":1, "accelerated":1},"plugins":{"influxis":{"url":"http://www.bfy.ro/flowplayer/flowplayer.rtmp-3.2.3.swf","netConnectionUrl":"rtmpe://media.bfy.ro/ameeran"},"controls":{"url":"http://www.bfy.ro/flowplayer/flowplayer.controls-3.2.3.swf","fullscreen":1}}}' /> 
    </object> 
    </div> 
    </body> 
    </html> 
  
SECOND SCENARIO :  
we create a simple .html - testswf.html - file and we put it on www.a-queens.ro webroot directory  
as follows: 
创建页面 testswf.html 并将文件存放在 www.a-queens.ro 页面根目录下: 
show code 
    <html> 
    <head><title>SCENARIO 2 - test file</title> 
    <body> 
    <div style="margin-left: 15px; margin-top: 55px;"> 
    <object width="690" height="410" data="http://www.a-queens.ro/flowplayer/flowplayer-3.2.5.swf" type="application/x-shockwave-flash"> 
    <param name="movie" value="http://www.a-queens.ro/flowplayer/flowplayer-3.2.5.swf" /> 
    <param name="version" value="[9,115]" /> 
    <param name="allowfullscreen" value="true" /> 
    <param name="allowscriptaccess" value="sameDomain" /> 
    <param name="quality" value="high" /> 
    <param name="flashvars" value='config={"clip":{"url":"wild","provider":"influxis", "autoPlay":0, "autoBuffering":1, "accelerated":1},"plugins":{"influxis":{"url":"http://www.a-queens.ro/flowplayer/flowplayer.rtmp-3.2.3.swf","netConnectionUrl":"rtmpe://media.bfy.ro/ameeran"},"controls":{"url":"http://www.a-queens.ro/flowplayer/flowplayer.controls-3.2.3.swf","fullscreen":1}}}' /> 
    </object> 
    </div> 
    </body> 
    </html> 
  
for FIRST SCENARIO : 
we expect that calling webpage (pageUrl) is from *.bfy.ro domain (www, any subdomain),  
flash player address is http://www.bfy.ro/flowplayer/flowplayer-3.2.5.swf and  
calling schema (tcUrl) is either 
我们期望调用页面(pageUrl)是从 *.bfy.ro 域名; 
flash播放器的地址为: http://www.bfy.ro/flowplayer/flowplayer-3.2.5.swf 
且tcUrl设置为:  
  
rtmp://media.bfy.ro/ameeran、 
或 or 
rtmpe://media.bfy.ro/ameeran 

1. start up the beauty 
启动rtmpd 


show code 
ameeran cmake # ./rtmpserver/rtmpserver ./rtmpserver/rtmpserver.lua 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:168 Plug in the default protocol factory 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:175 Initialize I/O handlers manager: epoll 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:178 Initialize DNS resolver 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 0->1 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 1->2 IOHT_TCP_CONNECTOR 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:184 Initialize applications 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 2->3 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 3->4 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 4->5 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/configuration/configfile.cpp:787 Application "appselector" is up and running 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 5->6 IOHT_UDP_CARRIER 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 6->7 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 7->8 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/configuration/configfile.cpp:787 Application "flvplayback" (vod,live,ameeran) is up and running 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 8->9 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/configuration/configfile.cpp:787 Application "admin" (ameeran_admin) is up and running 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:190 Install the quit signal 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:193 Install the conf re-read signal 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:200 
+-----------------------------------------------------------------------------+ 
|                                                                     Services| 
+---+---------------+-----+-------------------------+-------------------------+ 
| c |      ip       | port|   protocol stack name   |     application name    | 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 9311|               inboundDns|                   #none#| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 1935|              inboundRtmp|              appselector| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 8081|             inboundRtmps|              appselector| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 8080|             inboundRtmpt|              appselector| 
+---+---------------+-----+-------------------------+-------------------------+ 
|udp|        0.0.0.0| 1935|             inboundRtmfp|              flvplayback| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 6666|           inboundLiveFlv|              flvplayback| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 9999|             inboundTcpTs|              flvplayback| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 1112|           inboundJsonCli|                    admin| 
+---+---------------+-----+-------------------------+-------------------------+ 


/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:201 GO! GO! GO! (18698) 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 9->10 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/netio/epoll/tcpacceptor.cpp:134 Client connected: 127.0.0.1:38725 -> 0.0.0.0:9311 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 10->11 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:105 Handlers count changed: 11->10 IOHT_TCP_CONNECTOR 


2. open a web browser and go to http://www.bfy.ro/testswf.html 
打开浏览器并输入网址 http://www.bfy.ro/testswf.html 
PIG.2  
 

and in the background: 
在rtmpd的后台输出信息能看到: 

show code 
/usr/local/ameeran/sources/thelib/src/netio/epoll/tcpacceptor.cpp:134 Client connected: 86.122.125.158:57628 -> 0.0.0.0:1935 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 10->11 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:71 Register protocol CTCP(15) <-> TCP(7) <-> [IR(8)] to application appselector 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/inboundrtmpprotocol.cpp:105 New protocol chain: CTCP(15) <-> [TCP(7)] <-> RE(9) <-> IR(8) 
/usr/local/ameeran/sources/applications/appselector/src/rtmpappprotocolhandler.cpp:83 Selected application: flvplayback (ameeran) 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:152 Protocol CTCP(15) <-> TCP(7) <-> RE(9) <-> [IR(8)] unregistered from application: appselector 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:71 Register protocol CTCP(15) <-> TCP(7) <-> RE(9) <-> [IR(8)] to application flvplayback 
/usr/local/ameeran/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp:121 Initial request: 
<MAP name="" isArray="false"> 
    <MAP name="header" isArray="false"> 
        <UINT32 name="channelId">3</UINT32> 
        <UINT8 name="headerType">3</UINT8> 
        <BOOL name="isAbsolute">false</BOOL> 
        <UINT32 name="messageLength">330</UINT32> 
        <UINT8 name="messageType">20</UINT8> 
        <UINT32 name="streamId">0</UINT32> 
        <UINT32 name="timestamp">0</UINT32> 
    </MAP> 
    <MAP name="invoke" isArray="false"> 
        <STR name="functionName">connect</STR> 
        <DOUBLE name="id">1.000</DOUBLE> 
        <BOOL name="isFlex">false</BOOL> 
        <MAP name="parameters" isArray="false"> 
            <MAP name="__index__value__0" isArray="false"> 
                <STR name="app">ameeran</STR> 
                <DOUBLE name="audioCodecs">3191.000</DOUBLE> 
                <DOUBLE name="capabilities">239.000</DOUBLE> 
                <STR name="flashVer">WIN 10,1,102,64</STR> 
                <BOOL name="fpad">false</BOOL> 
                <DOUBLE name="objectEncoding">3.000</DOUBLE> 
                <STR name="pageUrl">http://www.bfy.ro/testswf.html</STR> 
                <STR name="swfUrl">http://www.bfy.ro/flowplayer/flowplayer-3.2.5.swf</STR> 
                <STR name="tcUrl">rtmpe://media.bfy.ro/ameeran</STR> 
                <DOUBLE name="videoCodecs">252.000</DOUBLE> 
                <DOUBLE name="videoFunction">1.000</DOUBLE> 
            </MAP> 
        </MAP> 
    </MAP> 
</MAP> 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:324 User control message type: RM_USRCTRL_TYPE_STREAM_SET_BUFFER_LENGTH 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:160 Stream 1 of type NR with name `` registered to application `flvplayback` 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:668 Play request for stream name `wild`. Start: 0; length: -1 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:160 Stream 2 of type IFRFLV with name `/usr/local/media/wild.flv` registered to application `flvplayback` 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 11->12 IOHT_TIMER 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:168 Stream 1 of type NR with name `` unregistered from application `flvplayback` 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:160 Stream 3 of type ONR4R with name `wild` registered to application `flvplayback` 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:324 User control message type: RM_USRCTRL_TYPE_STREAM_SET_BUFFER_LENGTH 


as we can see from Initial Request we have managed to pass all validations: 
可以看到对所有的请求做了验证: 
 ... 
 <STR name="pageUrl">http://www.bfy.ro/testswf.html</STR> 
 <STR name="swfUrl">http://www.bfy.ro/flowplayer/flowplayer-3.2.5.swf</STR> 
 <STR name="tcUrl">rtmpe://media.bfy.ro/ameeran</STR> 
 ... 


3. we copy&paste our testswf.html from webroot of www.bfy.ro (above file from FIRST SCENARIO)  
into another webserver machine, let's say into webroot domain of www.curier.ro (93.115.203.59)  
and we are calling webpage from new location as: 
http://www.curier.ro/testswf.html 
现在我们将testswf.html页面直接复制到另一台页面服务器中,如www.curier.or(93.115.203.59) 
并启动页面: 
PIG.3  
 

 

and in the background: 
这时,可以在rtmpd的输出信息中看到: 
show code 
/usr/local/ameeran/sources/thelib/src/netio/epoll/tcpacceptor.cpp:134 Client connected: 86.122.125.158:64921 -> 0.0.0.0:1935 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 10->11 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:71 Register protocol CTCP(15) <-> TCP(7) <-> [IR(8)] to application appselector 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/inboundrtmpprotocol.cpp:105 New protocol chain: CTCP(15) <-> [TCP(7)] <-> RE(9) <-> IR(8) 
/usr/local/ameeran/sources/applications/appselector/src/rtmpappprotocolhandler.cpp:83 Selected application: flvplayback (ameeran) 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:152 Protocol CTCP(15) <-> TCP(7) <-> RE(9) <-> [IR(8)] unregistered from application: appselector 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:71 Register protocol CTCP(15) <-> TCP(7) <-> RE(9) <-> [IR(8)] to application flvplayback 
/usr/local/ameeran/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp:121 Initial request: 
<MAP name="" isArray="false"> 
    <MAP name="header" isArray="false"> 
        <UINT32 name="channelId">3</UINT32> 
        <UINT8 name="headerType">3</UINT8> 
        <BOOL name="isAbsolute">false</BOOL> 
        <UINT32 name="messageLength">333</UINT32> 
        <UINT8 name="messageType">20</UINT8> 
        <UINT32 name="streamId">0</UINT32> 
        <UINT32 name="timestamp">1</UINT32> 
    </MAP> 
    <MAP name="invoke" isArray="false"> 
        <STR name="functionName">connect</STR> 
        <DOUBLE name="id">1.000</DOUBLE> 
        <BOOL name="isFlex">false</BOOL> 
        <MAP name="parameters" isArray="false"> 
            <MAP name="__index__value__0" isArray="false"> 
                <STR name="app">ameeran</STR> 
                <DOUBLE name="audioCodecs">3191.000</DOUBLE> 
                <DOUBLE name="capabilities">239.000</DOUBLE> 
                <STR name="flashVer">WIN 10,1,103,20</STR> 
                <BOOL name="fpad">false</BOOL> 
                <DOUBLE name="objectEncoding">3.000</DOUBLE> 
                <STR name="pageUrl">http://www.curier.ro/testswf.html</STR> 
                <STR name="swfUrl">http://www.bfy.ro/flowplayer/flowplayer-3.2.5.swf</STR> 
                <STR name="tcUrl">rtmpe://media.bfy.ro/ameeran</STR> 
                <DOUBLE name="videoCodecs">252.000</DOUBLE> 
                <DOUBLE name="videoFunction">1.000</DOUBLE> 
            </MAP> 
        </MAP> 
    </MAP> 
</MAP> 
/usr/local/ameeran/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp:171 Incorrect pageUrl: <MAP name="" isArray="false"> 
    <MAP name="header" isArray="false"> 
        <UINT32 name="channelId">3</UINT32> 
        <UINT8 name="headerType">3</UINT8> 
        <BOOL name="isAbsolute">false</BOOL> 
        <UINT32 name="messageLength">333</UINT32> 
        <UINT8 name="messageType">20</UINT8> 
        <UINT32 name="streamId">0</UINT32> 
        <UINT32 name="timestamp">1</UINT32> 
    </MAP> 
    <MAP name="invoke" isArray="false"> 
        <STR name="functionName">connect</STR> 
        <DOUBLE name="id">1.000</DOUBLE> 
        <BOOL name="isFlex">false</BOOL> 
        <MAP name="parameters" isArray="false"> 
            <MAP name="__index__value__0" isArray="false"> 
                <STR name="app">ameeran</STR> 
                <DOUBLE name="audioCodecs">3191.000</DOUBLE> 
                <DOUBLE name="capabilities">239.000</DOUBLE> 
                <STR name="flashVer">WIN 10,1,103,20</STR> 
                <BOOL name="fpad">false</BOOL> 
                <DOUBLE name="objectEncoding">3.000</DOUBLE> 
                <STR name="pageUrl">http://www.curier.ro/testswf.html</STR> 
                <STR name="swfUrl">http://www.bfy.ro/flowplayer/flowplayer-3.2.5.swf</STR> 
                <STR name="tcUrl">rtmpe://media.bfy.ro/ameeran</STR> 
                <DOUBLE name="videoCodecs">252.000</DOUBLE> 
                <DOUBLE name="videoFunction">1.000</DOUBLE> 
            </MAP> 
        </MAP> 
    </MAP> 
</MAP> 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpprotocol.cpp:799 Unable to send rtmp message to application 
/usr/local/ameeran/sources/thelib/src/netio/epoll/tcpcarrier.cpp:97 Unable to signal data available 
/usr/local/ameeran/sources/thelib/src/protocols/protocolmanager.cpp:43 Enqueue for delete for protool [TCP(7)] <-> RE(9) <-> IR(8) 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:105 Handlers count changed: 11->10 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/protocols/protocolmanager.cpp:43 Enqueue for delete for protool [RE(9)] <-> IR(8) 
/usr/local/ameeran/sources/thelib/src/protocols/protocolmanager.cpp:43 Enqueue for delete for protool [IR(8)] 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:152 Protocol [IR(8)] unregistered from application: flvplayback 


BANG!  
we have got an  
可以看到,验证未通过,页面无法播放: 
/usr/local/ameeran/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp:171 Incorrect pageUrl: <MAP name=”” isArray=“false”> 
because uri.ip (93.115.203.59) extracted from pageUrl (http://www.curier.ro/testswf.html) does not validate filter whom we have defined into FIRST SCENARIO rtmpappprotocolhandler.cpp: 
// ip which resolve our calling webpage(s)/website(s) 
   if (((string) uri.ip) != "86.123.101.7") { 
                FATAL("Incorrect "RM_INVOKE_PARAMS_CONNECT_PAGEURL": %s", STR(request.ToString())); 
                 return false; 
   } 


MOREOVER 
Testing to see if anyone can browse our media folder... 
For this purpose we can use http://dl.dropbox.com/u/2918563/flvplayback.swf to test  
connection to our rtmpd server: 
再测试看浏览器能否列出媒体文件信息: 

FIG.4  
 

 

and in the background: 
可以在rtmpd中看到输出信息: 

show code 
/usr/local/ameeran/sources/thelib/src/netio/epoll/tcpacceptor.cpp:134 Client connected: 86.122.125.158:64396 -> 0.0.0.0:1935 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 10->11 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:71 Register protocol CTCP(15) <-> TCP(7) <-> [IR(8)] to application appselector 
/usr/local/ameeran/sources/applications/appselector/src/rtmpappprotocolhandler.cpp:83 Selected application: flvplayback (ameeran) 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:152 Protocol CTCP(15) <-> TCP(7) <-> [IR(8)] unregistered from application: appselector 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:71 Register protocol CTCP(15) <-> TCP(7) <-> [IR(8)] to application flvplayback 
/usr/local/ameeran/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp:121 Initial request: 
<MAP name="" isArray="false"> 
    <MAP name="header" isArray="false"> 
        <UINT32 name="channelId">3</UINT32> 
        <UINT8 name="headerType">3</UINT8> 
        <BOOL name="isAbsolute">false</BOOL> 
        <UINT32 name="messageLength">344</UINT32> 
        <UINT8 name="messageType">20</UINT8> 
        <UINT32 name="streamId">0</UINT32> 
        <UINT32 name="timestamp">1</UINT32> 
    </MAP> 
    <MAP name="invoke" isArray="false"> 
        <STR name="functionName">connect</STR> 
        <DOUBLE name="id">1.000</DOUBLE> 
        <BOOL name="isFlex">false</BOOL> 
        <MAP name="parameters" isArray="false"> 
            <MAP name="__index__value__0" isArray="false"> 
                <STR name="app">ameeran</STR> 
                <DOUBLE name="audioCodecs">3191.000</DOUBLE> 
                <DOUBLE name="capabilities">239.000</DOUBLE> 
                <STR name="flashVer">WIN 10,1,103,20</STR> 
                <BOOL name="fpad">false</BOOL> 
                <DOUBLE name="objectEncoding">3.000</DOUBLE> 
                <STR name="pageUrl">http://dl.dropbox.com/u/2918563/flvplayback.swf</STR> 
                <STR name="swfUrl">http://dl.dropbox.com/u/2918563/flvplayback.swf</STR> 
                <STR name="tcUrl">rtmp://media.bfy.ro/ameeran</STR> 
                <DOUBLE name="videoCodecs">252.000</DOUBLE> 
                <DOUBLE name="videoFunction">1.000</DOUBLE> 
            </MAP> 
        </MAP> 
    </MAP> 
</MAP> 
/usr/local/ameeran11/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp:168 Incorrect swfUrl: <MAP name="" isArray="false"> 
    <MAP name="header" isArray="false"> 
        <UINT32 name="channelId">3</UINT32> 
        <UINT8 name="headerType">3</UINT8> 
        <BOOL name="isAbsolute">false</BOOL> 
        <UINT32 name="messageLength">344</UINT32> 
        <UINT8 name="messageType">20</UINT8> 
        <UINT32 name="streamId">0</UINT32> 
        <UINT32 name="timestamp">1</UINT32> 
    </MAP> 
    <MAP name="invoke" isArray="false"> 
        <STR name="functionName">connect</STR> 
        <DOUBLE name="id">1.000</DOUBLE> 
        <BOOL name="isFlex">false</BOOL> 
        <MAP name="parameters" isArray="false"> 
            <MAP name="__index__value__0" isArray="false"> 
                <STR name="app">ameeran</STR> 
                <DOUBLE name="audioCodecs">3191.000</DOUBLE> 
                <DOUBLE name="capabilities">239.000</DOUBLE> 
                <STR name="flashVer">WIN 10,1,103,20</STR> 
                <BOOL name="fpad">false</BOOL> 
                <DOUBLE name="objectEncoding">3.000</DOUBLE> 
                <STR name="pageUrl">http://dl.dropbox.com/u/2918563/flvplayback.swf</STR> 
                <STR name="swfUrl">http://dl.dropbox.com/u/2918563/flvplayback.swf</STR> 
                <STR name="tcUrl">rtmp://media.bfy.ro/ameeran</STR> 
                <DOUBLE name="videoCodecs">252.000</DOUBLE> 
                <DOUBLE name="videoFunction">1.000</DOUBLE> 
            </MAP> 
        </MAP> 
    </MAP> 
</MAP> 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpprotocol.cpp:799 Unable to send rtmp message to application 
/usr/local/ameeran/sources/thelib/src/netio/epoll/tcpcarrier.cpp:97 Unable to signal data available 
/usr/local/ameeran/sources/thelib/src/protocols/protocolmanager.cpp:43 Enqueue for delete for protool [TCP(7)] <-> IR(8) 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:105 Handlers count changed: 11->10 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/protocols/protocolmanager.cpp:43 Enqueue for delete for protool [IR(8)] 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:152 Protocol [IR(8)] unregistered from application: flvplayback 
AGAIN our sever refuse connection as all parameters does not validate. 
可以看到,服务器拒绝了这个连接,因为所有的参数都没有验证。 


for SECOND SCENARIO 
对于第二种场景 

we expect that calling webpage (pageUrl) is from *.a-queens.ro domain (www, any subdomain),  
flash player address is http://www.a-queens.ro/flowplayer/flowplayer-3.2.5.swf and  
calling schema (tcUrl) is either 


rtmp://media.bfy.ro/ameeran 
or 
rtmpe://media.bfy.ro/ameeran 

1. start up the beauty 
启动rtmpd 


show code 
ameeran cmake # ./rtmpserver/rtmpserver ./rtmpserver/rtmpserver.lua 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:168 Plug in the default protocol factory 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:175 Initialize I/O handlers manager: epoll 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:178 Initialize DNS resolver 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 0->1 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 1->2 IOHT_TCP_CONNECTOR 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:184 Initialize applications 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 2->3 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 3->4 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 4->5 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/configuration/configfile.cpp:787 Application "appselector" is up and running 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 5->6 IOHT_UDP_CARRIER 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 6->7 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 7->8 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/configuration/configfile.cpp:787 Application "flvplayback" (vod,live,ameeran) is up and running 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 8->9 IOHT_ACCEPTOR 
/usr/local/ameeran/sources/thelib/src/configuration/configfile.cpp:787 Application "admin" (ameeran_admin) is up and running 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:190 Install the quit signal 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:193 Install the conf re-read signal 
/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:200 
+-----------------------------------------------------------------------------+ 
|                                                                     Services| 
+---+---------------+-----+-------------------------+-------------------------+ 
| c |      ip       | port|   protocol stack name   |     application name    | 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 9311|               inboundDns|                   #none#| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 1935|              inboundRtmp|              appselector| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 8081|             inboundRtmps|              appselector| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 8080|             inboundRtmpt|              appselector| 
+---+---------------+-----+-------------------------+-------------------------+ 
|udp|        0.0.0.0| 1935|             inboundRtmfp|              flvplayback| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 6666|           inboundLiveFlv|              flvplayback| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 9999|             inboundTcpTs|              flvplayback| 
+---+---------------+-----+-------------------------+-------------------------+ 
|tcp|        0.0.0.0| 1112|           inboundJsonCli|                    admin| 
+---+---------------+-----+-------------------------+-------------------------+ 


/usr/local/ameeran/sources/rtmpserver/src/rtmpserver.cpp:201 GO! GO! GO! (18698) 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 9->10 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/netio/epoll/tcpacceptor.cpp:134 Client connected: 127.0.0.1:38725 -> 0.0.0.0:9311 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 10->11 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:105 Handlers count changed: 11->10 IOHT_TCP_CONNECTOR 


2. open a web browser and go to http://www.a-queens.ro/testswf.html 
在浏览器中打开页面: 
FIG.5 
 

and in the background: 
查看后台信息: 

show code 
/usr/local/ameeran/sources/thelib/src/netio/epoll/tcpacceptor.cpp:134 Client connected: 86.122.125.158:61769 -> 0.0.0.0:1935 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 10->11 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:71 Register protocol CTCP(15) <-> TCP(7) <-> [IR(8)] to application appselector 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/inboundrtmpprotocol.cpp:105 New protocol chain: CTCP(15) <-> [TCP(7)] <-> RE(9) <-> IR(8) 
/usr/local/ameeran/sources/applications/appselector/src/rtmpappprotocolhandler.cpp:83 Selected application: flvplayback (ameeran) 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:152 Protocol CTCP(15) <-> TCP(7) <-> RE(9) <-> [IR(8)] unregistered from application: appselector 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:71 Register protocol CTCP(15) <-> TCP(7) <-> RE(9) <-> [IR(8)] to application flvplayback 
/usr/local/ameeran/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp:121 Initial request: 
<MAP name="" isArray="false"> 
    <MAP name="header" isArray="false"> 
        <UINT32 name="channelId">3</UINT32> 
        <UINT8 name="headerType">3</UINT8> 
        <BOOL name="isAbsolute">false</BOOL> 
        <UINT32 name="messageLength">340</UINT32> 
        <UINT8 name="messageType">20</UINT8> 
        <UINT32 name="streamId">0</UINT32> 
        <UINT32 name="timestamp">0</UINT32> 
    </MAP> 
    <MAP name="invoke" isArray="false"> 
        <STR name="functionName">connect</STR> 
        <DOUBLE name="id">1.000</DOUBLE> 
        <BOOL name="isFlex">false</BOOL> 
        <MAP name="parameters" isArray="false"> 
            <MAP name="__index__value__0" isArray="false"> 
                <STR name="app">ameeran</STR> 
                <DOUBLE name="audioCodecs">3191.000</DOUBLE> 
                <DOUBLE name="capabilities">239.000</DOUBLE> 
                <STR name="flashVer">WIN 10,1,102,64</STR> 
                <BOOL name="fpad">false</BOOL> 
                <DOUBLE name="objectEncoding">3.000</DOUBLE> 
                <STR name="pageUrl">http://www.a-queens.ro/testswf.html</STR> 
                <STR name="swfUrl">http://www.a-queens.ro/flowplayer/flowplayer-3.2.5.swf</STR> 
                <STR name="tcUrl">rtmpe://media.bfy.ro/ameeran</STR> 
                <DOUBLE name="videoCodecs">252.000</DOUBLE> 
                <DOUBLE name="videoFunction">1.000</DOUBLE> 
            </MAP> 
        </MAP> 
    </MAP> 
</MAP> 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:160 Stream 1 of type NR with name `` registered to application `flvplayback` 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:324 User control message type: RM_USRCTRL_TYPE_STREAM_SET_BUFFER_LENGTH 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:668 Play request for stream name `wild`. Start: 0; length: -1 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:160 Stream 2 of type IFRFLV with name `/usr/local/media/wild.flv` registered to application `flvplayback` 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 11->12 IOHT_TIMER 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:168 Stream 1 of type NR with name `` unregistered from application `flvplayback` 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:160 Stream 3 of type ONR4R with name `wild` registered to application `flvplayback` 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:324 User control message type: RM_USRCTRL_TYPE_STREAM_SET_BUFFER_LENGTH 


so everything seems to be ok as long as our initial request pass all validation: 
可以看到,对相应的参数做了验证: 


  <STR name="pageUrl">http://www.a-queens.ro/testswf.html</STR> 
  <STR name="swfUrl">http://www.a-queens.ro/flowplayer/flowplayer-3.2.5.swf</STR> 
  <STR name="tcUrl">rtmpe://media.bfy.ro/ameeran</STR> 


3. we copy&paste our testswf.html from webroot of www.a-queens.ro (above file from SECOND SCENARIO)  
into another webserver machine, as testswf1.html, let's say into webroot domain of  
www.curier.ro (93.115.203.59) and we are calling webpage from new location as: 
http://www.curier.ro/testswf1.html 
将网页复制到其它机器并打开 
FIG.6 
 

 

and in the background: 
可在后台看到: 


show code 
/usr/local/ameeran/sources/thelib/src/netio/epoll/tcpacceptor.cpp:134 Client connected: 86.122.125.158:63203 -> 0.0.0.0:1935 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:96 Handlers count changed: 10->11 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:71 Register protocol CTCP(15) <-> TCP(7) <-> [IR(8)] to application appselector 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/inboundrtmpprotocol.cpp:105 New protocol chain: CTCP(15) <-> [TCP(7)] <-> RE(9) <-> IR(8) 
/usr/local/ameeran/sources/applications/appselector/src/rtmpappprotocolhandler.cpp:83 Selected application: flvplayback (ameeran) 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:152 Protocol CTCP(15) <-> TCP(7) <-> RE(9) <-> [IR(8)] unregistered from application: appselector 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp:71 Register protocol CTCP(15) <-> TCP(7) <-> RE(9) <-> [IR(8)] to application flvplayback 
/usr/local/ameeran/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp:121 Initial request: 
<MAP name="" isArray="false"> 
    <MAP name="header" isArray="false"> 
        <UINT32 name="channelId">3</UINT32> 
        <UINT8 name="headerType">3</UINT8> 
        <BOOL name="isAbsolute">false</BOOL> 
        <UINT32 name="messageLength">339</UINT32> 
        <UINT8 name="messageType">20</UINT8> 
        <UINT32 name="streamId">0</UINT32> 
        <UINT32 name="timestamp">1</UINT32> 
    </MAP> 
    <MAP name="invoke" isArray="false"> 
        <STR name="functionName">connect</STR> 
        <DOUBLE name="id">1.000</DOUBLE> 
        <BOOL name="isFlex">false</BOOL> 
        <MAP name="parameters" isArray="false"> 
            <MAP name="__index__value__0" isArray="false"> 
                <STR name="app">ameeran</STR> 
                <DOUBLE name="audioCodecs">3191.000</DOUBLE> 
                <DOUBLE name="capabilities">239.000</DOUBLE> 
                <STR name="flashVer">WIN 10,1,102,64</STR> 
                <BOOL name="fpad">false</BOOL> 
                <DOUBLE name="objectEncoding">3.000</DOUBLE> 
                <STR name="pageUrl">http://www.curier.ro/testswf1.html</STR> 
                <STR name="swfUrl">http://www.a-queens.ro/flowplayer/flowplayer-3.2.5.swf</STR> 
                <STR name="tcUrl">rtmpe://media.bfy.ro/ameeran</STR> 
                <DOUBLE name="videoCodecs">252.000</DOUBLE> 
                <DOUBLE name="videoFunction">1.000</DOUBLE> 
            </MAP> 
        </MAP> 
    </MAP> 
</MAP> 
/usr/local/ameeran/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp:173 Incorrect pageUrl: <MAP name="" isArray="false"> 
    <MAP name="header" isArray="false"> 
        <UINT32 name="channelId">3</UINT32> 
        <UINT8 name="headerType">3</UINT8> 
        <BOOL name="isAbsolute">false</BOOL> 
        <UINT32 name="messageLength">339</UINT32> 
        <UINT8 name="messageType">20</UINT8> 
        <UINT32 name="streamId">0</UINT32> 
        <UINT32 name="timestamp">1</UINT32> 
    </MAP> 
    <MAP name="invoke" isArray="false"> 
        <STR name="functionName">connect</STR> 
        <DOUBLE name="id">1.000</DOUBLE> 
        <BOOL name="isFlex">false</BOOL> 
        <MAP name="parameters" isArray="false"> 
            <MAP name="__index__value__0" isArray="false"> 
                <STR name="app">ameeran</STR> 
                <DOUBLE name="audioCodecs">3191.000</DOUBLE> 
                <DOUBLE name="capabilities">239.000</DOUBLE> 
                <STR name="flashVer">WIN 10,1,102,64</STR> 
                <BOOL name="fpad">false</BOOL> 
                <DOUBLE name="objectEncoding">3.000</DOUBLE> 
                <STR name="pageUrl">http://www.curier.ro/testswf1.html</STR> 
                <STR name="swfUrl">http://www.a-queens.ro/flowplayer/flowplayer-3.2.5.swf</STR> 
                <STR name="tcUrl">rtmpe://media.bfy.ro/ameeran</STR> 
                <DOUBLE name="videoCodecs">252.000</DOUBLE> 
                <DOUBLE name="videoFunction">1.000</DOUBLE> 
            </MAP> 
        </MAP> 
    </MAP> 
</MAP> 
/usr/local/ameeran/sources/thelib/src/protocols/rtmp/basertmpprotocol.cpp:799 Unable to send rtmp message to application 
/usr/local/ameeran/sources/thelib/src/netio/epoll/tcpcarrier.cpp:97 Unable to signal data available 
/usr/local/ameeran/sources/thelib/src/protocols/protocolmanager.cpp:43 Enqueue for delete for protool [TCP(7)] <-> RE(9) <-> IR(8) 
/usr/local/ameeran/sources/thelib/src/netio/epoll/iohandlermanager.cpp:105 Handlers count changed: 11->10 IOHT_TCP_CARRIER 
/usr/local/ameeran/sources/thelib/src/protocols/protocolmanager.cpp:43 Enqueue for delete for protool [RE(9)] <-> IR(8) 
/usr/local/ameeran/sources/thelib/src/protocols/protocolmanager.cpp:43 Enqueue for delete for protool [IR(8)] 
/usr/local/ameeran/sources/thelib/src/application/baseclientapplication.cpp:152 Protocol [IR(8)] unregistered from application: flvplayback 
BANG!  
we have got an /usr/local/ameeran/sources/applications/flvplayback/src/rtmpappprotocolhandler.cpp:173 Incorrect pageUrl: <MAP name=”” isArray=“false”> 
because uri.ip (93.115.203.59) extracted from pageUrl (http://www.curier.ro/testswf1.html)  
does not validate filter whom we have defined into SECOND SCENARIO rtmpappprotocolhandler.cpp: 
验证未通过: 


// ip which resolve our calling webpage(s)/website(s) 
   if (((string) uri.ip) != "86.122.125.158") { 
                FATAL("Incorrect "RM_INVOKE_PARAMS_CONNECT_PAGEURL": %s", STR(request.ToString())); 
                 return false; 
   } 


needless to say that example from FIRST SCENARIO for browsing media files won't work as well 
这种方式对于第一种场景也适合;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
C++ RTMP Server Instructions how to compile and use C++ RTMP Server (a.k.a crtmpserver) Requirements: * GCC and other C++ tools * SVN * libdl, libssl, libcrypto (make sure you have the "devel" packages of libdl, ssl and crypto installed prior to compiling) In order to get the source code, issue the following command: svn co --username anonymous https://svn.rtmpd.com/crtmpserver/trunk crtmpserver When it asks for password, hit Enter key Compile the package. Do the following steps: cd crtmpserver/builders/cmake cmake . (this step will create all the Makefile's that are required. If some package is missing, the cmake will complain) make The compilation procedure should be finished within few minutes. After you compiled the package, it's time to test it. Run the following command: ./crtmpserver/crtmpserver crtmpserver/crtmpserver.lua If everything goes well, you'll get on your console a table with IP's, ports, protocols, and application names If you see this table, then crtmpserver is working. Lets test it the server. Follow these simple steps: * Download a simple FLV or MP4 file. You can dowload a sample file from here: http://www.mediacollege.com/adobe/flash/video/tutorial/example-flv.html * Place the file you downloaded into the crtmpserver/media folder * Download an FLV player. For this example, we'll use JW Player. Get it here: http://www.longtailvideo.com/players/jw-flv-player * Extract the JW Player to a directory which is accessible through your web server * Go to the extracted directory and create an HTML file which will include the player and play the file. Here's an example: <html> <body> <script type='text/javascript' src='swfobject.js'></script> <div id='mediaspace'>This text will be replaced</div> <script type='text/javascript'> var so = new SWFObject('player.swf','mpl','640','360','9'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('wmode','opaque'); so.addVariable('file','file-download'); so.addVariable('streamer','rtmp://127.0.0.1/flvplayback/'); so.write('mediaspace'); </script> </body> </html> * Change the 127.0.0.1 to either the IP of your crtmpserver or simply use a hostname of your machine * Replace file-download with the actual filename of your sample you download. Remeber to omit the .flv if it's an FLV file * Open a web browser and point it to to the web server IP/Hostname and the directory you installed the player (example: http://127.0.0.1/player) * You should see a player. Click the play button and the video should be played. If you see the video, then everything works well. Installing crtmpserver: * Go to the directory crtmpserver/cmake * Run the following command: cmake -DCRTMPSERVER_INSTALL_PREFIX=<path> (for example /usr/local/crtmpserver) * After previous command done start build project with command: make * After build comlete run command: make install * After install you has installed crtmpserver in <path>(in our case /usr/local/crtmpserver) * Now you can start crtmpserver with command: sudo <path>/sbin/crtmpserver --uid=<UID> <path>/etc/crtmpserver.lua in our case: sudo /usr/local/crtmpserver/sbin/crtmpserver --uid=<UID> /usr/local/crtmpserver/etc/crtmpserver.lua Also look into builders/packing directory. There are several OS specific builders. * in directory "debian" builder for Debian, also can be used for Ubuntu and other distributions based on debian * in directory "freebsd" builder(port) for FreeBSD crtmpserver settings * All crtmpserver settings are located in a detailed file calle: crtmpserver.lua
编译记录 : ~、 common 工程 缺少 utils/misc/format.cpp utils/logging/formatter.cpp ~、thelib 工程 增加宏定义 “HAS_MEDIA_TS” \crtmpsvr_tr\sources\thelib\src\mediaformats\readers 全部重新组织添加 \crtmpsvr_tr\sources\thelib\src\protocols\ts 去掉 " " 以及相应的头文件。 去掉 protocols 下的 " " 新建筛选器目录“protocols/passthrough”,添加此目录下的两个文件 (可选) \thelib\src\protocols\ts\basetsappprotocolhandler.cpp BaseTSAppProtocolHandler::BaseTSAppProtocolHandler(Variant &configuration) //红标处漏写 -chenlx : BaseAppProtocolHandler(configuration) { \sources\thelib\src\netio\select\tcpcarrier.cpp TCPCarrier::TCPCarrier(int32_t fd) : IOHandler(fd, fd, IOHT_TCP_CARRIER) { //EventLogger::GetDefaultLogger()->LogCarrierCreated(stats); //-chenlx 去掉 netio\select\inboundnamedpipecarrier.cpp .h 添加 \fdstats.cpp JsonVariantProtocol.cpp 新建筛选器目录并添加源文件: thelib\src\recording ~、卸载项目 applestreamingclient,取消crtmpserver对applestreamingclient库的依赖,原因 是trunk中根本就没用到这个项目,对比branches和trunk中的cmake文件,applestreamingclient工程明显被注释。 注意,要先取消crtmpserver对applestreamingclient库的依赖再卸载:在项目crtmpserver上右击属性,在框架和引用上将对applestreamingclient链接库依赖选择false ~、vm \sources\vm\src\basevmlua.cpp 编不过去,提示“luaL_Reg”类型非法 在 \sources\common\include\utils\lua\luautils.h 里引入下列头文件,并重新编译 common.lib extern "C" { #include <lualib.h> #include <lauxlib.h> } ~、 appselector 、 flvplayback :\lab\ztttprj\coder\_svr_voip\streaming_\crtmpsvr_tr\sources\applications\flvplayback\include\tsappprotocolhandler.h(30): error C2504: “BaseTSAppProtocolHandler”: 未定义基类 增加宏定义 “HAS_MEDIA_TS”

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

金枝玉叶9

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值