常量改成string ,提供性能

This commit is contained in:
xiongziliang 2019-06-12 18:37:52 +08:00
parent eb19779012
commit 080f2af4b4
3 changed files with 113 additions and 113 deletions

@ -1 +1 @@
Subproject commit 831880216c904478148caa5be6efd598a4f08d97 Subproject commit 12c8963fb18ce2e7c8ef9bc55c973d5e634666d3

View File

@ -54,28 +54,28 @@ bool loadIniConfig(const char *ini_path){
} }
////////////广播名称/////////// ////////////广播名称///////////
namespace Broadcast { namespace Broadcast {
const char kBroadcastMediaChanged[] = "kBroadcastMediaChanged"; const string kBroadcastMediaChanged = "kBroadcastMediaChanged";
const char kBroadcastRecordMP4[] = "kBroadcastRecordMP4"; const string kBroadcastRecordMP4 = "kBroadcastRecordMP4";
const char kBroadcastHttpRequest[] = "kBroadcastHttpRequest"; const string kBroadcastHttpRequest = "kBroadcastHttpRequest";
const char kBroadcastHttpAccess[] = "kBroadcastHttpAccess"; const string kBroadcastHttpAccess = "kBroadcastHttpAccess";
const char kBroadcastOnGetRtspRealm[] = "kBroadcastOnGetRtspRealm"; const string kBroadcastOnGetRtspRealm = "kBroadcastOnGetRtspRealm";
const char kBroadcastOnRtspAuth[] = "kBroadcastOnRtspAuth"; const string kBroadcastOnRtspAuth = "kBroadcastOnRtspAuth";
const char kBroadcastMediaPlayed[] = "kBroadcastMediaPlayed"; const string kBroadcastMediaPlayed = "kBroadcastMediaPlayed";
const char kBroadcastMediaPublish[] = "kBroadcastMediaPublish"; const string kBroadcastMediaPublish = "kBroadcastMediaPublish";
const char kBroadcastFlowReport[] = "kBroadcastFlowReport"; const string kBroadcastFlowReport = "kBroadcastFlowReport";
const char kBroadcastReloadConfig[] = "kBroadcastReloadConfig"; const string kBroadcastReloadConfig = "kBroadcastReloadConfig";
const char kBroadcastShellLogin[] = "kBroadcastShellLogin"; const string kBroadcastShellLogin = "kBroadcastShellLogin";
const char kBroadcastNotFoundStream[] = "kBroadcastNotFoundStream"; const string kBroadcastNotFoundStream = "kBroadcastNotFoundStream";
const char kBroadcastStreamNoneReader[] = "kBroadcastStreamNoneReader"; const string kBroadcastStreamNoneReader = "kBroadcastStreamNoneReader";
} //namespace Broadcast } //namespace Broadcast
//通用配置项目 //通用配置项目
namespace General{ namespace General{
#define GENERAL_FIELD "general." #define GENERAL_FIELD "general."
const char kFlowThreshold[] = GENERAL_FIELD"flowThreshold"; const string kFlowThreshold = GENERAL_FIELD"flowThreshold";
const char kStreamNoneReaderDelayMS[] = GENERAL_FIELD"streamNoneReaderDelayMS"; const string kStreamNoneReaderDelayMS = GENERAL_FIELD"streamNoneReaderDelayMS";
const char kMaxStreamWaitTimeMS[] = GENERAL_FIELD"maxStreamWaitMS"; const string kMaxStreamWaitTimeMS = GENERAL_FIELD"maxStreamWaitMS";
const char kEnableVhost[] = GENERAL_FIELD"enableVhost"; const string kEnableVhost = GENERAL_FIELD"enableVhost";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kFlowThreshold] = 1024; mINI::Instance()[kFlowThreshold] = 1024;
mINI::Instance()[kStreamNoneReaderDelayMS] = 5 * 1000; mINI::Instance()[kStreamNoneReaderDelayMS] = 5 * 1000;
@ -91,19 +91,19 @@ namespace Http {
//http 文件发送缓存大小 //http 文件发送缓存大小
#define HTTP_SEND_BUF_SIZE (64 * 1024) #define HTTP_SEND_BUF_SIZE (64 * 1024)
const char kSendBufSize[] = HTTP_FIELD"sendBufSize"; const string kSendBufSize = HTTP_FIELD"sendBufSize";
//http 最大请求字节数 //http 最大请求字节数
#define HTTP_MAX_REQ_SIZE (4*1024) #define HTTP_MAX_REQ_SIZE (4*1024)
const char kMaxReqSize[] = HTTP_FIELD"maxReqSize"; const string kMaxReqSize = HTTP_FIELD"maxReqSize";
//http keep-alive秒数 //http keep-alive秒数
#define HTTP_KEEP_ALIVE_SECOND 10 #define HTTP_KEEP_ALIVE_SECOND 10
const char kKeepAliveSecond[] = HTTP_FIELD"keepAliveSecond"; const string kKeepAliveSecond = HTTP_FIELD"keepAliveSecond";
//http keep-alive最大请求数 //http keep-alive最大请求数
#define HTTP_MAX_REQ_CNT 100 #define HTTP_MAX_REQ_CNT 100
const char kMaxReqCount[] = HTTP_FIELD"maxReqCount"; const string kMaxReqCount = HTTP_FIELD"maxReqCount";
//http 字符编码 //http 字符编码
@ -112,11 +112,11 @@ const char kMaxReqCount[] = HTTP_FIELD"maxReqCount";
#else #else
#define HTTP_CHAR_SET "utf-8" #define HTTP_CHAR_SET "utf-8"
#endif #endif
const char kCharSet[] = HTTP_FIELD"charSet"; const string kCharSet = HTTP_FIELD"charSet";
//http 服务器根目录 //http 服务器根目录
#define HTTP_ROOT_PATH (exeDir() + "httpRoot") #define HTTP_ROOT_PATH (exeDir() + "httpRoot")
const char kRootPath[] = HTTP_FIELD"rootPath"; const string kRootPath = HTTP_FIELD"rootPath";
//http 404错误提示内容 //http 404错误提示内容
#define HTTP_NOT_FOUND "<html>"\ #define HTTP_NOT_FOUND "<html>"\
@ -128,7 +128,7 @@ const char kRootPath[] = HTTP_FIELD"rootPath";
"</center>"\ "</center>"\
"</body>"\ "</body>"\
"</html>" "</html>"
const char kNotFound[] = HTTP_FIELD"notFound"; const string kNotFound = HTTP_FIELD"notFound";
onceToken token([](){ onceToken token([](){
@ -148,7 +148,7 @@ namespace Shell {
#define SHELL_FIELD "shell." #define SHELL_FIELD "shell."
#define SHELL_MAX_REQ_SIZE 1024 #define SHELL_MAX_REQ_SIZE 1024
const char kMaxReqSize[] = SHELL_FIELD"maxReqSize"; const string kMaxReqSize = SHELL_FIELD"maxReqSize";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kMaxReqSize] = SHELL_MAX_REQ_SIZE; mINI::Instance()[kMaxReqSize] = SHELL_MAX_REQ_SIZE;
@ -158,9 +158,9 @@ onceToken token([](){
////////////RTSP服务器配置/////////// ////////////RTSP服务器配置///////////
namespace Rtsp { namespace Rtsp {
#define RTSP_FIELD "rtsp." #define RTSP_FIELD "rtsp."
const char kAuthBasic[] = RTSP_FIELD"authBasic"; const string kAuthBasic = RTSP_FIELD"authBasic";
const char kHandshakeSecond[] = RTSP_FIELD"handshakeSecond"; const string kHandshakeSecond = RTSP_FIELD"handshakeSecond";
const char kKeepAliveSecond[] = RTSP_FIELD"keepAliveSecond"; const string kKeepAliveSecond = RTSP_FIELD"keepAliveSecond";
onceToken token([](){ onceToken token([](){
//默认Md5方式认证 //默认Md5方式认证
mINI::Instance()[kAuthBasic] = 0; mINI::Instance()[kAuthBasic] = 0;
@ -173,9 +173,9 @@ onceToken token([](){
////////////RTMP服务器配置/////////// ////////////RTMP服务器配置///////////
namespace Rtmp { namespace Rtmp {
#define RTMP_FIELD "rtmp." #define RTMP_FIELD "rtmp."
const char kModifyStamp[] = RTMP_FIELD"modifyStamp"; const string kModifyStamp = RTMP_FIELD"modifyStamp";
const char kHandshakeSecond[] = RTMP_FIELD"handshakeSecond"; const string kHandshakeSecond = RTMP_FIELD"handshakeSecond";
const char kKeepAliveSecond[] = RTMP_FIELD"keepAliveSecond"; const string kKeepAliveSecond = RTMP_FIELD"keepAliveSecond";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kModifyStamp] = true; mINI::Instance()[kModifyStamp] = true;
@ -192,22 +192,22 @@ namespace Rtp {
//RTP打包最大MTU,公网情况下更小 //RTP打包最大MTU,公网情况下更小
#define RTP_VIDOE_MTU_SIZE 1400 #define RTP_VIDOE_MTU_SIZE 1400
const char kVideoMtuSize[] = RTP_FIELD"videoMtuSize"; const string kVideoMtuSize = RTP_FIELD"videoMtuSize";
#define RTP_Audio_MTU_SIZE 600 #define RTP_Audio_MTU_SIZE 600
const char kAudioMtuSize[] = RTP_FIELD"audioMtuSize"; const string kAudioMtuSize = RTP_FIELD"audioMtuSize";
//RTP排序缓存最大个数 //RTP排序缓存最大个数
#define RTP_MAX_RTP_COUNT 50 #define RTP_MAX_RTP_COUNT 50
const char kMaxRtpCount[] = RTP_FIELD"maxRtpCount"; const string kMaxRtpCount = RTP_FIELD"maxRtpCount";
//如果RTP序列正确次数累计达到该数字就启动清空排序缓存 //如果RTP序列正确次数累计达到该数字就启动清空排序缓存
#define RTP_CLEAR_COUNT 10 #define RTP_CLEAR_COUNT 10
const char kClearCount[] = RTP_FIELD"clearCount"; const string kClearCount = RTP_FIELD"clearCount";
//最大RTP时间为13个小时每13小时回环一次 //最大RTP时间为13个小时每13小时回环一次
#define RTP_CYCLE_MS (13*60*60*1000) #define RTP_CYCLE_MS (13*60*60*1000)
const char kCycleMS[] = RTP_FIELD"cycleMS"; const string kCycleMS = RTP_FIELD"cycleMS";
onceToken token([](){ onceToken token([](){
@ -223,12 +223,12 @@ onceToken token([](){
namespace MultiCast { namespace MultiCast {
#define MULTI_FIELD "multicast." #define MULTI_FIELD "multicast."
//组播分配起始地址 //组播分配起始地址
const char kAddrMin[] = MULTI_FIELD"addrMin"; const string kAddrMin = MULTI_FIELD"addrMin";
//组播分配截止地址 //组播分配截止地址
const char kAddrMax[] = MULTI_FIELD"addrMax"; const string kAddrMax = MULTI_FIELD"addrMax";
//组播TTL //组播TTL
#define MULTI_UDP_TTL 64 #define MULTI_UDP_TTL 64
const char kUdpTTL[] = MULTI_FIELD"udpTTL"; const string kUdpTTL = MULTI_FIELD"udpTTL";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kAddrMin] = "239.0.0.0"; mINI::Instance()[kAddrMin] = "239.0.0.0";
@ -244,19 +244,19 @@ namespace Record {
//查看录像的应用名称 //查看录像的应用名称
#define RECORD_APP_NAME "record" #define RECORD_APP_NAME "record"
const char kAppName[] = RECORD_FIELD"appName"; const string kAppName = RECORD_FIELD"appName";
//每次流化MP4文件的时长,单位毫秒 //每次流化MP4文件的时长,单位毫秒
#define RECORD_SAMPLE_MS 100 #define RECORD_SAMPLE_MS 100
const char kSampleMS[] = RECORD_FIELD"sampleMS"; const string kSampleMS = RECORD_FIELD"sampleMS";
//MP4文件录制大小,默认一个小时 //MP4文件录制大小,默认一个小时
#define RECORD_FILE_SECOND (60*60) #define RECORD_FILE_SECOND (60*60)
const char kFileSecond[] = RECORD_FIELD"fileSecond"; const string kFileSecond = RECORD_FIELD"fileSecond";
//录制文件路径 //录制文件路径
#define RECORD_FILE_PATH HTTP_ROOT_PATH #define RECORD_FILE_PATH HTTP_ROOT_PATH
const char kFilePath[] = RECORD_FIELD"filePath"; const string kFilePath = RECORD_FIELD"filePath";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kAppName] = RECORD_APP_NAME; mINI::Instance()[kAppName] = RECORD_APP_NAME;
@ -273,19 +273,19 @@ namespace Hls {
//HLS切片时长,单位秒 //HLS切片时长,单位秒
#define HLS_SEGMENT_DURATION 3 #define HLS_SEGMENT_DURATION 3
const char kSegmentDuration[] = HLS_FIELD"segDur"; const string kSegmentDuration = HLS_FIELD"segDur";
//HLS切片个数 //HLS切片个数
#define HLS_SEGMENT_NUM 3 #define HLS_SEGMENT_NUM 3
const char kSegmentNum[] = HLS_FIELD"segNum"; const string kSegmentNum = HLS_FIELD"segNum";
//HLS文件写缓存大小 //HLS文件写缓存大小
#define HLS_FILE_BUF_SIZE (64 * 1024) #define HLS_FILE_BUF_SIZE (64 * 1024)
const char kFileBufSize[] = HLS_FIELD"fileBufSize"; const string kFileBufSize = HLS_FIELD"fileBufSize";
//录制文件路径 //录制文件路径
#define HLS_FILE_PATH (HTTP_ROOT_PATH) #define HLS_FILE_PATH (HTTP_ROOT_PATH)
const char kFilePath[] = HLS_FIELD"filePath"; const string kFilePath = HLS_FIELD"filePath";
onceToken token([](){ onceToken token([](){
mINI::Instance()[kSegmentDuration] = HLS_SEGMENT_DURATION; mINI::Instance()[kSegmentDuration] = HLS_SEGMENT_DURATION;
@ -298,15 +298,15 @@ onceToken token([](){
namespace Client { namespace Client {
const char kNetAdapter[] = "net_adapter"; const string kNetAdapter = "net_adapter";
const char kRtpType[] = "rtp_type"; const string kRtpType = "rtp_type";
const char kRtspUser[] = "rtsp_user" ; const string kRtspUser = "rtsp_user" ;
const char kRtspPwd[] = "rtsp_pwd"; const string kRtspPwd = "rtsp_pwd";
const char kRtspPwdIsMD5[] = "rtsp_pwd_md5"; const string kRtspPwdIsMD5 = "rtsp_pwd_md5";
const char kTimeoutMS[] = "protocol_timeout_ms"; const string kTimeoutMS = "protocol_timeout_ms";
const char kMediaTimeoutMS[] = "media_timeout_ms"; const string kMediaTimeoutMS = "media_timeout_ms";
const char kBeatIntervalMS[] = "beat_interval_ms"; const string kBeatIntervalMS = "beat_interval_ms";
const char kMaxAnalysisMS[] = "max_analysis_ms"; const string kMaxAnalysisMS = "max_analysis_ms";
} }

View File

@ -68,28 +68,28 @@ bool loadIniConfig(const char *ini_path = nullptr);
namespace Broadcast { namespace Broadcast {
//注册或反注册MediaSource事件广播 //注册或反注册MediaSource事件广播
extern const char kBroadcastMediaChanged[]; extern const string kBroadcastMediaChanged;
#define BroadcastMediaChangedArgs const bool &bRegist, const string &schema,const string &vhost,const string &app,const string &stream,MediaSource &sender #define BroadcastMediaChangedArgs const bool &bRegist, const string &schema,const string &vhost,const string &app,const string &stream,MediaSource &sender
//录制mp4文件成功后广播 //录制mp4文件成功后广播
extern const char kBroadcastRecordMP4[]; extern const string kBroadcastRecordMP4;
#define BroadcastRecordMP4Args const Mp4Info &info #define BroadcastRecordMP4Args const Mp4Info &info
//收到http api请求广播 //收到http api请求广播
extern const char kBroadcastHttpRequest[]; extern const string kBroadcastHttpRequest;
#define BroadcastHttpRequestArgs const Parser &parser,const HttpSession::HttpResponseInvoker &invoker,bool &consumed,TcpSession &sender #define BroadcastHttpRequestArgs const Parser &parser,const HttpSession::HttpResponseInvoker &invoker,bool &consumed,TcpSession &sender
//收到http 访问文件或目录的广播 //收到http 访问文件或目录的广播
extern const char kBroadcastHttpAccess[]; extern const string kBroadcastHttpAccess;
#define BroadcastHttpAccessArgs const Parser &parser,const MediaInfo &args,const string &path,const bool &is_dir,const HttpSession::HttpAccessPathInvoker &invoker,TcpSession &sender #define BroadcastHttpAccessArgs const Parser &parser,const MediaInfo &args,const string &path,const bool &is_dir,const HttpSession::HttpAccessPathInvoker &invoker,TcpSession &sender
//该流是否需要认证是的话调用invoker并传入realm,否则传入空的realm.如果该事件不监听则不认证 //该流是否需要认证是的话调用invoker并传入realm,否则传入空的realm.如果该事件不监听则不认证
extern const char kBroadcastOnGetRtspRealm[]; extern const string kBroadcastOnGetRtspRealm;
#define BroadcastOnGetRtspRealmArgs const MediaInfo &args,const RtspSession::onGetRealm &invoker,TcpSession &sender #define BroadcastOnGetRtspRealmArgs const MediaInfo &args,const RtspSession::onGetRealm &invoker,TcpSession &sender
//请求认证用户密码事件user_name为用户名must_no_encrypt如果为true则必须提供明文密码(因为此时是base64认证方式),否则会导致认证失败 //请求认证用户密码事件user_name为用户名must_no_encrypt如果为true则必须提供明文密码(因为此时是base64认证方式),否则会导致认证失败
//获取到密码后请调用invoker并输入对应类型的密码和密码类型invoker执行时会匹配密码 //获取到密码后请调用invoker并输入对应类型的密码和密码类型invoker执行时会匹配密码
extern const char kBroadcastOnRtspAuth[]; extern const string kBroadcastOnRtspAuth;
#define BroadcastOnRtspAuthArgs const MediaInfo &args,const string &realm,const string &user_name,const bool &must_no_encrypt,const RtspSession::onAuth &invoker,TcpSession &sender #define BroadcastOnRtspAuthArgs const MediaInfo &args,const string &realm,const string &user_name,const bool &must_no_encrypt,const RtspSession::onAuth &invoker,TcpSession &sender
//鉴权结果回调对象 //鉴权结果回调对象
@ -97,31 +97,31 @@ extern const char kBroadcastOnRtspAuth[];
typedef std::function<void(const string &errMessage)> AuthInvoker; typedef std::function<void(const string &errMessage)> AuthInvoker;
//收到rtsp/rtmp推流事件广播通过该事件控制推流鉴权 //收到rtsp/rtmp推流事件广播通过该事件控制推流鉴权
extern const char kBroadcastMediaPublish[]; extern const string kBroadcastMediaPublish;
#define BroadcastMediaPublishArgs const MediaInfo &args,const Broadcast::AuthInvoker &invoker,TcpSession &sender #define BroadcastMediaPublishArgs const MediaInfo &args,const Broadcast::AuthInvoker &invoker,TcpSession &sender
//播放rtsp/rtmp/http-flv事件广播通过该事件控制播放鉴权 //播放rtsp/rtmp/http-flv事件广播通过该事件控制播放鉴权
extern const char kBroadcastMediaPlayed[]; extern const string kBroadcastMediaPlayed;
#define BroadcastMediaPlayedArgs const MediaInfo &args,const Broadcast::AuthInvoker &invoker,TcpSession &sender #define BroadcastMediaPlayedArgs const MediaInfo &args,const Broadcast::AuthInvoker &invoker,TcpSession &sender
//shell登录鉴权 //shell登录鉴权
extern const char kBroadcastShellLogin[]; extern const string kBroadcastShellLogin;
#define BroadcastShellLoginArgs const string &user_name,const string &passwd,const Broadcast::AuthInvoker &invoker,TcpSession &sender #define BroadcastShellLoginArgs const string &user_name,const string &passwd,const Broadcast::AuthInvoker &invoker,TcpSession &sender
//停止rtsp/rtmp/http-flv会话后流量汇报事件广播 //停止rtsp/rtmp/http-flv会话后流量汇报事件广播
extern const char kBroadcastFlowReport[]; extern const string kBroadcastFlowReport;
#define BroadcastFlowReportArgs const MediaInfo &args,const uint64_t &totalBytes,const uint64_t &totalDuration,const bool &isPlayer,TcpSession &sender #define BroadcastFlowReportArgs const MediaInfo &args,const uint64_t &totalBytes,const uint64_t &totalDuration,const bool &isPlayer,TcpSession &sender
//未找到流后会广播该事件,请在监听该事件后去拉流或其他方式产生流,这样就能按需拉流了 //未找到流后会广播该事件,请在监听该事件后去拉流或其他方式产生流,这样就能按需拉流了
extern const char kBroadcastNotFoundStream[]; extern const string kBroadcastNotFoundStream;
#define BroadcastNotFoundStreamArgs const MediaInfo &args,TcpSession &sender #define BroadcastNotFoundStreamArgs const MediaInfo &args,TcpSession &sender
//某个流无人消费时触发,目的为了实现无人观看时主动断开拉流等业务逻辑 //某个流无人消费时触发,目的为了实现无人观看时主动断开拉流等业务逻辑
extern const char kBroadcastStreamNoneReader[]; extern const string kBroadcastStreamNoneReader;
#define BroadcastStreamNoneReaderArgs MediaSource &sender #define BroadcastStreamNoneReaderArgs MediaSource &sender
//更新配置文件事件广播,执行loadIniConfig函数加载配置文件成功后会触发该广播 //更新配置文件事件广播,执行loadIniConfig函数加载配置文件成功后会触发该广播
extern const char kBroadcastReloadConfig[]; extern const string kBroadcastReloadConfig;
#define BroadcastReloadConfigArgs void #define BroadcastReloadConfigArgs void
#define ReloadConfigTag ((void *)(0xFF)) #define ReloadConfigTag ((void *)(0xFF))
@ -158,108 +158,108 @@ extern const char kBroadcastReloadConfig[];
////////////通用配置/////////// ////////////通用配置///////////
namespace General{ namespace General{
//流量汇报事件流量阈值,单位KB默认1MB //流量汇报事件流量阈值,单位KB默认1MB
extern const char kFlowThreshold[]; extern const string kFlowThreshold;
//流无人观看并且超过若干时间后才触发kBroadcastStreamNoneReader事件 //流无人观看并且超过若干时间后才触发kBroadcastStreamNoneReader事件
//默认连续5秒无人观看然后触发kBroadcastStreamNoneReader事件 //默认连续5秒无人观看然后触发kBroadcastStreamNoneReader事件
extern const char kStreamNoneReaderDelayMS[]; extern const string kStreamNoneReaderDelayMS;
//等待流注册超时时间,收到播放器后请求后,如果未找到相关流,服务器会等待一定时间, //等待流注册超时时间,收到播放器后请求后,如果未找到相关流,服务器会等待一定时间,
//如果在这个时间内,相关流注册上了,那么服务器会立即响应播放器播放成功, //如果在这个时间内,相关流注册上了,那么服务器会立即响应播放器播放成功,
//否则会最多等待kMaxStreamWaitTimeMS毫秒然后响应播放器播放失败 //否则会最多等待kMaxStreamWaitTimeMS毫秒然后响应播放器播放失败
extern const char kMaxStreamWaitTimeMS[]; extern const string kMaxStreamWaitTimeMS;
//是否启动虚拟主机 //是否启动虚拟主机
extern const char kEnableVhost[]; extern const string kEnableVhost;
}//namespace General }//namespace General
////////////HTTP配置/////////// ////////////HTTP配置///////////
namespace Http { namespace Http {
//http 文件发送缓存大小 //http 文件发送缓存大小
extern const char kSendBufSize[]; extern const string kSendBufSize;
//http 最大请求字节数 //http 最大请求字节数
extern const char kMaxReqSize[]; extern const string kMaxReqSize;
//http keep-alive秒数 //http keep-alive秒数
extern const char kKeepAliveSecond[]; extern const string kKeepAliveSecond;
//http keep-alive最大请求数 //http keep-alive最大请求数
extern const char kMaxReqCount[]; extern const string kMaxReqCount;
//http 字符编码 //http 字符编码
extern const char kCharSet[]; extern const string kCharSet;
//http 服务器根目录 //http 服务器根目录
extern const char kRootPath[]; extern const string kRootPath;
//http 404错误提示内容 //http 404错误提示内容
extern const char kNotFound[]; extern const string kNotFound;
}//namespace Http }//namespace Http
////////////SHELL配置/////////// ////////////SHELL配置///////////
namespace Shell { namespace Shell {
extern const char kMaxReqSize[]; extern const string kMaxReqSize;
} //namespace Shell } //namespace Shell
////////////RTSP服务器配置/////////// ////////////RTSP服务器配置///////////
namespace Rtsp { namespace Rtsp {
//是否优先base64方式认证默认Md5方式认证 //是否优先base64方式认证默认Md5方式认证
extern const char kAuthBasic[]; extern const string kAuthBasic;
//握手超时时间默认15秒 //握手超时时间默认15秒
extern const char kHandshakeSecond[]; extern const string kHandshakeSecond;
//维持链接超时时间默认15秒 //维持链接超时时间默认15秒
extern const char kKeepAliveSecond[]; extern const string kKeepAliveSecond;
} //namespace Rtsp } //namespace Rtsp
////////////RTMP服务器配置/////////// ////////////RTMP服务器配置///////////
namespace Rtmp { namespace Rtmp {
extern const char kModifyStamp[]; extern const string kModifyStamp;
//握手超时时间默认15秒 //握手超时时间默认15秒
extern const char kHandshakeSecond[]; extern const string kHandshakeSecond;
//维持链接超时时间默认15秒 //维持链接超时时间默认15秒
extern const char kKeepAliveSecond[]; extern const string kKeepAliveSecond;
} //namespace RTMP } //namespace RTMP
////////////RTP配置/////////// ////////////RTP配置///////////
namespace Rtp { namespace Rtp {
//RTP打包最大MTU,公网情况下更小 //RTP打包最大MTU,公网情况下更小
extern const char kVideoMtuSize[]; extern const string kVideoMtuSize;
//RTP打包最大MTU,公网情况下更小 //RTP打包最大MTU,公网情况下更小
extern const char kAudioMtuSize[]; extern const string kAudioMtuSize;
//RTP排序缓存最大个数 //RTP排序缓存最大个数
extern const char kMaxRtpCount[]; extern const string kMaxRtpCount;
//如果RTP序列正确次数累计达到该数字就启动清空排序缓存 //如果RTP序列正确次数累计达到该数字就启动清空排序缓存
extern const char kClearCount[]; extern const string kClearCount;
//最大RTP时间为13个小时每13小时回环一次 //最大RTP时间为13个小时每13小时回环一次
extern const char kCycleMS[]; extern const string kCycleMS;
} //namespace Rtsp } //namespace Rtsp
////////////组播配置/////////// ////////////组播配置///////////
namespace MultiCast { namespace MultiCast {
//组播分配起始地址 //组播分配起始地址
extern const char kAddrMin[]; extern const string kAddrMin;
//组播分配截止地址 //组播分配截止地址
extern const char kAddrMax[]; extern const string kAddrMax;
//组播TTL //组播TTL
extern const char kUdpTTL[]; extern const string kUdpTTL;
} //namespace MultiCast } //namespace MultiCast
////////////录像配置/////////// ////////////录像配置///////////
namespace Record { namespace Record {
//查看录像的应用名称 //查看录像的应用名称
extern const char kAppName[]; extern const string kAppName;
//每次流化MP4文件的时长,单位毫秒 //每次流化MP4文件的时长,单位毫秒
extern const char kSampleMS[]; extern const string kSampleMS;
//MP4文件录制大小,默认一个小时 //MP4文件录制大小,默认一个小时
extern const char kFileSecond[]; extern const string kFileSecond;
//录制文件路径 //录制文件路径
extern const char kFilePath[]; extern const string kFilePath;
} //namespace Record } //namespace Record
////////////HLS相关配置/////////// ////////////HLS相关配置///////////
namespace Hls { namespace Hls {
//HLS切片时长,单位秒 //HLS切片时长,单位秒
extern const char kSegmentDuration[]; extern const string kSegmentDuration;
//HLS切片个数 //HLS切片个数
extern const char kSegmentNum[]; extern const string kSegmentNum;
//HLS文件写缓存大小 //HLS文件写缓存大小
extern const char kFileBufSize[]; extern const string kFileBufSize;
//录制文件路径 //录制文件路径
extern const char kFilePath[]; extern const string kFilePath;
} //namespace Hls } //namespace Hls
@ -270,24 +270,24 @@ extern const char kFilePath[];
*/ */
namespace Client { namespace Client {
//指定网卡ip //指定网卡ip
extern const char kNetAdapter[]; extern const string kNetAdapter;
//设置rtp传输类型可选项有0(tcp默认)、1(udp)、2(组播) //设置rtp传输类型可选项有0(tcp默认)、1(udp)、2(组播)
//设置方法:player[PlayerBase::kRtpType] = 0/1/2; //设置方法:player[PlayerBase::kRtpType] = 0/1/2;
extern const char kRtpType[]; extern const string kRtpType;
//rtsp认证用户名 //rtsp认证用户名
extern const char kRtspUser[]; extern const string kRtspUser;
//rtsp认证用用户密码可以是明文也可以是md5,md5密码生成方式 md5(username:realm:password) //rtsp认证用用户密码可以是明文也可以是md5,md5密码生成方式 md5(username:realm:password)
extern const char kRtspPwd[]; extern const string kRtspPwd;
//rtsp认证用用户密码是否为md5类型 //rtsp认证用用户密码是否为md5类型
extern const char kRtspPwdIsMD5[]; extern const string kRtspPwdIsMD5;
//握手超时时间默认10,000 毫秒 //握手超时时间默认10,000 毫秒
extern const char kTimeoutMS[]; extern const string kTimeoutMS;
//rtp/rtmp包接收超时时间默认5000秒 //rtp/rtmp包接收超时时间默认5000秒
extern const char kMediaTimeoutMS[]; extern const string kMediaTimeoutMS;
//rtsp/rtmp心跳时间,默认5000毫秒 //rtsp/rtmp心跳时间,默认5000毫秒
extern const char kBeatIntervalMS[]; extern const string kBeatIntervalMS;
//Track编码格式探测最大时间单位毫秒默认2000 //Track编码格式探测最大时间单位毫秒默认2000
extern const char kMaxAnalysisMS[]; extern const string kMaxAnalysisMS;
} }
} // namespace mediakit } // namespace mediakit