Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
ee9b6b64
Commit
ee9b6b64
authored
Mar 21, 2018
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决编译错误以及运行期bug
parent
30aa71cb
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
112 行增加
和
171 行删除
+112
-171
CMakeLists.txt
+48
-91
ZLToolKit
+1
-0
tests/CMakeLists.txt
+7
-15
tests/test_rtmpPusher.cpp
+54
-56
tests/test_rtmpPusherMp4.cpp
+2
-9
没有找到文件。
CMakeLists.txt
查看文件 @
ee9b6b64
project
(
ZLMediaKit
)
cmake_minimum_required
(
VERSION 2.8
)
#使能c++11
add_compile_options
(
-std=c++11
)
#加载自定义模块
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
PROJECT_SOURCE_DIR
}
/cmake"
)
...
...
@@ -7,133 +9,88 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
set
(
LIBRARY_OUTPUT_PATH
${
PROJECT_BINARY_DIR
}
/lib
)
#设置可执行程序路径
set
(
EXECUTABLE_OUTPUT_PATH
${
PROJECT_BINARY_DIR
}
/bin
)
#设置子目录
set
(
SUB_DIR_LIST
"Codec"
"Common"
"Device"
"H264"
"Http"
"MediaFile"
"Player"
"Rtmp"
"RTP"
"Rtsp"
"Shell"
)
#使能GOP缓存
add_definitions
(
-DENABLE_RING_USEBUF
)
#设置工程源码根目录
set
(
ToolKit_Root
${
CMAKE_SOURCE_DIR
}
/ZLToolKit/src
)
set
(
MediaKit_Root
${
CMAKE_SOURCE_DIR
}
/src
)
#安装目录
if
(
WIN32
)
set
(
INSTALL_PATH_LIB $ENV{HOME}/
${
CMAKE_PROJECT_NAME
}
/lib
)
set
(
INSTALL_PATH_INCLUDE $ENV{HOME}/
${
CMAKE_PROJECT_NAME
}
/include
)
else
()
set
(
INSTALL_PATH_LIB lib
)
set
(
INSTALL_PATH_INCLUDE include
)
endif
()
#设置头文件目录
INCLUDE_DIRECTORIES
(
${
ToolKit_Root
}
)
INCLUDE_DIRECTORIES
(
${
MediaKit_Root
}
)
#收集源代码
file
(
GLOB ToolKit_src_list
${
ToolKit_Root
}
/*/*.cpp
${
ToolKit_Root
}
/*/*.h
${
ToolKit_Root
}
/*/*.c
)
file
(
GLOB MediaKit_src_list
${
MediaKit_Root
}
/*/*.cpp
${
MediaKit_Root
}
/*/*.h
${
MediaKit_Root
}
/*/*.c
)
foreach
(
SUB_DIR
${
SUB_DIR_LIST
}
)
#遍历源文件
aux_source_directory
(
src/
${
SUB_DIR
}
SRC_LIST
)
#安装头文件至系统目录
install
(
DIRECTORY src/
${
SUB_DIR
}
DESTINATION
${
INSTALL_PATH_INCLUDE
}
FILES_MATCHING PATTERN
"*.h"
)
endforeach
()
#去除win32的适配代码
if
(
NOT WIN32
)
list
(
REMOVE_ITEM ToolKit_src_list
${
ToolKit_Root
}
/win32/getopt.c
)
endif
()
set
(
LINK_LIB_LIST
)
#添加两个静态库
set
(
LINK_LIB_LIST zlmediakit zltoolkit
)
#查找openssl是否安装
find_package
(
OpenSSL QUIET
)
if
(
OPENSSL_FOUND
)
message
(
STATUS
"
找到openssl库:
\"
${
OPENSSL_INCLUDE_DIR
}
\"
,ENABLE_OPENSSL宏已打开
"
)
if
(
OPENSSL_FOUND
)
message
(
STATUS
"
found openssl library
\"
${
OPENSSL_INCLUDE_DIR
}
\"
,ENABLE_OPENSSL enabled
"
)
include_directories
(
${
OPENSSL_INCLUDE_DIR
}
)
add_definitions
(
-DENABLE_OPENSSL
)
list
(
APPEND LINK_LIB_LIST
${
OPENSSL_LIBRARIES
}
)
endif
(
)
endif
(
OPENSSL_FOUND
)
#查找mysql是否安装
find_package
(
MYSQL QUIET
)
if
(
MYSQL_FOUND
)
message
(
STATUS
"
找到mysqlclient库:
\"
${
MYSQL_INCLUDE_DIR
}
\"
,ENABLE_MYSQL宏已打开
"
)
if
(
MYSQL_FOUND
)
message
(
STATUS
"
found mysqlclient library
\"
${
MYSQL_INCLUDE_DIR
}
\"
,ENABLE_MYSQL enabled
"
)
include_directories
(
${
MYSQL_INCLUDE_DIR
}
)
add_definitions
(
-DENABLE_MYSQL
)
list
(
APPEND LINK_LIB_LIST
${
MYSQL_LIBRARIES
}
)
endif
()
endif
(
MYSQL_FOUND
)
#查找
mp4v
2是否安装
#查找
MP4V
2是否安装
find_package
(
MP4V2 QUIET
)
if
(
MP4V2_FOUND
)
message
(
STATUS
"找到mp4v2库:
\"
${
MP4V2_INCLUDE_DIR
}
\"
,ENABLE_MP4V2宏已打开"
)
if
(
MP4V2_FOUND
)
include_directories
(
${
MP4V2_INCLUDE_DIR
}
)
list
(
APPEND LINK_LIB_LIST
${
MP4V2_LIBRARY
}
)
add_definitions
(
-DENABLE_MP4V2
)
list
(
APPEND LINK_LIB_LIST
${
MP4V2_LIBRARIES
}
)
endif
(
)
message
(
STATUS
"found MP4V2:
${
MP4V2_INCLUDE_DIR
}
,
${
MP4V2_LIBRARY
}
"
)
endif
(
MP4V2_FOUND
)
#查找x264是否安装
find_package
(
X264 QUIET
)
if
(
X264_FOUND
)
message
(
STATUS
"
找到x264库:
\"
${
X264_INCLUDE_DIRS
}
\"
,ENABLE_X264宏已打开
"
)
if
(
X264_FOUND
)
message
(
STATUS
"
found x264 library
\"
${
X264_INCLUDE_DIRS
}
\"
,ENABLE_X264 enabled
"
)
include_directories
(
${
X264_INCLUDE_DIRS
}
)
add_definitions
(
-DENABLE_X264
)
list
(
APPEND LINK_LIB_LIST
${
X264_LIBRARIES
}
)
endif
()
endif
()
#查找faac是否安装
find_package
(
FAAC QUIET
)
if
(
FAAC_FOUND
)
message
(
STATUS
"
找到faac库:
\"
${
FAAC_INCLUDE_DIR
}
\"
,ENABLE_FAAC宏已打开
"
)
if
(
FAAC_FOUND
)
message
(
STATUS
"
found faac library
\"
${
FAAC_INCLUDE_DIR
}
\"
,ENABLE_FAAC enabled
"
)
include_directories
(
${
FAAC_INCLUDE_DIR
}
)
add_definitions
(
-DENABLE_FAAC
)
list
(
APPEND LINK_LIB_LIST
${
FAAC_LIBRARIES
}
)
endif
()
#查找ZLToolKit是否安装
find_package
(
ZLTOOLKIT QUIET
)
if
(
ZLTOOLKIT_FOUND
)
message
(
STATUS
"找到ZLToolKit库:
\"
${
ZLTOOLKIT_INCLUDE_DIR
}
\"
"
)
include_directories
(
${
ZLTOOLKIT_INCLUDE_DIR
}
)
list
(
APPEND LINK_LIB_LIST
${
ZLTOOLKIT_LIBRARIES
}
)
endif
()
#查找JEMALLOC是否安装
find_package
(
JEMALLOC QUIET
)
if
(
JEMALLOC_FOUND
)
message
(
STATUS
"找到JEMALLOC库:
\"
${
JEMALLOC_INCLUDE_DIR
}
\"
"
)
include_directories
(
${
JEMALLOC_INCLUDE_DIR
}
)
list
(
APPEND LINK_LIB_LIST
${
JEMALLOC_LIBRARIES
}
)
endif
()
#打印库文件
message
(
STATUS
"将链接依赖库:
${
LINK_LIB_LIST
}
"
)
#开启RTSP/RTMP之间的互相转换,开启HLS
add_definitions
(
-DENABLE_RTMP2RTSP -DENABLE_RTSP2RTMP -DENABLE_HLS
)
#引用头文件路径
include_directories
(
${
PROJECT_SOURCE_DIR
}
/src
)
endif
()
#使能c++11
set
(
CMAKE_CXX_FLAGS
"-std=c++11
${
CMAKE_CXX_FLAGS
}
"
)
if
(
NOT WIN32
)
#关闭过期接口警告
add_compile_options
(
-Wno-deprecated-declarations
)
#关闭__FUNCTION__宏在函数外警告
add_compile_options
(
-Wno-predefined-identifier-outside-function
)
endif
()
if
(
WIN32
)
list
(
APPEND LINK_LIB_LIST ws2_32
)
endif
()
#编译动态库
if
(
NOT IOS AND NOT ANDROID
)
add_library
(
${
CMAKE_PROJECT_NAME
}
_shared SHARED
${
SRC_LIST
}
)
set_target_properties
(
${
CMAKE_PROJECT_NAME
}
_shared PROPERTIES OUTPUT_NAME
"
${
CMAKE_PROJECT_NAME
}
"
)
install
(
TARGETS
${
CMAKE_PROJECT_NAME
}
_shared ARCHIVE DESTINATION
${
INSTALL_PATH_LIB
}
LIBRARY DESTINATION
${
INSTALL_PATH_LIB
}
)
target_link_libraries
(
${
CMAKE_PROJECT_NAME
}
_shared
${
LINK_LIB_LIST
}
)
endif
()
#编译静态库
add_library
(
${
CMAKE_PROJECT_NAME
}
_static STATIC
${
SRC_LIST
}
)
set_target_properties
(
${
CMAKE_PROJECT_NAME
}
_static PROPERTIES OUTPUT_NAME
"
${
CMAKE_PROJECT_NAME
}
"
)
install
(
TARGETS
${
CMAKE_PROJECT_NAME
}
_static ARCHIVE DESTINATION
${
INSTALL_PATH_LIB
}
)
#使能GOP缓存
add_definitions
(
-DENABLE_RING_USEBUF
)
#添加库
add_library
(
zltoolkit STATIC
${
ToolKit_src_list
}
)
add_library
(
zlmediakit STATIC
${
MediaKit_src_list
}
)
if
(
NOT WIN32
)
list
(
APPEND LINK_LIB_LIST pthread
)
else
()
list
(
APPEND LINK_LIB_LIST WS2_32 Iphlpapi shlwapi
)
endif
()
message
(
STATUS
"linked libraries:
${
LINK_LIB_LIST
}
"
)
#测试程序
if
(
NOT IOS
)
add_subdirectory
(
tests
)
endif
()
add_subdirectory
(
tests
)
...
...
ZLToolKit
@
378e0503
Subproject commit 378e05030f5faef37612d9cb69adb70a222b0a9d
tests/CMakeLists.txt
查看文件 @
ee9b6b64
...
...
@@ -3,7 +3,7 @@ find_package(SDL QUIET)
if
(
SDL_FOUND
)
include_directories
(
${
SDL_INCLUDE_DIR
}
)
list
(
APPEND LINK_LIB_LIST
${
SDL_LIBRARY
}
)
message
(
STATUS
"
找到
SDL"
)
message
(
STATUS
"
found
SDL"
)
endif
()
#查找ffmpeg/libutil是否安装
...
...
@@ -11,7 +11,7 @@ find_package(AVUTIL QUIET)
if
(
AVUTIL_FOUND
)
include_directories
(
${
AVUTIL_INCLUDE_DIR
}
)
list
(
APPEND LINK_LIB_LIST
${
AVUTIL_LIBRARIES
}
)
message
(
STATUS
"
找到
libutil"
)
message
(
STATUS
"
found
libutil"
)
endif
()
#查找ffmpeg/libavcodec是否安装
...
...
@@ -19,31 +19,23 @@ find_package(AVCODEC QUIET)
if
(
AVCODEC_FOUND
)
include_directories
(
${
AVCODEC_INCLUDE_DIR
}
)
list
(
APPEND LINK_LIB_LIST
${
AVCODEC_LIBRARIES
}
)
message
(
STATUS
"
找到
libavcodec"
)
message
(
STATUS
"
found
libavcodec"
)
endif
()
aux_source_directory
(
. TEST_SRC_LIST
)
#如果ffmpeg/libavcodec ffmpeg/libavcodec SDL 都安装了则编译 test_player
if
(
SDL_FOUND AND AVCODEC_FOUND AND AVUTIL_FOUND
)
message
(
STATUS
"test_player
被编译
"
)
message
(
STATUS
"test_player
will be compiled
"
)
else
()
message
(
STATUS
"test_player
被忽略,如需编译,请先安装
sdl ffmpeg/libavcodec ffmpeg/libavcodec"
)
message
(
STATUS
"test_player
ingored, please install
sdl ffmpeg/libavcodec ffmpeg/libavcodec"
)
list
(
REMOVE_ITEM TEST_SRC_LIST ./test_player.cpp
)
endif
()
foreach
(
TEST_SRC
${
TEST_SRC_LIST
}
)
STRING
(
REGEX REPLACE
"^
\\
./|
\\
.c[a-zA-Z0-9_]*$"
""
TEST_EXE_NAME
${
TEST_SRC
}
)
message
(
STATUS
"
添加测试程序
:
${
TEST_EXE_NAME
}
"
)
message
(
STATUS
"
add test
:
${
TEST_EXE_NAME
}
"
)
add_executable
(
${
TEST_EXE_NAME
}
${
TEST_SRC
}
)
if
(
ANDROID
)
target_link_libraries
(
${
TEST_EXE_NAME
}
${
CMAKE_PROJECT_NAME
}
_static
${
LINK_LIB_LIST
}
)
elseif
(
WIN32
)
target_link_libraries
(
${
TEST_EXE_NAME
}
${
CMAKE_PROJECT_NAME
}
_shared
${
LINK_LIB_LIST
}
)
else
()
target_link_libraries
(
${
TEST_EXE_NAME
}
${
CMAKE_PROJECT_NAME
}
_shared
${
LINK_LIB_LIST
}
pthread
)
endif
()
target_link_libraries
(
${
TEST_EXE_NAME
}
${
LINK_LIB_LIST
}
)
endforeach
()
...
...
tests/test_rtmpPusher.cpp
查看文件 @
ee9b6b64
...
...
@@ -42,26 +42,27 @@ using namespace ZL::DEV;
//推流器,保持强引用
RtmpPusher
::
Ptr
pusher
;
//声明函数
void
rePushDelay
(
const
string
&
app
,
const
string
&
stream
,
const
string
&
url
);
void
rePushDelay
(
const
string
&
app
,
const
string
&
stream
,
const
string
&
url
);
//创建推流器并开始推流
void
createPusher
(
const
string
&
app
,
const
string
&
stream
,
const
string
&
url
)
{
void
createPusher
(
const
string
&
app
,
const
string
&
stream
,
const
string
&
url
)
{
//创建推流器并绑定一个RtmpMediaSource
pusher
.
reset
(
new
RtmpPusher
(
DEFAULT_VHOST
,
app
.
data
(),
stream
.
data
()));
pusher
.
reset
(
new
RtmpPusher
(
DEFAULT_VHOST
,
app
.
data
(),
stream
.
data
()));
//设置推流中断处理逻辑
pusher
->
setOnShutdown
([
app
,
stream
,
url
](
const
SockException
&
ex
)
{
pusher
->
setOnShutdown
([
app
,
stream
,
url
](
const
SockException
&
ex
)
{
WarnL
<<
"Server connection is closed:"
<<
ex
.
getErrCode
()
<<
" "
<<
ex
.
what
();
//重试
rePushDelay
(
app
,
stream
,
url
);
rePushDelay
(
app
,
stream
,
url
);
});
//设置发布结果处理逻辑
pusher
->
setOnPublished
([
app
,
stream
,
url
](
const
SockException
&
ex
)
{
pusher
->
setOnPublished
([
app
,
stream
,
url
](
const
SockException
&
ex
)
{
if
(
ex
)
{
WarnL
<<
"Publish fail:"
<<
ex
.
getErrCode
()
<<
" "
<<
ex
.
what
();
//如果发布失败,就重试
rePushDelay
(
app
,
stream
,
url
);
}
else
{
rePushDelay
(
app
,
stream
,
url
);
}
else
{
InfoL
<<
"Publish success,Please play with player:"
<<
url
;
}
});
...
...
@@ -69,61 +70,58 @@ void createPusher(const string &app,const string &stream,const string &url){
}
//推流失败或断开延迟2秒后重试推流
void
rePushDelay
(
const
string
&
app
,
const
string
&
stream
,
const
string
&
url
)
{
//上次延时两秒的任务可能还没执行,所以我们要先取消上次任务
AsyncTaskThread
::
Instance
().
CancelTask
(
0
);
//2秒后执行重新推流的任务
AsyncTaskThread
::
Instance
().
DoTaskDelay
(
0
,
2000
,
[
app
,
stream
,
url
]()
{
InfoL
<<
"Re-Publishing..."
;
//重新推流
createPusher
(
app
,
stream
,
url
);
//此任务不重复
void
rePushDelay
(
const
string
&
app
,
const
string
&
stream
,
const
string
&
url
)
{
//上次延时两秒的任务可能还没执行,所以我们要先取消上次任务
AsyncTaskThread
::
Instance
().
CancelTask
(
0
);
//2秒后执行重新推流的任务
AsyncTaskThread
::
Instance
().
DoTaskDelay
(
0
,
2000
,
[
app
,
stream
,
url
]()
{
InfoL
<<
"Re-Publishing..."
;
//重新推流
createPusher
(
app
,
stream
,
url
);
//此任务不重复
return
false
;
});
});
}
//这里才是真正执行main函数,你可以把函数名(domain)改成main,然后就可以输入自定义url了
int
domain
(
int
argc
,
const
char
*
argv
[])
{
//设置退出信号处理函数
signal
(
SIGINT
,
[](
int
){
EventPoller
::
Instance
().
shutdown
();});
//设置日志
Logger
::
Instance
().
add
(
std
::
make_shared
<
ConsoleChannel
>
(
"stdout"
,
LTrace
));
Logger
::
Instance
().
setWriter
(
std
::
make_shared
<
AsyncLogWriter
>
());
string
playUrl
=
argv
[
1
];
string
pushUrl
=
argv
[
2
];
//拉一个流,生成一个RtmpMediaSource,源的名称是"app/stream"
//你也可以以其他方式生成RtmpMediaSource,比如说MP4文件(请查看test_rtmpPusherMp4.cpp代码)
PlayerProxy
::
Ptr
player
(
new
PlayerProxy
(
DEFAULT_VHOST
,
"app"
,
"stream"
));
player
->
play
(
playUrl
.
data
());
//监听RtmpMediaSource注册事件,在PlayerProxy播放成功后触发
NoticeCenter
::
Instance
().
addListener
(
nullptr
,
Config
::
Broadcast
::
kBroadcastMediaChanged
,
[
pushUrl
](
BroadcastMediaChangedArgs
)
{
//媒体源"app/stream"已经注册,这时方可新建一个RtmpPusher对象并绑定该媒体源
createPusher
(
app
,
stream
,
pushUrl
);
});
//事件轮询
EventPoller
::
Instance
().
runLoop
();
//删除事件监听
NoticeCenter
::
Instance
().
delListener
(
nullptr
);
//销毁代理播放器、推流器
player
.
reset
();
pusher
.
reset
();
//清理程序
EventPoller
::
Destory
();
AsyncTaskThread
::
Destory
();
Logger
::
Destory
();
return
0
;
int
domain
(
const
string
&
playUrl
,
const
string
&
pushUrl
)
{
//设置退出信号处理函数
signal
(
SIGINT
,
[](
int
)
{
EventPoller
::
Instance
().
shutdown
();
});
//设置日志
Logger
::
Instance
().
add
(
std
::
make_shared
<
ConsoleChannel
>
(
"stdout"
,
LTrace
));
Logger
::
Instance
().
setWriter
(
std
::
make_shared
<
AsyncLogWriter
>
());
{
//拉一个流,生成一个RtmpMediaSource,源的名称是"app/stream"
//你也可以以其他方式生成RtmpMediaSource,比如说MP4文件(请查看test_rtmpPusherMp4.cpp代码)
PlayerProxy
::
Ptr
player
(
new
PlayerProxy
(
DEFAULT_VHOST
,
"app"
,
"stream"
));
player
->
play
(
playUrl
.
data
());
//监听RtmpMediaSource注册事件,在PlayerProxy播放成功后触发
NoticeCenter
::
Instance
().
addListener
(
nullptr
,
Config
::
Broadcast
::
kBroadcastMediaChanged
,
[
pushUrl
](
BroadcastMediaChangedArgs
)
{
//媒体源"app/stream"已经注册,这时方可新建一个RtmpPusher对象并绑定该媒体源
if
(
bRegist
&&
schema
==
RTMP_SCHEMA
){
createPusher
(
app
,
stream
,
pushUrl
);
}
});
//事件轮询
EventPoller
::
Instance
().
runLoop
();
}
//删除事件监听
NoticeCenter
::
Instance
().
delListener
(
nullptr
);
//清理程序
EventPoller
::
Destory
();
AsyncTaskThread
::
Destory
();
Logger
::
Destory
();
return
0
;
}
int
main
(
int
argc
,
char
*
argv
[]){
const
char
*
argList
[]
=
{
argv
[
0
],
"rtmp://live.hkstv.hk.lxdns.com/live/hks"
,
argv
[
1
]};
return
domain
(
3
,
argList
);
int
main
(
int
argc
,
char
*
argv
[])
{
return
domain
(
"rtmp://live.hkstv.hk.lxdns.com/live/hks"
,
"rtmp://jizan.iok.la/live/stream"
);
}
...
...
tests/test_rtmpPusherMp4.cpp
查看文件 @
ee9b6b64
...
...
@@ -48,7 +48,6 @@ RtmpPusher::Ptr pusher;
void
rePushDelay
(
const
string
&
app
,
const
string
&
stream
,
const
string
&
url
);
void
createPusher
(
const
string
&
app
,
const
string
&
stream
,
const
string
&
url
);
//创建推流器并开始推流
void
createPusher
(
const
string
&
app
,
const
string
&
stream
,
const
string
&
url
){
auto
rtmpSrc
=
dynamic_pointer_cast
<
RtmpMediaSource
>
(
MediaReader
::
onMakeMediaSource
(
RTMP_SCHEMA
,
DEFAULT_VHOST
,
app
,
stream
));
...
...
@@ -94,18 +93,13 @@ void rePushDelay(const string &app,const string &stream,const string &url){
}
//这里才是真正执行main函数,你可以把函数名(domain)改成main,然后就可以输入自定义url了
int
domain
(
int
argc
,
const
char
*
argv
[]
){
int
domain
(
const
string
&
filePath
,
const
string
&
pushUrl
){
//设置退出信号处理函数
signal
(
SIGINT
,
[](
int
){
EventPoller
::
Instance
().
shutdown
();});
//设置日志
Logger
::
Instance
().
add
(
std
::
make_shared
<
ConsoleChannel
>
(
"stdout"
,
LTrace
));
Logger
::
Instance
().
setWriter
(
std
::
make_shared
<
AsyncLogWriter
>
());
//filePath同时也是流id
string
filePath
=
argv
[
1
];
//推流地址
string
pushUrl
=
argv
[
2
];
//录像应用名称默认为record
string
appName
=
mINI
::
Instance
()[
Config
::
Record
::
kAppName
];
//app必须record,filePath(流id)为相对于httpRoot/record的路径,否则MediaReader会找到不该文件
...
...
@@ -131,8 +125,7 @@ int domain(int argc,const char *argv[]){
int
main
(
int
argc
,
char
*
argv
[]){
//MP4文件需要放置在 httpRoot/record目录下,文件负载必须为h264+aac
//可以使用test_server生成的mp4文件
const
char
*
argList
[]
=
{
argv
[
0
],
"app/stream/2017-09-30/12-55-38.mp4"
,
"rtmp://jizan.iok.la/live/test"
};
return
domain
(
3
,
argList
);
return
domain
(
"app/stream/2017-09-30/12-55-38.mp4"
,
"rtmp://jizan.iok.la/live/test"
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论