mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
Merge branch 'master' into cus_pr
同步代码
This commit is contained in:
commit
d98f0badbd
25
.github/workflows/android.yml
vendored
Normal file
25
.github/workflows/android.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
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
|
4
.github/workflows/ccpp.yml
vendored
4
.github/workflows/ccpp.yml
vendored
@ -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 -j4
|
||||
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 &
|
||||
|
82
.github/workflows/docker.yml
vendored
Normal file
82
.github/workflows/docker.yml
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
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 }}
|
4
.github/workflows/macos.yml
vendored
4
.github/workflows/macos.yml
vendored
@ -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 &
|
||||
|
6
.github/workflows/msvc-ci.yml
vendored
6
.github/workflows/msvc-ci.yml
vendored
@ -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
|
||||
|
6
.gitmodules_github
Normal file
6
.gitmodules_github
Normal file
@ -0,0 +1,6 @@
|
||||
[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
|
@ -17,7 +17,7 @@ android {
|
||||
}
|
||||
}
|
||||
ndk {
|
||||
abiFilters "armeabi-v7a"//, "arm64-v8a"
|
||||
abiFilters "arm64-v8a" //, "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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})
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
#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
|
||||
|
@ -308,7 +308,7 @@ if (JEMALLOC_FOUND)
|
||||
endif ()
|
||||
|
||||
#查找openssl是否安装
|
||||
find_package(OPENSSL QUIET)
|
||||
find_package(OpenSSL QUIET)
|
||||
if (OPENSSL_FOUND AND ENABLE_OPENSSL)
|
||||
message(STATUS "found library:${OPENSSL_LIBRARIES},ENABLE_OPENSSL defined")
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
|
@ -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编译镜像:
|
||||
|
@ -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 8554:554 -p 10000:10000 -p 10000:10000/udp panjjo/zlmediakit
|
||||
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 is also supplied to build images on Ubuntu 16.04
|
||||
|
16
dockerfile
16
dockerfile
@ -1,7 +1,6 @@
|
||||
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 -j8
|
||||
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/*
|
||||
|
@ -73,6 +73,8 @@ void MP4Recorder::asyncClose() {
|
||||
info.time_len = (float) (::time(NULL) - info.start_time);
|
||||
//关闭mp4非常耗时,所以要放在后台线程执行
|
||||
muxer->closeMP4();
|
||||
|
||||
if(!full_path_tmp.empty()) {
|
||||
//获取文件大小
|
||||
info.file_size = File::fileSize(full_path_tmp.data());
|
||||
if (info.file_size < 1024) {
|
||||
@ -82,6 +84,7 @@ void MP4Recorder::asyncClose() {
|
||||
}
|
||||
//临时文件名改成正式文件名,防止mp4未完成时被访问
|
||||
rename(full_path_tmp.data(), full_path.data());
|
||||
}
|
||||
|
||||
/////record 业务逻辑//////
|
||||
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastRecordMP4, info);
|
||||
|
Loading…
Reference in New Issue
Block a user