release 8.0

This commit is contained in:
夏楚 2023-12-09 16:23:51 +08:00 committed by GitHub
parent 44c82752b3
commit bbe8f4a018
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
346 changed files with 2529 additions and 3435 deletions

View File

@ -14,6 +14,6 @@ assignees: ''
- 此处展开您咨询内容的描述 - 此处展开您咨询内容的描述
**注意事项** **注意事项**
- 技术咨询前请先认真阅读readme, [wiki](https://github.com/xia-chu/ZLMediaKit/wiki),如有必要您也可以同时搜索已经答复的issue如果没找到答案才在此提issue - 技术咨询前请先认真阅读readme, [wiki](https://github.com/ZLMediaKit/ZLMediaKit/wiki),如有必要您也可以同时搜索已经答复的issue如果没找到答案才在此提issue
- 技术咨询不属于bug缺陷要求用户先star(收藏)本项目否则会直接关闭issue - 技术咨询不属于bug缺陷要求用户先star(收藏)本项目否则会直接关闭issue

View File

@ -47,7 +47,7 @@ set(MediaServer_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/media-server")
# TODO: # TODO:
# movflv MP4 # movflv MP4
if (ENABLE_MP4 OR ENABLE_HLS_FMP4) if (ENABLE_MP4)
# MOV # MOV
set(MediaServer_MOV_ROOT ${MediaServer_ROOT}/libmov) set(MediaServer_MOV_ROOT ${MediaServer_ROOT}/libmov)
aux_source_directory(${MediaServer_MOV_ROOT}/include MOV_SRC_LIST) aux_source_directory(${MediaServer_MOV_ROOT}/include MOV_SRC_LIST)
@ -80,10 +80,6 @@ if (ENABLE_MP4 OR ENABLE_HLS_FMP4)
message(STATUS "ENABLE_MP4 defined") message(STATUS "ENABLE_MP4 defined")
update_cached_list(MK_COMPILE_DEFINITIONS ENABLE_MP4) update_cached_list(MK_COMPILE_DEFINITIONS ENABLE_MP4)
endif () endif ()
if (ENABLE_HLS_FMP4)
message(STATUS "ENABLE_HLS_FMP4 defined")
update_cached_list(MK_COMPILE_DEFINITIONS ENABLE_HLS_FMP4)
endif ()
endif () endif ()
# mpeg ts # mpeg ts

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -44,7 +44,6 @@ option(ENABLE_JEMALLOC_STATIC "Enable static linking to the jemalloc library" OF
option(ENABLE_JEMALLOC_DUMP "Enable jemalloc to dump malloc statistics" OFF) option(ENABLE_JEMALLOC_DUMP "Enable jemalloc to dump malloc statistics" OFF)
option(ENABLE_MEM_DEBUG "Enable Memory Debug" OFF) option(ENABLE_MEM_DEBUG "Enable Memory Debug" OFF)
option(ENABLE_MP4 "Enable MP4" ON) option(ENABLE_MP4 "Enable MP4" ON)
option(ENABLE_HLS_FMP4 "Enable HLS-FMP4" ON)
option(ENABLE_MSVC_MT "Enable MSVC Mt/Mtd lib" ON) option(ENABLE_MSVC_MT "Enable MSVC Mt/Mtd lib" ON)
option(ENABLE_MYSQL "Enable MySQL" OFF) option(ENABLE_MYSQL "Enable MySQL" OFF)
option(ENABLE_OPENSSL "Enable OpenSSL" ON) option(ENABLE_OPENSSL "Enable OpenSSL" ON)

10
LICENSE
View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -19,3 +19,11 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
----------------------------------------------------------------------------------------
补充协议:
本项目采用类MIT协议用户在履行MIT协议义务的同时应当同时遵循保留ZLMediaKit软件版权信息的义务。
用户不得去除ZLMediaKit提供的各种服务中包括但不限于 "title"、"Server"、"User-Agent" 等字段中 "ZLMediaKit" 的信息。
否则本项目主要权利人(项目发起人、主要作者)保留声索起诉的权利。

View File

@ -157,7 +157,7 @@ It is recommended to compile on Ubuntu or macOS. Compiling on Windows is cumbers
- **You must use Git to clone the complete code. Do not download the source code by downloading the ZIP package. Otherwise, the submodule code will not be downloaded by default. You can do it like this:** - **You must use Git to clone the complete code. Do not download the source code by downloading the ZIP package. Otherwise, the submodule code will not be downloaded by default. You can do it like this:**
``` ```
git clone https://github.com/xia-chu/ZLMediaKit.git git clone https://github.com/ZLMediaKit/ZLMediaKit.git
cd ZLMediaKit cd ZLMediaKit
git submodule update --init git submodule update --init
``` ```

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -280,7 +280,6 @@ API_EXPORT uint16_t API_CALL mk_rtc_server_start(uint16_t port) {
class WebRtcArgsUrl : public mediakit::WebRtcArgs { class WebRtcArgsUrl : public mediakit::WebRtcArgs {
public: public:
WebRtcArgsUrl(std::string url) { _url = std::move(url); } WebRtcArgsUrl(std::string url) { _url = std::move(url); }
~WebRtcArgsUrl() = default;
toolkit::variant operator[](const std::string &key) const override { toolkit::variant operator[](const std::string &key) const override {
if (key == "url") { if (key == "url") {
@ -305,7 +304,8 @@ API_EXPORT void API_CALL mk_webrtc_get_answer_sdp2(void *user_data, on_user_data
auto session = std::make_shared<HttpSession>(Socket::createSocket()); auto session = std::make_shared<HttpSession>(Socket::createSocket());
std::string offer_str = offer; std::string offer_str = offer;
std::shared_ptr<void> ptr(user_data, user_data_free ? user_data_free : [](void *) {}); std::shared_ptr<void> ptr(user_data, user_data_free ? user_data_free : [](void *) {});
WebRtcPluginManager::Instance().getAnswerSdp(*session, type, WebRtcArgsUrl(url), auto args = std::make_shared<WebRtcArgsUrl>(url);
WebRtcPluginManager::Instance().getAnswerSdp(*session, type, *args,
[offer_str, session, ptr, cb](const WebRtcInterface &exchanger) mutable { [offer_str, session, ptr, cb](const WebRtcInterface &exchanger) mutable {
try { try {
auto sdp_answer = exchangeSdp(exchanger, offer_str); auto sdp_answer = exchangeSdp(exchanger, offer_str);

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,115 +1,70 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
#include "mk_frame.h" #include "mk_frame.h"
#include "mk_track.h"
#include "Extension/Frame.h"
#include "Extension/H264.h"
#include "Extension/H265.h"
#include "Extension/AAC.h"
#include "Record/MPEG.h" #include "Record/MPEG.h"
#include "Extension/Factory.h"
using namespace mediakit; using namespace mediakit;
extern "C" { extern "C" {
#define XX(name, type, value, str, mpeg_id) API_EXPORT const int MK##name = value; #define XX(name, type, value, str, mpeg_id, mp4_id) API_EXPORT const int MK##name = value;
CODEC_MAP(XX) CODEC_MAP(XX)
#undef XX #undef XX
} }
class FrameFromPtrForC : public FrameFromPtr { namespace {
class BufferFromPtr : public toolkit::Buffer {
public: public:
using Ptr = std::shared_ptr<FrameFromPtrForC>; BufferFromPtr(char *ptr, size_t size, on_mk_frame_data_release cb, std::shared_ptr<void> user_data) {
_ptr = ptr;
template<typename ...ARGS> _size = size;
FrameFromPtrForC(bool cache_able, uint32_t flags, on_mk_frame_data_release cb, std::shared_ptr<void> user_data, ARGS &&...args) : FrameFromPtr(
std::forward<ARGS>(args)...) {
_flags = flags;
_cb = cb; _cb = cb;
_user_data = std::move(user_data); _user_data = std::move(user_data);
_cache_able = cache_able;
} }
~FrameFromPtrForC() override { ~BufferFromPtr() override {
if (_cb) {
_cb(_user_data.get(), _ptr); _cb(_user_data.get(), _ptr);
} }
}
bool cacheAble() const override { char *data() const override { return _ptr; }
return _cache_able; size_t size() const override { return _size; }
}
bool keyFrame() const override {
return _flags & MK_FRAME_FLAG_IS_KEY;
}
bool configFrame() const override {
return _flags & MK_FRAME_FLAG_IS_CONFIG;
}
//默认返回false
bool dropAble() const override {
return _flags & MK_FRAME_FLAG_DROP_ABLE;
}
//默认返回true
bool decodeAble() const override {
return !(_flags & MK_FRAME_FLAG_NOT_DECODE_ABLE);
}
private: private:
uint32_t _flags; char *_ptr;
size_t _size;
on_mk_frame_data_release _cb; on_mk_frame_data_release _cb;
std::shared_ptr<void> _user_data; std::shared_ptr<void> _user_data;
bool _cache_able;
}; };
}; // namespace
static mk_frame mk_frame_create_complex(int codec_id, uint64_t dts, uint64_t pts, uint32_t frame_flags, size_t prefix_size, static mk_frame mk_frame_create_complex(int codec_id, uint64_t dts, uint64_t pts, const char *data, size_t size,
char *data, size_t size, on_mk_frame_data_release cb, std::shared_ptr<void> user_data) { on_mk_frame_data_release cb, std::shared_ptr<void> user_data) {
switch (codec_id) { if (!cb) {
case CodecH264: // no cacheable
return (mk_frame)new Frame::Ptr(new H264FrameHelper<FrameFromPtrForC>( return (mk_frame) new Frame::Ptr(Factory::getFrameFromPtr((CodecId)codec_id, data, size, dts, pts));
cb, frame_flags, cb, std::move(user_data), (CodecId)codec_id, data, size, dts, pts, prefix_size));
case CodecH265:
return (mk_frame)new Frame::Ptr(new H265FrameHelper<FrameFromPtrForC>(
cb, frame_flags, cb, std::move(user_data), (CodecId)codec_id, data, size, dts, pts, prefix_size));
default:
return (mk_frame)new Frame::Ptr(new FrameFromPtrForC(
cb, frame_flags, cb, std::move(user_data), (CodecId)codec_id, data, size, dts, pts, prefix_size));
} }
// cacheable
auto buffer = std::make_shared<BufferFromPtr>((char *)data, size, cb, std::move(user_data));
return (mk_frame) new Frame::Ptr(Factory::getFrameFromBuffer((CodecId)codec_id, std::move(buffer), dts, pts));
} }
API_EXPORT mk_frame API_CALL mk_frame_create(int codec_id, uint64_t dts, uint64_t pts, const char *data, size_t size, API_EXPORT mk_frame API_CALL mk_frame_create(int codec_id, uint64_t dts, uint64_t pts, const char *data, size_t size,
on_mk_frame_data_release cb, void *user_data) { on_mk_frame_data_release cb, void *user_data) {
return mk_frame_create2(codec_id, dts, pts, data, size, cb, user_data, nullptr); return mk_frame_create2(codec_id, dts, pts, data, size, cb, user_data, nullptr);
} }
API_EXPORT mk_frame API_CALL mk_frame_create2(int codec_id, uint64_t dts, uint64_t pts, const char *data, size_t size, API_EXPORT mk_frame API_CALL mk_frame_create2(int codec_id, uint64_t dts, uint64_t pts, const char *data, size_t size,
on_mk_frame_data_release cb, void *user_data, on_user_data_free user_data_free) { on_mk_frame_data_release cb, void *user_data, on_user_data_free user_data_free) {
std::shared_ptr<void> ptr(user_data, user_data_free ? user_data_free : [](void *) {}); std::shared_ptr<void> ptr(user_data, user_data_free ? user_data_free : [](void *) {});
switch (codec_id) { return mk_frame_create_complex(codec_id, dts, pts, data, size, cb, std::move(ptr));
case CodecH264:
case CodecH265:
return mk_frame_create_complex(codec_id, dts, pts, 0, prefixSize(data, size), (char *)data, size, cb, std::move(ptr));
case CodecAAC: {
int prefix = 0;
if ((((uint8_t *) data)[0] == 0xFF && (((uint8_t *) data)[1] & 0xF0) == 0xF0) && size > ADTS_HEADER_LEN) {
prefix = ADTS_HEADER_LEN;
}
return mk_frame_create_complex(codec_id, dts, pts, 0, prefix, (char *)data, size, cb, std::move(ptr));
}
default:
return mk_frame_create_complex(codec_id, dts, pts, 0, 0, (char *)data, size, cb, std::move(ptr));
}
} }
API_EXPORT void API_CALL mk_frame_unref(mk_frame frame) { API_EXPORT void API_CALL mk_frame_unref(mk_frame frame) {

View File

@ -1,17 +1,16 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
#include "mk_h264_splitter.h" #include "mk_h264_splitter.h"
#include "Http/HttpRequestSplitter.h" #include "Http/HttpRequestSplitter.h"
#include "Extension/H264.h" #include "Extension/Factory.h"
#include "Extension/H265.h"
using namespace mediakit; using namespace mediakit;
@ -71,9 +70,9 @@ const char *H264Splitter::onSearchPacketTail(const char *data, size_t len) {
auto last_frame_len = next_frame - last_frame; auto last_frame_len = next_frame - last_frame;
Frame::Ptr frame; Frame::Ptr frame;
if (_h265) { if (_h265) {
frame = std::make_shared<H265FrameNoCacheAble>((char *) last_frame, last_frame_len, 0, 0, prefixSize(last_frame, last_frame_len)); frame = Factory::getFrameFromPtr(CodecH265, (char *)last_frame, last_frame_len, 0, 0);
} else { } else {
frame = std::make_shared<H264FrameNoCacheAble>((char *) last_frame, last_frame_len, 0, 0, prefixSize(last_frame, last_frame_len)); frame = Factory::getFrameFromPtr(CodecH264, (char *)last_frame, last_frame_len, 0, 0);
} }
if (frame->decodeAble()) { if (frame->decodeAble()) {
_search_pos = 0; _search_pos = 0;

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -11,7 +11,6 @@
#include "mk_player.h" #include "mk_player.h"
#include "Util/logger.h" #include "Util/logger.h"
#include "Player/MediaPlayer.h" #include "Player/MediaPlayer.h"
#include "Extension/H264.h"
using namespace std; using namespace std;
using namespace toolkit; using namespace toolkit;
@ -24,7 +23,6 @@ public:
MediaPlayerForC(){ MediaPlayerForC(){
_player = std::make_shared<MediaPlayer>(); _player = std::make_shared<MediaPlayer>();
} }
~MediaPlayerForC() = default;
MediaPlayer *operator->(){ MediaPlayer *operator->(){
return _player.get(); return _player.get();

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -34,7 +34,6 @@ private:
class SessionForC : public toolkit::Session { class SessionForC : public toolkit::Session {
public: public:
SessionForC(const toolkit::Socket::Ptr &pSock); SessionForC(const toolkit::Socket::Ptr &pSock);
~SessionForC() override = default;
void onRecv(const toolkit::Buffer::Ptr &buffer) override; void onRecv(const toolkit::Buffer::Ptr &buffer) override;
void onError(const toolkit::SockException &err) override; void onError(const toolkit::SockException &err) override;
void onManager() override; void onManager() override;

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -80,8 +80,6 @@ public:
_user_data = std::move(user_data); _user_data = std::move(user_data);
} }
~TimerForC() = default;
uint64_t operator()(){ uint64_t operator()(){
lock_guard<recursive_mutex> lck(_mxt); lock_guard<recursive_mutex> lck(_mxt);
if(!_cb){ if(!_cb){
@ -135,8 +133,6 @@ API_EXPORT void API_CALL mk_timer_release(mk_timer ctx){
class WorkThreadPoolForC : public TaskExecutorGetterImp { class WorkThreadPoolForC : public TaskExecutorGetterImp {
public: public:
~WorkThreadPoolForC() override = default;
WorkThreadPoolForC(const char *name, size_t n_thread, int priority) { WorkThreadPoolForC(const char *name, size_t n_thread, int priority) {
//最低优先级 //最低优先级
addPoller(name, n_thread, (ThreadPool::Priority) priority, false); addPoller(name, n_thread, (ThreadPool::Priority) priority, false);

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -27,8 +27,6 @@ public:
} }
} }
~VideoTrackForC() override = default;
int getVideoHeight() const override { int getVideoHeight() const override {
return _args.video.height; return _args.video.height;
} }
@ -45,16 +43,16 @@ public:
return _codec_id; return _codec_id;
} }
bool ready() override { bool ready() const override {
return true; return true;
} }
Track::Ptr clone() override { Track::Ptr clone() const override {
auto track_in = std::shared_ptr<Track>(shared_from_this()); auto track_in = std::shared_ptr<Track>(const_cast<VideoTrackForC *>(this)->shared_from_this());
return Factory::getTrackByAbstractTrack(track_in); return Factory::getTrackByAbstractTrack(track_in);
} }
Sdp::Ptr getSdp() override { Sdp::Ptr getSdp(uint8_t) const override {
return nullptr; return nullptr;
} }
@ -65,17 +63,15 @@ private:
class AudioTrackForC : public AudioTrackImp, public std::enable_shared_from_this<AudioTrackForC> { class AudioTrackForC : public AudioTrackImp, public std::enable_shared_from_this<AudioTrackForC> {
public: public:
~AudioTrackForC() override = default;
AudioTrackForC(int codec_id, codec_args *args) : AudioTrackForC(int codec_id, codec_args *args) :
AudioTrackImp((CodecId) codec_id, args->audio.sample_rate, args->audio.channels, 16) {} AudioTrackImp((CodecId) codec_id, args->audio.sample_rate, args->audio.channels, 16) {}
Track::Ptr clone() override { Track::Ptr clone() const override {
auto track_in = std::shared_ptr<Track>(shared_from_this()); auto track_in = std::shared_ptr<Track>(const_cast<AudioTrackForC *>(this)->shared_from_this());
return Factory::getTrackByAbstractTrack(track_in); return Factory::getTrackByAbstractTrack(track_in);
} }
Sdp::Ptr getSdp() override { Sdp::Ptr getSdp(uint8_t payload_type) const override {
return nullptr; return nullptr;
} }
}; };

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -286,6 +286,10 @@ keepAliveSecond=15
port=1935 port=1935
#rtmps服务器监听地址 #rtmps服务器监听地址
sslport=0 sslport=0
# rtmp是否直接代理模式
directProxy=1
#h265 rtmp打包采用增强型rtmp标准还是国内拓展标准
enhanced=1
[rtp] [rtp]
#音频mtu大小该参数限制rtp最大字节数推荐不要超过1400 #音频mtu大小该参数限制rtp最大字节数推荐不要超过1400
@ -347,6 +351,11 @@ preferredCodecA=PCMU,PCMA,opus,mpeg4-generic
#以下范例为所有支持的视频codec #以下范例为所有支持的视频codec
preferredCodecV=H264,H265,AV1,VP9,VP8 preferredCodecV=H264,H265,AV1,VP9,VP8
#webrtc比特率设置
start_bitrate=0
max_bitrate=0
min_bitrate=0
[srt] [srt]
#srt播放推流、播放超时时间,单位秒 #srt播放推流、播放超时时间,单位秒
timeoutSec=5 timeoutSec=5

24
conf/readme.md Normal file
View File

@ -0,0 +1,24 @@
## 配置文件影响性能的参数
### 1、protocol.enable_xxx
控制转协议开关关闭某些协议节省cpu和内存。
### 2、protocol.xxx_demand
控制按需转协议开启转协议且按需转协议时无人观看时节省cpu和内存但是第一个播放器无法秒开影响体验
### 3、protocol.paced_sender_ms
平滑发送定时器频率,用于解决数据源发送不平滑导致转发不平滑播放器卡顿问题,开启后定时器根据数据时间戳驱动数据发送,提高用户体验。
但是增加cpu和内存使用。定时器间隔越小cpu占用越高但是平滑度越好建议设置30~100ms。此功能结合protocol.modify_stamp为2(抑制时间戳跳跃)最佳。
### 4、general.mergeWriteMS
开启合并写,减少发送数据时系统调用次数以及线程间数据共享频率,大大提高转发性能,但是牺牲播放延时和发送平滑度。
### 5、rtp_proxy.gop_cache
开启startSendRtp级联接口的gop缓存功能用于国标级联秒开。该选项不影响zlmediakit对外提供直播服务的秒开。
开启该选项后增加内存使用对cpu影响较小如果不调用startSendRtp接口建议关闭。
### 6、hls.fileBufSize
调整该配置可以提高hls协议写磁盘io性能。
### 7、record.fileBufSize
调整该配置可以提高mp4录制写磁盘io性能。

View File

@ -94,7 +94,7 @@ RUN cd /opt \
&& make install && make install
RUN cd /opt \ RUN cd /opt \
&& git clone --depth 1 https://github.com/xia-chu/ZLMediaKit.git \ && git clone --depth 1 https://github.com/ZLMediaKit/ZLMediaKit.git \
&& cd ZLMediaKit \ && cd ZLMediaKit \
&& git submodule update --init \ && git submodule update --init \
&& mkdir -p build release/linux/Release/ \ && mkdir -p build release/linux/Release/ \
@ -112,7 +112,7 @@ RUN mkdir -p /opt/build/opt/zlm/ /opt/build/usr/local/bin/ /opt/build/usr/bin/
&& /usr/bin/cp -ip /usr/bin/which ./usr/bin/ && /usr/bin/cp -ip /usr/bin/which ./usr/bin/
FROM centos:${Version} FROM centos:${Version}
LABEL maintainer="chengxiaosheng <kevin__cheng@outlook.com>" project-url="https://github.com/xia-chu/ZLMediaKit" description="一个基于C++11的高性能运营级流媒体服务框架" LABEL maintainer="chengxiaosheng <kevin__cheng@outlook.com>" project-url="https://github.com/ZLMediaKit/ZLMediaKit" description="一个基于C++11的高性能运营级流媒体服务框架"
EXPOSE 9000/tcp \ EXPOSE 9000/tcp \
1935/tcp \ 1935/tcp \

View File

@ -32,7 +32,7 @@ RUN apt-get update && \
RUN mkdir -p /opt/media RUN mkdir -p /opt/media
WORKDIR /opt/media WORKDIR /opt/media
RUN git clone --depth=1 https://github.com/xia-chu/ZLMediaKit && \ RUN git clone --depth=1 https://github.com/ZLMediaKit/ZLMediaKit && \
cd ZLMediaKit && git submodule update --init --recursive && \ cd ZLMediaKit && git submodule update --init --recursive && \
mkdir -p build release/linux/Release/ mkdir -p build release/linux/Release/

View File

@ -31,7 +31,7 @@ RUN apt-get update && \
RUN mkdir -p /opt/media RUN mkdir -p /opt/media
WORKDIR /opt/media WORKDIR /opt/media
RUN git clone --depth=1 https://github.com/xia-chu/ZLMediaKit && \ RUN git clone --depth=1 https://github.com/ZLMediaKit/ZLMediaKit && \
cd ZLMediaKit && git submodule update --init --recursive && \ cd ZLMediaKit && git submodule update --init --recursive && \
mkdir -p build release/linux/Release/ mkdir -p build release/linux/Release/

View File

@ -33,7 +33,7 @@ RUN apt-get update && \
RUN mkdir -p /opt/media RUN mkdir -p /opt/media
WORKDIR /opt/media WORKDIR /opt/media
RUN git clone --depth=1 https://github.com/xia-chu/ZLMediaKit && \ RUN git clone --depth=1 https://github.com/ZLMediaKit/ZLMediaKit && \
cd ZLMediaKit && git submodule update --init --recursive && \ cd ZLMediaKit && git submodule update --init --recursive && \
mkdir -p build release/linux/Release/ mkdir -p build release/linux/Release/

View File

@ -31,7 +31,7 @@ RUN apt-get update && \
RUN mkdir -p /opt/media RUN mkdir -p /opt/media
WORKDIR /opt/media WORKDIR /opt/media
RUN git clone --depth=1 https://github.com/xia-chu/ZLMediaKit && \ RUN git clone --depth=1 https://github.com/ZLMediaKit/ZLMediaKit && \
cd ZLMediaKit && git submodule update --init --recursive && \ cd ZLMediaKit && git submodule update --init --recursive && \
mkdir -p build release/linux/Release/ mkdir -p build release/linux/Release/

View File

@ -24,7 +24,7 @@ Summary: A lightweight, high performance and stable stream server and client fra
Group: development Group: development
License: MIT License: MIT
URL: https://github.com/xia-chu/ZLMediaKit URL: https://github.com/ZLMediaKit/ZLMediaKit
Source0: %{name}-%{version}.tar.xz Source0: %{name}-%{version}.tar.xz
%if %{with openssl} %if %{with openssl}

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
 /*  /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -157,12 +157,12 @@ void Process::run(const string &cmd, string log_file) {
WarnL << "clone process failed:" << get_uv_errmsg(); WarnL << "clone process failed:" << get_uv_errmsg();
free(_process_stack); free(_process_stack);
_process_stack = nullptr; _process_stack = nullptr;
throw std::runtime_error(StrPrinter << "fork child process failed,err:" << get_uv_errmsg()); throw std::runtime_error(StrPrinter << "clone child process failed, cmd: " << cmd << ",err:" << get_uv_errmsg());
} }
#else #else
_pid = fork(); _pid = fork();
if (_pid == -1) { if (_pid == -1) {
throw std::runtime_error(StrPrinter << "fork child process failed,err:" << get_uv_errmsg()); throw std::runtime_error(StrPrinter << "fork child process failed, cmd: " << cmd << ",err:" << get_uv_errmsg());
} }
if (_pid == 0) { if (_pid == 0) {
//子进程 //子进程

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -53,7 +53,6 @@ public:
ApiRetException(const char *str = "success" ,int code = API::Success):runtime_error(str){ ApiRetException(const char *str = "success" ,int code = API::Success):runtime_error(str){
_code = code; _code = code;
} }
~ApiRetException() = default;
int code(){ return _code; } int code(){ return _code; }
private: private:
int _code; int _code;
@ -62,19 +61,16 @@ private:
class AuthException : public ApiRetException { class AuthException : public ApiRetException {
public: public:
AuthException(const char *str):ApiRetException(str,API::AuthFailed){} AuthException(const char *str):ApiRetException(str,API::AuthFailed){}
~AuthException() = default;
}; };
class InvalidArgsException: public ApiRetException { class InvalidArgsException: public ApiRetException {
public: public:
InvalidArgsException(const char *str):ApiRetException(str,API::InvalidArgs){} InvalidArgsException(const char *str):ApiRetException(str,API::InvalidArgs){}
~InvalidArgsException() = default;
}; };
class SuccessException: public ApiRetException { class SuccessException: public ApiRetException {
public: public:
SuccessException():ApiRetException("success",API::Success){} SuccessException():ApiRetException("success",API::Success){}
~SuccessException() = default;
}; };
using ApiArgsType = std::map<std::string, std::string, mediakit::StrCaseCompare>; using ApiArgsType = std::map<std::string, std::string, mediakit::StrCaseCompare>;
@ -155,8 +151,6 @@ public:
} }
} }
~HttpAllArgs() = default;
template<typename Key> template<typename Key>
toolkit::variant operator[](const Key &key) const { toolkit::variant operator[](const Key &key) const {
return (toolkit::variant)_get_value(*(HttpAllArgs*)this, key); return (toolkit::variant)_get_value(*(HttpAllArgs*)this, key);

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -174,7 +174,7 @@ void do_http_hook(const string &url, const ArgsType &body, const function<void(c
GET_CONFIG(float, retry_delay, Hook::kRetryDelay); GET_CONFIG(float, retry_delay, Hook::kRetryDelay);
const_cast<ArgsType &>(body)["mediaServerId"] = mediaServerId; const_cast<ArgsType &>(body)["mediaServerId"] = mediaServerId;
const_cast<ArgsType &>(body)["hook_index"] = s_hook_index++; const_cast<ArgsType &>(body)["hook_index"] = (Json::UInt64)(s_hook_index++);
auto requester = std::make_shared<HttpRequester>(); auto requester = std::make_shared<HttpRequester>();
requester->setMethod("POST"); requester->setMethod("POST");

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -203,11 +203,6 @@ public:
"日志保存文件夹路径",/*该选项说明文字*/ "日志保存文件夹路径",/*该选项说明文字*/
nullptr); nullptr);
} }
~CMD_main() override{}
const char *description() const override{
return "主程序命令参数";
}
}; };
//全局变量在WebApi中用于保存配置文件用 //全局变量在WebApi中用于保存配置文件用
@ -290,6 +285,7 @@ int start_main(int argc,char *argv[]) {
//如果需要调用getSnap和addFFmpegSource接口可以关闭cpu亲和性 //如果需要调用getSnap和addFFmpegSource接口可以关闭cpu亲和性
EventPollerPool::setPoolSize(threads); EventPollerPool::setPoolSize(threads);
WorkThreadPool::setPoolSize(threads);
EventPollerPool::enableCpuAffinity(affinity); EventPollerPool::enableCpuAffinity(affinity);
//简单的telnet服务器可用于服务器调试但是不能使用23端口否则telnet上了莫名其妙的现象 //简单的telnet服务器可用于服务器调试但是不能使用23端口否则telnet上了莫名其妙的现象

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -15,7 +15,6 @@
#include "Util/File.h" #include "Util/File.h"
#include "Util/uv_errno.h" #include "Util/uv_errno.h"
#include "Transcode.h" #include "Transcode.h"
#include "Extension/AAC.h"
#include "Common/config.h" #include "Common/config.h"
#define MAX_DELAY_SECOND 3 #define MAX_DELAY_SECOND 3

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -65,7 +65,6 @@ private:
class TaskManager { class TaskManager {
public: public:
TaskManager() = default;
virtual ~TaskManager(); virtual ~TaskManager();
void setMaxTaskSize(size_t size); void setMaxTaskSize(size_t size);
@ -84,7 +83,6 @@ private:
class ThreadExitException : public std::runtime_error { class ThreadExitException : public std::runtime_error {
public: public:
ThreadExitException() : std::runtime_error("exit") {} ThreadExitException() : std::runtime_error("exit") {}
~ThreadExitException() = default;
}; };
private: private:

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -11,11 +11,7 @@
#include "Device.h" #include "Device.h"
#include "Util/logger.h" #include "Util/logger.h"
#include "Util/base64.h" #include "Util/base64.h"
#include "Extension/AAC.h" #include "Extension/Factory.h"
#include "Extension/Opus.h"
#include "Extension/G711.h"
#include "Extension/H264.h"
#include "Extension/H265.h"
#ifdef ENABLE_FAAC #ifdef ENABLE_FAAC
#include "Codec/AACEncoder.h" #include "Codec/AACEncoder.h"
#endif //ENABLE_FAAC #endif //ENABLE_FAAC
@ -85,15 +81,7 @@ bool DevChannel::inputH264(const char *data, int len, uint64_t dts, uint64_t pts
pts = dts; pts = dts;
} }
//由于rtmp/hls/mp4需要缓存时间戳相同的帧 return inputFrame(Factory::getFrameFromPtr(CodecH264,data, len, dts, pts));
//所以使用FrameNoCacheAble类型的帧反而会在转换成FrameCacheAble时多次内存拷贝
//在此处只拷贝一次,性能开销更低
auto frame = FrameImp::create<H264Frame>();
frame->_dts = dts;
frame->_pts = pts;
frame->_buffer.assign(data, len);
frame->_prefix_size = prefixSize(data,len);
return inputFrame(frame);
} }
bool DevChannel::inputH265(const char *data, int len, uint64_t dts, uint64_t pts) { bool DevChannel::inputH265(const char *data, int len, uint64_t dts, uint64_t pts) {
@ -104,30 +92,10 @@ bool DevChannel::inputH265(const char *data, int len, uint64_t dts, uint64_t pts
pts = dts; pts = dts;
} }
//由于rtmp/hls/mp4需要缓存时间戳相同的帧 return inputFrame(Factory::getFrameFromPtr(CodecH265, data, len, dts, pts));
//所以使用FrameNoCacheAble类型的帧反而会在转换成FrameCacheAble时多次内存拷贝
//在此处只拷贝一次,性能开销更低
auto frame = FrameImp::create<H265Frame>();
frame->_dts = dts;
frame->_pts = pts;
frame->_buffer.assign(data, len);
frame->_prefix_size = prefixSize(data,len);
return inputFrame(frame);
} }
class FrameAutoDelete : public FrameFromPtr{ #define ADTS_HEADER_LEN 7
public:
template <typename ... ARGS>
FrameAutoDelete(ARGS && ...args) : FrameFromPtr(std::forward<ARGS>(args)...){}
~FrameAutoDelete() override {
delete [] _ptr;
};
bool cacheAble() const override {
return true;
}
};
bool DevChannel::inputAAC(const char *data_without_adts, int len, uint64_t dts, const char *adts_header){ bool DevChannel::inputAAC(const char *data_without_adts, int len, uint64_t dts, const char *adts_header){
if (dts == 0) { if (dts == 0) {
@ -136,47 +104,36 @@ bool DevChannel::inputAAC(const char *data_without_adts, int len, uint64_t dts,
if (!adts_header) { if (!adts_header) {
//没有adts头 //没有adts头
return inputFrame(std::make_shared<FrameFromPtr>(_audio->codecId, (char *) data_without_adts, len, dts, 0, 0)); return inputFrame(std::make_shared<FrameFromPtr>(CodecAAC, (char *) data_without_adts, len, dts, 0, 0));
} }
if (adts_header + ADTS_HEADER_LEN == data_without_adts) { if (adts_header + ADTS_HEADER_LEN == data_without_adts) {
//adts头和帧在一起 //adts头和帧在一起
return inputFrame(std::make_shared<FrameFromPtr>(_audio->codecId, (char *) data_without_adts - ADTS_HEADER_LEN, len + ADTS_HEADER_LEN, dts, 0, ADTS_HEADER_LEN)); return inputFrame(std::make_shared<FrameFromPtr>(CodecAAC, (char *) data_without_adts - ADTS_HEADER_LEN, len + ADTS_HEADER_LEN, dts, 0, ADTS_HEADER_LEN));
} }
//adts头和帧不在一起 //adts头和帧不在一起
char *data_with_adts = new char[len + ADTS_HEADER_LEN]; char *data_with_adts = new char[len + ADTS_HEADER_LEN];
memcpy(data_with_adts, adts_header, ADTS_HEADER_LEN); memcpy(data_with_adts, adts_header, ADTS_HEADER_LEN);
memcpy(data_with_adts + ADTS_HEADER_LEN, data_without_adts, len); memcpy(data_with_adts + ADTS_HEADER_LEN, data_without_adts, len);
return inputFrame(std::make_shared<FrameAutoDelete>(_audio->codecId, data_with_adts, len + ADTS_HEADER_LEN, dts, 0, ADTS_HEADER_LEN)); return inputFrame(std::make_shared<FrameAutoDelete>(CodecAAC, data_with_adts, len + ADTS_HEADER_LEN, dts, 0, ADTS_HEADER_LEN));
} }
bool DevChannel::inputAudio(const char *data, int len, uint64_t dts){ bool DevChannel::inputAudio(const char *data, int len, uint64_t dts){
if (dts == 0) { if (dts == 0) {
dts = _aTicker[1].elapsedTime(); dts = _aTicker[1].elapsedTime();
} }
return inputFrame(std::make_shared<FrameFromPtr>(_audio->codecId, (char *) data, len, dts, 0)); return inputFrame(Factory::getFrameFromPtr(_audio->codecId, (char *) data, len, dts, dts));
} }
bool DevChannel::initVideo(const VideoInfo &info) { bool DevChannel::initVideo(const VideoInfo &info) {
_video = std::make_shared<VideoInfo>(info); _video = std::make_shared<VideoInfo>(info);
switch (info.codecId){ return addTrack(Factory::getTrackByCodecId(info.codecId));
case CodecH265 : return addTrack(std::make_shared<H265Track>());
case CodecH264 : return addTrack(std::make_shared<H264Track>());
default: WarnL << "不支持该类型的视频编码类型:" << info.codecId; return false;
}
} }
bool DevChannel::initAudio(const AudioInfo &info) { bool DevChannel::initAudio(const AudioInfo &info) {
_audio = std::make_shared<AudioInfo>(info); _audio = std::make_shared<AudioInfo>(info);
switch (info.codecId) { return addTrack(Factory::getTrackByCodecId(info.codecId, info.iSampleRate, info.iChannel, info.iSampleBit));
case CodecAAC : return addTrack(std::make_shared<AACTrack>());
case CodecG711A :
case CodecG711U : return addTrack(std::make_shared<G711Track>(info.codecId, info.iSampleRate, info.iChannel, info.iSampleBit));
case CodecOpus : return addTrack(std::make_shared<OpusTrack>());
default: WarnL << "不支持该类型的音频编码类型:" << info.codecId; return false;
}
} }
bool DevChannel::inputFrame(const Frame::Ptr &frame) { bool DevChannel::inputFrame(const Frame::Ptr &frame) {

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -49,7 +49,6 @@ public:
//fDuration<=0为直播否则为点播 //fDuration<=0为直播否则为点播
DevChannel(const MediaTuple& tuple, float duration = 0, const ProtocolOption &option = ProtocolOption()) DevChannel(const MediaTuple& tuple, float duration = 0, const ProtocolOption &option = ProtocolOption())
: MultiMediaSourceMuxer(tuple, duration, option) {} : MultiMediaSourceMuxer(tuple, duration, option) {}
~DevChannel() override = default;
/** /**
* Track * Track

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -16,9 +16,6 @@
namespace mediakit { namespace mediakit {
class JemallocUtil { class JemallocUtil {
public: public:
JemallocUtil() = default;
~JemallocUtil() = default;
static void enable_profiling(); static void enable_profiling();
static void disable_profiling(); static void disable_profiling();

View File

@ -1,16 +1,16 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
#include "MediaSink.h" #include "MediaSink.h"
#include "Extension/AAC.h"
#include "Common/config.h" #include "Common/config.h"
#include "Extension/Factory.h"
using namespace std; using namespace std;
@ -201,17 +201,6 @@ vector<Track::Ptr> MediaSink::getTracks(bool ready) const{
return ret; return ret;
} }
class FrameFromStaticPtr : public FrameFromPtr {
public:
template<typename ... ARGS>
FrameFromStaticPtr(ARGS &&...args) : FrameFromPtr(std::forward<ARGS>(args)...) {};
~FrameFromStaticPtr() override = default;
bool cacheAble() const override {
return true;
}
};
static uint8_t s_mute_adts[] = {0xff, 0xf1, 0x6c, 0x40, 0x2d, 0x3f, 0xfc, 0x00, 0xe0, 0x34, 0x20, 0xad, 0xf2, 0x3f, 0xb5, 0xdd, static uint8_t s_mute_adts[] = {0xff, 0xf1, 0x6c, 0x40, 0x2d, 0x3f, 0xfc, 0x00, 0xe0, 0x34, 0x20, 0xad, 0xf2, 0x3f, 0xb5, 0xdd,
0x73, 0xac, 0xbd, 0xca, 0xd7, 0x7d, 0x4a, 0x13, 0x2d, 0x2e, 0xa2, 0x62, 0x02, 0x70, 0x3c, 0x1c, 0x73, 0xac, 0xbd, 0xca, 0xd7, 0x7d, 0x4a, 0x13, 0x2d, 0x2e, 0xa2, 0x62, 0x02, 0x70, 0x3c, 0x1c,
0xc5, 0x63, 0x55, 0x69, 0x94, 0xb5, 0x8d, 0x70, 0xd7, 0x24, 0x6a, 0x9e, 0x2e, 0x86, 0x24, 0xea, 0xc5, 0x63, 0x55, 0x69, 0x94, 0xb5, 0x8d, 0x70, 0xd7, 0x24, 0x6a, 0x9e, 0x2e, 0x86, 0x24, 0xea,
@ -237,16 +226,16 @@ static uint8_t s_mute_adts[] = {0xff, 0xf1, 0x6c, 0x40, 0x2d, 0x3f, 0xfc, 0x00,
0xc5, 0x97, 0x39, 0x6a, 0xb8, 0xa2, 0x55, 0xa8, 0xf8}; 0xc5, 0x97, 0x39, 0x6a, 0xb8, 0xa2, 0x55, 0xa8, 0xf8};
#define MUTE_ADTS_DATA s_mute_adts #define MUTE_ADTS_DATA s_mute_adts
#define MUTE_ADTS_DATA_LEN sizeof(s_mute_adts)
#define MUTE_ADTS_DATA_MS 128 #define MUTE_ADTS_DATA_MS 128
static uint8_t ADTS_CONFIG[2] = { 0x15, 0x88 };
bool MuteAudioMaker::inputFrame(const Frame::Ptr &frame) { bool MuteAudioMaker::inputFrame(const Frame::Ptr &frame) {
if (frame->getTrackType() == TrackVideo) { if (frame->getTrackType() == TrackVideo) {
auto audio_idx = frame->dts() / MUTE_ADTS_DATA_MS; auto audio_idx = frame->dts() / MUTE_ADTS_DATA_MS;
if (_audio_idx != audio_idx) { if (_audio_idx != audio_idx) {
_audio_idx = audio_idx; _audio_idx = audio_idx;
auto aacFrame = std::make_shared<FrameFromStaticPtr>(CodecAAC, (char *) MUTE_ADTS_DATA, MUTE_ADTS_DATA_LEN, auto aacFrame = std::make_shared<FrameToCache<FrameFromPtr>>(CodecAAC, (char *) MUTE_ADTS_DATA, sizeof(s_mute_adts),
_audio_idx * MUTE_ADTS_DATA_MS, 0, ADTS_HEADER_LEN); _audio_idx * MUTE_ADTS_DATA_MS, 0, 7);
return FrameDispatcher::inputFrame(aacFrame); return FrameDispatcher::inputFrame(aacFrame);
} }
} }
@ -260,7 +249,8 @@ bool MediaSink::addMuteAudioTrack() {
if (_track_map.find(TrackAudio) != _track_map.end()) { if (_track_map.find(TrackAudio) != _track_map.end()) {
return false; return false;
} }
auto audio = std::make_shared<AACTrack>(makeAacConfig(MUTE_ADTS_DATA, ADTS_HEADER_LEN)); auto audio = Factory::getTrackByCodecId(CodecAAC);
audio->setExtraData(ADTS_CONFIG, 2);
_track_map[audio->getTrackType()] = std::make_pair(audio, true); _track_map[audio->getTrackType()] = std::make_pair(audio, true);
audio->addDelegate([this](const Frame::Ptr &frame) { audio->addDelegate([this](const Frame::Ptr &frame) {
return onTrackFrame(frame); return onTrackFrame(frame);

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -21,7 +21,6 @@ namespace mediakit{
class TrackListener { class TrackListener {
public: public:
TrackListener() = default;
virtual ~TrackListener() = default; virtual ~TrackListener() = default;
/** /**
@ -45,9 +44,6 @@ public:
class MediaSinkInterface : public FrameWriterInterface, public TrackListener { class MediaSinkInterface : public FrameWriterInterface, public TrackListener {
public: public:
using Ptr = std::shared_ptr<MediaSinkInterface>; using Ptr = std::shared_ptr<MediaSinkInterface>;
MediaSinkInterface() = default;
~MediaSinkInterface() override = default;
}; };
/** /**
@ -56,8 +52,6 @@ public:
class MuteAudioMaker : public FrameDispatcher { class MuteAudioMaker : public FrameDispatcher {
public: public:
using Ptr = std::shared_ptr<MuteAudioMaker>; using Ptr = std::shared_ptr<MuteAudioMaker>;
MuteAudioMaker() = default;
~MuteAudioMaker() override = default;
bool inputFrame(const Frame::Ptr &frame) override; bool inputFrame(const Frame::Ptr &frame) override;
private: private:
@ -71,9 +65,6 @@ private:
class MediaSink : public MediaSinkInterface, public TrackSource{ class MediaSink : public MediaSinkInterface, public TrackSource{
public: public:
using Ptr = std::shared_ptr<MediaSink>; using Ptr = std::shared_ptr<MediaSink>;
MediaSink() = default;
~MediaSink() override = default;
/** /**
* frame * frame
* @param frame * @param frame
@ -112,7 +103,7 @@ public:
std::vector<Track::Ptr> getTracks(bool trackReady = true) const override; std::vector<Track::Ptr> getTracks(bool trackReady = true) const override;
/** /**
* track已经准备完成 * onAllTrackReady事件
*/ */
bool isAllTrackReady() const; bool isAllTrackReady() const;
@ -188,9 +179,6 @@ private:
class MediaSinkDelegate : public MediaSink { class MediaSinkDelegate : public MediaSink {
public: public:
MediaSinkDelegate() = default;
~MediaSinkDelegate() override = default;
/** /**
* track监听器 * track监听器
*/ */
@ -207,9 +195,6 @@ private:
class Demuxer : protected TrackListener, public TrackSource { class Demuxer : protected TrackListener, public TrackSource {
public: public:
Demuxer() = default;
~Demuxer() override = default;
void setTrackListener(TrackListener *listener, bool wait_track_ready = false); void setTrackListener(TrackListener *listener, bool wait_track_ready = false);
std::vector<Track::Ptr> getTracks(bool trackReady = true) const override; std::vector<Track::Ptr> getTracks(bool trackReady = true) const override;

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -50,10 +50,8 @@ public:
public: public:
template<typename ...T> template<typename ...T>
NotImplemented(T && ...args) : std::runtime_error(std::forward<T>(args)...) {} NotImplemented(T && ...args) : std::runtime_error(std::forward<T>(args)...) {}
~NotImplemented() override = default;
}; };
MediaSourceEvent() = default;
virtual ~MediaSourceEvent() = default; virtual ~MediaSourceEvent() = default;
// 获取媒体源类型 // 获取媒体源类型
@ -254,9 +252,6 @@ private:
//该对象用于拦截感兴趣的MediaSourceEvent事件 //该对象用于拦截感兴趣的MediaSourceEvent事件
class MediaSourceEventInterceptor : public MediaSourceEvent { class MediaSourceEventInterceptor : public MediaSourceEvent {
public: public:
MediaSourceEventInterceptor() = default;
~MediaSourceEventInterceptor() override = default;
void setDelegate(const std::weak_ptr<MediaSourceEvent> &listener); void setDelegate(const std::weak_ptr<MediaSourceEvent> &listener);
std::shared_ptr<MediaSourceEvent> getDelegate() const; std::shared_ptr<MediaSourceEvent> getDelegate() const;
@ -289,7 +284,6 @@ private:
*/ */
class MediaInfo: public MediaTuple { class MediaInfo: public MediaTuple {
public: public:
~MediaInfo() = default;
MediaInfo() = default; MediaInfo() = default;
MediaInfo(const std::string &url) { parse(url); } MediaInfo(const std::string &url) { parse(url); }
void parse(const std::string &url); void parse(const std::string &url);

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -32,13 +32,11 @@ public:
class Listener { class Listener {
public: public:
Listener() = default;
virtual ~Listener() = default; virtual ~Listener() = default;
virtual void onAllTrackReady() = 0; virtual void onAllTrackReady() = 0;
}; };
MultiMediaSourceMuxer(const MediaTuple& tuple, float dur_sec = 0.0,const ProtocolOption &option = ProtocolOption()); MultiMediaSourceMuxer(const MediaTuple& tuple, float dur_sec = 0.0,const ProtocolOption &option = ProtocolOption());
~MultiMediaSourceMuxer() override = default;
/** /**
* *

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -18,9 +18,6 @@ namespace mediakit {
/// 缓存刷新策略类 /// 缓存刷新策略类
class FlushPolicy { class FlushPolicy {
public: public:
FlushPolicy() = default;
~FlushPolicy() = default;
bool isFlushAble(bool is_video, bool is_key, uint64_t new_stamp, size_t cache_size); bool isFlushAble(bool is_video, bool is_key, uint64_t new_stamp, size_t cache_size);
private: private:
@ -79,13 +76,8 @@ private:
// 但是却对性能提升很大,这样做还是比较划算的 // 但是却对性能提升很大,这样做还是比较划算的
GET_CONFIG(int, mergeWriteMS, General::kMergeWriteMS); GET_CONFIG(int, mergeWriteMS, General::kMergeWriteMS);
GET_CONFIG(int, rtspLowLatency, Rtsp::kLowLatency); GET_CONFIG(int, rtspLowLatency, Rtsp::kLowLatency);
if (std::is_same<packet, RtpPacket>::value && rtspLowLatency) { return std::is_same<packet, RtpPacket>::value ? rtspLowLatency : (mergeWriteMS <= 0);
return true;
}
return std::is_same<packet, RtpPacket>::value ? false : (mergeWriteMS <= 0);
} }
private: private:

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -293,7 +293,6 @@ void RtspUrl::setup(bool is_ssl, const string &url, const string &user, const st
uint16_t port = is_ssl ? 322 : 554; uint16_t port = is_ssl ? 322 : 554;
splitUrl(ip, ip, port); splitUrl(ip, ip, port);
_url = std::move(url); _url = std::move(url);
_user = strCoding::UrlDecode(std::move(user)); _user = strCoding::UrlDecode(std::move(user));
_passwd = strCoding::UrlDecode(std::move(passwd)); _passwd = strCoding::UrlDecode(std::move(passwd));

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -31,8 +31,6 @@ struct StrCaseCompare {
class StrCaseMap : public std::multimap<std::string, std::string, StrCaseCompare> { class StrCaseMap : public std::multimap<std::string, std::string, StrCaseCompare> {
public: public:
using Super = multimap<std::string, std::string, StrCaseCompare>; using Super = multimap<std::string, std::string, StrCaseCompare>;
StrCaseMap() = default;
~StrCaseMap() = default;
std::string &operator[](const std::string &k) { std::string &operator[](const std::string &k) {
auto it = find(k); auto it = find(k);
@ -60,9 +58,6 @@ public:
// rtsp/http/sip解析类 // rtsp/http/sip解析类
class Parser { class Parser {
public: public:
Parser() = default;
~Parser() = default;
// 解析http/rtsp/sip请求需要确保buf以\0结尾 // 解析http/rtsp/sip请求需要确保buf以\0结尾
void parse(const char *buf, size_t size); void parse(const char *buf, size_t size);
@ -132,8 +127,6 @@ public:
std::string _host; std::string _host;
public: public:
RtspUrl() = default;
~RtspUrl() = default;
void parse(const std::string &url); void parse(const std::string &url);
private: private:

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -20,7 +20,7 @@ namespace mediakit {
class DeltaStamp { class DeltaStamp {
public: public:
DeltaStamp(); DeltaStamp();
~DeltaStamp() = default; virtual ~DeltaStamp() = default;
/** /**
* *
@ -48,9 +48,6 @@ protected:
//计算相对时间戳或者产生平滑时间戳 //计算相对时间戳或者产生平滑时间戳
class Stamp : public DeltaStamp{ class Stamp : public DeltaStamp{
public: public:
Stamp() = default;
~Stamp() = default;
/** /**
* ,dts回退等功能 * ,dts回退等功能
* @param dts dts0 * @param dts dts0
@ -116,8 +113,6 @@ private:
//pts排序后就是dts //pts排序后就是dts
class DtsGenerator{ class DtsGenerator{
public: public:
DtsGenerator() = default;
~DtsGenerator() = default;
bool getDts(uint64_t pts, uint64_t &dts); bool getDts(uint64_t pts, uint64_t &dts);
private: private:
@ -136,9 +131,6 @@ private:
class NtpStamp { class NtpStamp {
public: public:
NtpStamp() = default;
~NtpStamp() = default;
void setNtpStamp(uint32_t rtp_stamp, uint64_t ntp_stamp_ms); void setNtpStamp(uint32_t rtp_stamp, uint64_t ntp_stamp_ms);
uint64_t getNtpStamp(uint32_t rtp_stamp, uint32_t sample_rate); uint64_t getNtpStamp(uint32_t rtp_stamp, uint32_t sample_rate);

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -235,10 +235,14 @@ namespace Rtmp {
#define RTMP_FIELD "rtmp." #define RTMP_FIELD "rtmp."
const string kHandshakeSecond = RTMP_FIELD "handshakeSecond"; const string kHandshakeSecond = RTMP_FIELD "handshakeSecond";
const string kKeepAliveSecond = RTMP_FIELD "keepAliveSecond"; const string kKeepAliveSecond = RTMP_FIELD "keepAliveSecond";
const string kDirectProxy = RTMP_FIELD "directProxy";
const string kEnhanced = RTMP_FIELD "enhanced";
static onceToken token([]() { static onceToken token([]() {
mINI::Instance()[kHandshakeSecond] = 15; mINI::Instance()[kHandshakeSecond] = 15;
mINI::Instance()[kKeepAliveSecond] = 15; mINI::Instance()[kKeepAliveSecond] = 15;
mINI::Instance()[kDirectProxy] = 1;
mINI::Instance()[kEnhanced] = 1;
}); });
} // namespace Rtmp } // namespace Rtmp

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -297,6 +297,10 @@ namespace Rtmp {
extern const std::string kHandshakeSecond; extern const std::string kHandshakeSecond;
// 维持链接超时时间默认15秒 // 维持链接超时时间默认15秒
extern const std::string kKeepAliveSecond; extern const std::string kKeepAliveSecond;
// 是否直接代理
extern const std::string kDirectProxy;
// h265-rtmp是否采用增强型(或者国内扩展)
extern const std::string kEnhanced;
} // namespace Rtmp } // namespace Rtmp
////////////RTP配置/////////// ////////////RTP配置///////////

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -33,9 +33,13 @@ void Assert_Throw(int failed, const char *exp, const char *func, const char *fil
namespace mediakit { namespace mediakit {
//请遵循MIT协议勿修改服务器声明 /**
* MIT协议MIT协议义务的同时ZLMediaKit软件版权信息的义务
* ZLMediaKit提供的各种服务中包括但不限于 "title""Server""User-Agent" "ZLMediaKit"
* ()
*/
#if !defined(ENABLE_VERSION) #if !defined(ENABLE_VERSION)
const char kServerName[] = "ZLMediaKit-7.0(build in " __DATE__ " " __TIME__ ")"; const char kServerName[] = "ZLMediaKit-8.0(build in " __DATE__ " " __TIME__ ")";
#else #else
const char kServerName[] = "ZLMediaKit(git hash:" COMMIT_HASH "/" COMMIT_TIME ",branch:" BRANCH_NAME ",build time:" BUILD_TIME ")"; const char kServerName[] = "ZLMediaKit(git hash:" COMMIT_HASH "/" COMMIT_TIME ",branch:" BRANCH_NAME ",build time:" BUILD_TIME ")";
#endif #endif

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */
@ -75,7 +75,6 @@ class AssertFailedException : public std::runtime_error {
public: public:
template<typename ...T> template<typename ...T>
AssertFailedException(T && ...args) : std::runtime_error(std::forward<T>(args)...) {} AssertFailedException(T && ...args) : std::runtime_error(std::forward<T>(args)...) {}
~AssertFailedException() override = default;
}; };
extern const char kServerName[]; extern const char kServerName[];

View File

@ -1,9 +1,9 @@
/* /*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved. * Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
* *
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit). * This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
* *
* Use of this source code is governed by MIT license that can be found in the * Use of this source code is governed by MIT-like license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors * LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree. * may be found in the AUTHORS file in the root of the source tree.
*/ */

Some files were not shown because too many files have changed in this diff Show More