Merge branch 'master' of github.com:ZLMediaKit/ZLMediaKit

This commit is contained in:
ziyue 2021-09-14 16:27:50 +08:00
commit 869a707c04
9 changed files with 281 additions and 9 deletions

View File

@ -92,11 +92,12 @@
- RTSP/RTMP/HTTP-FLV/WS-FLV支持MP4文件点播支持seek
- 支持H264/H265/AAC/G711/OPUS编码
- WebRTC(体验)
- WebRTC
- 支持WebRTC推流支持转其他协议
- 支持WebRTC播放支持其他协议转WebRTC
- 支持simulcast
- 支持rtx/nack
- **支持单端口、多线程、客户端网络连接迁移(开源界唯一)**
- 其他
- 支持丰富的restful api以及web hook事件

View File

@ -1,7 +1,69 @@
#!/bin/bash
set -e
docker build -t gemfield/zlmediakit:20.04-runtime-ubuntu18.04 -f docker/ubuntu18.04/Dockerfile.runtime .
docker build -t gemfield/zlmediakit:20.04-devel-ubuntu18.04 -f docker/ubuntu18.04/Dockerfile.devel .
docker build -t gemfield/zlmediakit:20.04-runtime-ubuntu16.04 -f docker/ubuntu16.04/Dockerfile.runtime .
docker build -t gemfield/zlmediakit:20.04-devel-ubuntu16.04 -f docker/ubuntu16.04/Dockerfile.devel .
docker build -t gemfield/zlmediakit:centos7-runtime -f docker/centos7/Dockerfile.runtime .
while getopts c:t:m:v: opt
do
case $opt in
t)
type=$OPTARG
;;
v)
version=$OPTARG
;;
m)
model=$OPTARG
;;
?)
echo "unkonwn"
exit
;;
esac
done
if [[ ! -n $type ]];then
echo ".sh [-t build|push] [-m Debug|Release] [-v [version]]"
exit
fi
if [[ ! -n $model ]];then
echo ".sh [-t build|push] [-m Debug|Release] [-v [version]]"
exit
fi
if [[ ! -n $version ]];then
echo "use latest no version set"
version="latest"
fi
case $model in
'Debug')
;;
'Release')
;;
*)
echo "unkonwn model"
echo ".sh [-t build|push] [-m Debug|Release] [-v [version]]"
exit
;;
esac
namespace="zlmediakit"
packagename="zlm-mediaserver"
case $type in
'build')
rm -rf ./build/CMakeCache.txt
# 以腾讯云账号为例
docker build --build-arg MODEL=$model -t ccr.ccs.tencentyun.com/$namespace/$packagename:$model.$version .
;;
'push')
echo "push to dst registry"
# 以腾讯云账号为例
docker login --username=default_name ccr.ccs.tencentyun.com
docker push ccr.ccs.tencentyun.com/$namespace/$packagename:$model.$version
;;
*)
echo "unkonwn type"
echo ".sh [-t build|push] [-m Debug|Release] [-v [version]]"
exit
;;
esac

View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
docker build -t gemfield/zlmediakit:20.04-runtime-ubuntu18.04 -f ubuntu18.04/Dockerfile.runtime .
docker build -t gemfield/zlmediakit:20.04-devel-ubuntu18.04 -f ubuntu18.04/Dockerfile.devel .
docker build -t gemfield/zlmediakit:20.04-runtime-ubuntu16.04 -f ubuntu16.04/Dockerfile.runtime .
docker build -t gemfield/zlmediakit:20.04-devel-ubuntu16.04 -f ubuntu16.04/Dockerfile.devel .
docker build -t gemfield/zlmediakit:centos7-runtime -f centos7/Dockerfile.runtime .

82
dockerfile Normal file
View File

@ -0,0 +1,82 @@
FROM ubuntu:18.04 AS build
ARG MODEL
#shell,rtmp,rtsp,rtsps,http,https,rtp
EXPOSE 9000/tcp
EXPOSE 1935/tcp
EXPOSE 554/tcp
EXPOSE 322/tcp
EXPOSE 80/tcp
EXPOSE 443/tcp
EXPOSE 10000/udp
EXPOSE 10000/tcp
EXPOSE 8000/udp
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
curl \
vim \
wget \
ca-certificates \
tzdata \
libssl-dev \
libmysqlclient-dev \
libx264-dev \
libfaac-dev \
gcc \
g++ \
gdb \
libmp4v2-dev && \
apt-get autoremove -y && \
apt-get clean -y && \
wget https://github.com/cisco/libsrtp/archive/v2.2.0.tar.gz -O libsrtp-2.2.0.tar.gz && tar xfv libsrtp-2.2.0.tar.gz && \
cd libsrtp-2.2.0 && ./configure --enable-openssl && make && make install && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /opt/media
COPY . /opt/media/ZLMediaKit
WORKDIR /opt/media/ZLMediaKit
#RUN git submodule update --init --recursive && \
RUN mkdir -p build release/linux/${MODEL}/
WORKDIR /opt/media/ZLMediaKit/build
RUN cmake -DCMAKE_BUILD_TYPE=${MODEL} -DENABLE_WEBRTC=true -DENABLE_TESTS=false -DENABLE_API=false .. && \
make -j8
FROM ubuntu:18.04
ARG MODEL
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-recommends \
vim \
wget \
ca-certificates \
tzdata \
curl \
libssl-dev \
libx264-dev \
libfaac-dev \
ffmpeg \
gcc \
g++ \
gdb \
libmp4v2-dev && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone && \
mkdir -p /opt/media/bin/www
WORKDIR /opt/media/bin/
COPY --from=build /opt/media/ZLMediaKit/release/linux/${MODEL}/MediaServer /opt/media/ZLMediaKit/tests/default.pem /opt/media/bin/
COPY --from=build /opt/media/ZLMediaKit/release/linux/${MODEL}/config.ini /opt/media/conf/
COPY --from=build /opt/media/ZLMediaKit/www/ /opt/media/bin/www/
ENV PATH /opt/media/bin:$PATH
CMD ["sh","-c","./MediaServer -s default.pem -c ../conf/config.ini"]

31
k8s_readme.md Normal file
View File

@ -0,0 +1,31 @@
# k8s部署建议
## 编译
- 方式一
可以自己写脚本编译
- 方式二
可以使用自带`build_docker_images.sh`脚本编译,具体参见[部署](##部署)
## 部署
- 可以是用根目录下面build_docker_images.sh脚本进行编译与推送到指定仓库
- 推送
推送之前务必修改脚本中`镜像仓库用户名与仓库地址`。有需要也可以同时修改`命名空间与包名`。
- 编译
```shell
sh build_docker_images.sh [-t build|push] [-m Debug|Release] [-v [version]]
-t: 指定编译类型build 编译镜像 push 推送到指定仓库
-m: 编译类型
-v版本号
```
- 如果需要自定义配置文件,可以使用`configMap`挂载到pod中`/opt/media/conf/`目录来覆盖默认配置文件
- 如果需要自定义证书,请替换源码目录`tests`目录下面的`default.pem`证书文件zlmedia在pod启动时候会默认加载。

View File

@ -141,7 +141,7 @@ public:
(*_parser) << Option('s',/*该选项简称,如果是\x00则说明无简称*/
"ssl",/*该选项全称,每个选项必须有全称不得为null或空字符串*/
Option::ArgRequired,/*该选项后面必须跟值*/
(exeDir() + "ssl.p12").data(),/*该选项默认值*/
(exeDir() + "default.pem").data(),/*该选项默认值*/
false,/*该选项是否必须赋值如果没有默认值且为ArgRequired时用户必须提供该参数否则将抛异常*/
"ssl证书文件或文件夹,支持p12/pem类型",/*该选项说明文字*/
nullptr);

View File

@ -1,10 +1,10 @@
execute_process(COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/ssl.p12 ${EXECUTABLE_OUTPUT_PATH}/)
execute_process(COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/default.pem ${EXECUTABLE_OUTPUT_PATH}/)
aux_source_directory(. TEST_SRC_LIST)
foreach (TEST_SRC ${TEST_SRC_LIST})
if (NOT ENABLE_WEBRTC)
# WebRTC
if ("${TEST_SRC}" MATCHES "test_rtcp_nack\.cpp")
if ("${TEST_SRC}" MATCHES "test_rtcp_nack.cpp")
continue()
endif ()
endif ()

89
tests/default.pem Normal file
View File

@ -0,0 +1,89 @@
-----BEGIN CERTIFICATE-----
MIIGATCCBOmgAwIBAgIQC+3yGsMpfdf8+/3qyyeKMjANBgkqhkiG9w0BAQsFADBu
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
d3cuZGlnaWNlcnQuY29tMS0wKwYDVQQDEyRFbmNyeXB0aW9uIEV2ZXJ5d2hlcmUg
RFYgVExTIENBIC0gRzEwHhcNMjEwOTEzMDAwMDAwWhcNMjIwOTEzMjM1OTU5WjAh
MR8wHQYDVQQDExZkZWZhdWx0LnpsbWVkaWFraXQuY29tMIIBIjANBgkqhkiG9w0B
AQEFAAOCAQ8AMIIBCgKCAQEAiTtbBLk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