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
d98f0bad
Commit
d98f0bad
authored
Jun 20, 2022
by
custompal
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into cus_pr
同步代码
parents
ea53da64
67606050
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
152 行增加
和
40 行删除
+152
-40
.github/workflows/android.yml
+25
-0
.github/workflows/ccpp.yml
+2
-2
.github/workflows/docker.yml
+82
-0
.github/workflows/macos.yml
+2
-2
.github/workflows/msvc-ci.yml
+3
-3
.gitmodules_github
+6
-0
Android/app/build.gradle
+1
-1
Android/app/src/main/cpp/CMakeLists.txt
+5
-3
Android/build.gradle
+1
-1
Android/gradle/wrapper/gradle-wrapper.properties
+2
-2
CMakeLists.txt
+1
-1
README.md
+2
-5
README_en.md
+1
-1
dockerfile
+7
-9
src/Record/MP4Recorder.cpp
+12
-10
没有找到文件。
.github/workflows/android.yml
0 → 100644
查看文件 @
d98f0bad
name
:
Android CI
on
:
[
push
,
pull_request
]
jobs
:
build
:
runs-on
:
ubuntu-20.04
steps
:
-
name
:
下载源码
uses
:
actions/checkout@v1
-
name
:
配置JDK
uses
:
actions/setup-java@v3
with
:
java-version
:
'
11'
distribution
:
'
temurin'
cache
:
gradle
-
name
:
下载submodule源码
run
:
mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init
-
name
:
赋予gradlew文件可执行权限
run
:
chmod +x ./Android/gradlew
-
name
:
编译
run
:
cd Android && ./gradlew build
.github/workflows/ccpp.yml
查看文件 @
d98f0bad
...
...
@@ -11,7 +11,7 @@ jobs:
-
uses
:
actions/checkout@v1
-
name
:
下载submodule源码
run
:
git submodule update --init
run
:
mv -f .gitmodules_github .gitmodules && git submodule sync &&
git submodule update --init
-
name
:
apt-get安装依赖库(非必选)
run
:
sudo apt-get update && sudo apt-get install -y cmake libssl-dev libsdl-dev libavcodec-dev libavutil-dev
...
...
@@ -28,7 +28,7 @@ jobs:
run
:
cd 3rdpart/libsrtp && ./configure --enable-openssl && make -j4 && sudo make install
-
name
:
编译
run
:
mkdir -p linux_build && cd linux_build && cmake .. -DENABLE_WEBRTC:BOOL=TRUE && make -j
4
run
:
mkdir -p linux_build && cd linux_build && cmake .. -DENABLE_WEBRTC:BOOL=TRUE && make -j
$(nproc)
-
name
:
运行MediaServer
run
:
pwd && cd release/linux/Debug && sudo ./MediaServer -d &
...
...
.github/workflows/docker.yml
0 → 100644
查看文件 @
d98f0bad
name
:
Docker
on
:
[
push
,
pull_request
]
env
:
# Use docker.io for Docker Hub if empty
REGISTRY
:
docker.io
IMAGE_NAME
:
zlmediakit/zlmediakit
jobs
:
build
:
runs-on
:
ubuntu-latest
permissions
:
contents
:
read
packages
:
write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token
:
write
steps
:
-
name
:
Checkout repository
uses
:
actions/checkout@v3
-
name
:
下载submodule源码
run
:
mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
-
name
:
Install cosign
if
:
github.event_name != 'pull_request'
uses
:
sigstore/cosign-installer@d6a3abf1bdea83574e28d40543793018b6035605
with
:
cosign-release
:
'
v1.7.1'
# Workaround: https://github.com/docker/build-push-action/issues/461
-
name
:
Setup Docker buildx
uses
:
docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
-
name
:
Log into registry ${{ env.REGISTRY }}
if
:
github.event_name != 'pull_request'
uses
:
docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with
:
registry
:
${{ env.REGISTRY }}
username
:
zlmediakit
password
:
${{ secrets.DOCKER_IO_SECRET }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
-
name
:
Extract Docker metadata
id
:
meta
uses
:
docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with
:
images
:
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
-
name
:
Build and push Docker image
id
:
build-and-push
uses
:
docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with
:
context
:
.
push
:
${{ github.event_name != 'pull_request' }}
tags
:
${{ steps.meta.outputs.tags }}
labels
:
${{ steps.meta.outputs.labels }}
build-args
:
MODEL=Release
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
# - name: Sign the published Docker image
# if: ${{ github.event_name != 'pull_request' }}
# env:
# COSIGN_EXPERIMENTAL: "true"
# # This step uses the identity token to provision an ephemeral certificate
# # against the sigstore community Fulcio instance.
# run: cosign sign ${{ steps.meta.outputs.tags }}@${{ steps.build-and-push.outputs.digest }}
.github/workflows/macos.yml
查看文件 @
d98f0bad
...
...
@@ -11,7 +11,7 @@ jobs:
-
uses
:
actions/checkout@v1
-
name
:
下载submodule源码
run
:
git submodule update --init
run
:
mv -f .gitmodules_github .gitmodules && git submodule sync &&
git submodule update --init
# - name: 安装brew
# run: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
...
...
@@ -31,7 +31,7 @@ jobs:
# run: cd 3rdpart/libsrtp && ./configure --enable-openssl && make -j4 && sudo make install
-
name
:
编译
run
:
mkdir -p build && cd build && cmake .. &&
make -j4
run
:
mkdir -p build && cd build && cmake .. &&
make -j $(nproc)
-
name
:
运行MediaServer
run
:
pwd && cd release/linux/Debug && sudo ./MediaServer -d &
...
...
.github/workflows/msvc-ci.yml
查看文件 @
d98f0bad
...
...
@@ -8,9 +8,9 @@ jobs:
steps
:
-
uses
:
actions/checkout@v1
with
:
submodules
:
'
recursive'
fetch-depth
:
1
-
name
:
下载submodule源码
run
:
mv -Force .gitmodules_github .gitmodules && git submodule sync && git submodule update --init
-
name
:
配置 vcpkg
uses
:
lukka/run-vcpkg@v7
...
...
.gitmodules_github
0 → 100644
查看文件 @
d98f0bad
[submodule "ZLToolKit"]
path = 3rdpart/ZLToolKit
url = https://github.com/ZLMediaKit/ZLToolKit
[submodule "3rdpart/media-server"]
path = 3rdpart/media-server
url = https://github.com/ireader/media-server
Android/app/build.gradle
查看文件 @
d98f0bad
...
...
@@ -17,7 +17,7 @@ android {
}
}
ndk
{
abiFilters
"arm
eabi-v7a"
//, "arm64-v8
a"
abiFilters
"arm
64-v8a"
//, "armeabi-v7
a"
}
}
}
...
...
Android/app/src/main/cpp/CMakeLists.txt
查看文件 @
d98f0bad
...
...
@@ -8,9 +8,11 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/libs_export/${AND
set
(
CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
/libs_export/
${
ANDROID_ABI
}
)
set
(
EXECUTABLE_OUTPUT_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
/libs_export/
${
ANDROID_ABI
}
/binary
)
set
(
OPENSSL_ROOT_DIR
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../libs/
${
ANDROID_ABI
}
"
)
set
(
OPENSSL_INCLUDE_DIR
"
${
OPENSSL_ROOT_DIR
}
/include"
)
set
(
OPENSSL_CRYPTO_LIBRARY
"
${
OPENSSL_ROOT_DIR
}
/libcrypto.a"
)
set
(
OPENSSL_SSL_LIBRARY
"
${
OPENSSL_ROOT_DIR
}
/libssl.a"
)
#由于openssl库编译时未指定-fPIC,到时github action ci编译失败,先屏蔽掉
#set(OPENSSL_INCLUDE_DIR "${OPENSSL_ROOT_DIR}/include")
#set(OPENSSL_CRYPTO_LIBRARY "${OPENSSL_ROOT_DIR}/libcrypto.a")
#set(OPENSSL_SSL_LIBRARY "${OPENSSL_ROOT_DIR}/libssl.a")
#设置工程源码根目录
set
(
JNI_Root
${
CMAKE_CURRENT_SOURCE_DIR
}
)
...
...
Android/build.gradle
查看文件 @
d98f0bad
...
...
@@ -7,7 +7,7 @@ buildscript {
}
dependencies
{
classpath
'com.android.tools.build:gradle:
3.3
.1'
classpath
'com.android.tools.build:gradle:
4.0
.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
...
...
Android/gradle/wrapper/gradle-wrapper.properties
查看文件 @
d98f0bad
#
Fri May 10 12:15:32 CST 2019
#
Sun Jun 19 15:19:24 CST 2022
distributionBase
=
GRADLE_USER_HOME
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-
4.10
.1-all.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-
6.1
.1-all.zip
CMakeLists.txt
查看文件 @
d98f0bad
...
...
@@ -308,7 +308,7 @@ if (JEMALLOC_FOUND)
endif
()
#查找openssl是否安装
find_package
(
O
PEN
SSL QUIET
)
find_package
(
O
pen
SSL QUIET
)
if
(
OPENSSL_FOUND AND ENABLE_OPENSSL
)
message
(
STATUS
"found library:
${
OPENSSL_LIBRARIES
}
,ENABLE_OPENSSL defined"
)
include_directories
(
${
OPENSSL_INCLUDE_DIR
}
)
...
...
README.md
查看文件 @
d98f0bad
...
...
@@ -140,11 +140,8 @@
你可以从Docker Hub下载已经编译好的镜像并启动它:
```
bash
#此镜像为zlmediakit开发团队提供,推荐
docker run
-id
-p
1935:1935
-p
8080:80
-p
8554:554
-p
10000:10000
-p
10000:10000/udp
-p
8000:8000/udp zlmediakit/zlmediakit:Release.last
#此镜像委托第三方提供
docker run
-id
-p
1935:1935
-p
8080:80
-p
8554:554
-p
10000:10000
-p
10000:10000/udp panjjo/zlmediakit
#此镜像为github持续集成自动编译推送,跟代码(master分支)保持最新状态
docker run
-id
-p
1935:1935
-p
8080:80
-p
8443:443
-p
8554:554
-p
10000:10000
-p
10000:10000/udp
-p
8000:8000/udp
-p
9000:9000/udp zlmediakit/zlmediakit:master
```
你也可以根据Dockerfile编译镜像:
...
...
README_en.md
查看文件 @
d98f0bad
...
...
@@ -257,7 +257,7 @@ git submodule update --init
## Docker Image
You can pull a pre-built docker image from Docker Hub and run with
```
bash
docker run -id -p 1935:1935 -p 8080:80 -p 8
554:554 -p 10000:10000 -p 10000:10000/udp panjjo/zlmediakit
docker run -id -p 1935:1935 -p 8080:80 -p 8
443:443 -p 8554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp -p 9000:9000/udp zlmediakit/zlmediakit:master
```
Dockerfile is also supplied to build images on Ubuntu 16.04
...
...
dockerfile
查看文件 @
d98f0bad
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
80/tcp
...
...
@@ -9,8 +8,9 @@ EXPOSE 443/tcp
EXPOSE
10000/udp
EXPOSE
10000/tcp
EXPOSE
8000/udp
EXPOSE
9000/udp
ADD
sources.list /etc/apt/sources.list
#
ADD sources.list /etc/apt/sources.list
RUN
apt-get update
&&
\
DEBIAN_FRONTEND
=
"noninteractive"
\
...
...
@@ -29,12 +29,11 @@ RUN apt-get update && \
libfaac-dev
\
gcc
\
g++
\
gdb
\
libmp4v2-dev
&&
\
gdb
&&
\
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
&&
\
cd
libsrtp-2.2.0
&&
./configure
--enable-openssl
&&
make
-j
$(
nproc
)
&&
make install
&&
\
rm
-rf
/var/lib/apt/lists/
*
RUN
mkdir
-p
/opt/media
...
...
@@ -45,12 +44,12 @@ 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
-j
8
make
-j
$(
nproc
)
FROM
ubuntu:18.04
ARG
MODEL
ADD
sources.list /etc/apt/sources.list
#
ADD sources.list /etc/apt/sources.list
RUN
apt-get update
&&
\
DEBIAN_FRONTEND
=
"noninteractive"
\
...
...
@@ -66,8 +65,7 @@ RUN apt-get update && \
ffmpeg
\
gcc
\
g++
\
gdb
\
libmp4v2-dev
&&
\
gdb
&&
\
apt-get autoremove
-y
&&
\
apt-get clean
-y
&&
\
rm
-rf
/var/lib/apt/lists/
*
...
...
src/Record/MP4Recorder.cpp
查看文件 @
d98f0bad
...
...
@@ -73,15 +73,18 @@ void MP4Recorder::asyncClose() {
info
.
time_len
=
(
float
)
(
::
time
(
NULL
)
-
info
.
start_time
);
//关闭mp4非常耗时,所以要放在后台线程执行
muxer
->
closeMP4
();
//获取文件大小
info
.
file_size
=
File
::
fileSize
(
full_path_tmp
.
data
());
if
(
info
.
file_size
<
1024
)
{
//录像文件太小,删除之
File
::
delete_file
(
full_path_tmp
.
data
());
return
;
if
(
!
full_path_tmp
.
empty
())
{
//获取文件大小
info
.
file_size
=
File
::
fileSize
(
full_path_tmp
.
data
());
if
(
info
.
file_size
<
1024
)
{
//录像文件太小,删除之
File
::
delete_file
(
full_path_tmp
.
data
());
return
;
}
//临时文件名改成正式文件名,防止mp4未完成时被访问
rename
(
full_path_tmp
.
data
(),
full_path
.
data
());
}
//临时文件名改成正式文件名,防止mp4未完成时被访问
rename
(
full_path_tmp
.
data
(),
full_path
.
data
());
/////record 业务逻辑//////
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastRecordMP4
,
info
);
...
...
@@ -138,4 +141,4 @@ void MP4Recorder::resetTracks() {
}
/* namespace mediakit */
#endif //ENABLE_MP4
\ No newline at end of file
#endif //ENABLE_MP4
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论