Merge pull request #31 from ZLMediaKit/master

[pull] master from ZLMediaKit:master
This commit is contained in:
waken 2024-05-31 12:01:14 +08:00 committed by GitHub
commit ef3905e28d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 145 additions and 52 deletions

View File

@ -20,14 +20,14 @@ assignees: ''
* https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
-->
### 现象描述
## 现象描述
<!--
在使用什么功能产生的问题? 其异常表现是什么?
如: 在测试 WebRTC 功能时, 使用 Chrome 浏览器访问 ZLMediait 自带网页播放 FFmpeg 以 RTSP 协议推送的图像有卡顿/花屏.
-->
### 如何复现?
## 如何复现?
<!--
明确的复现步骤对快速解决问题极有帮助.
@ -37,7 +37,7 @@ assignees: ''
1. 期望 ..., 结果 ...
-->
### 相关日志或截图
## 相关日志或截图
<!--
由于日志通长较长, 建议将日志信息填写到下面的 "日志内容..."
@ -50,11 +50,14 @@ assignees: ''
<details>
<summary>展开查看详细日志</summary>
<pre>
日志内容...
```
#详细日志粘在这里!
```
</pre>
</details>
### 配置
## 配置
<!--
部分常见问题是由于配置错误导致的, 建议仔细阅读配置文件中的注释信息
@ -65,11 +68,14 @@ assignees: ''
<details>
<summary>展开查看详细配置</summary>
<pre>
配置内容...
```ini
#config.ini内容粘在这里!
```
</pre>
</details>
### 各种环境信息
## 各种环境信息
<!--
请填写相关环境信息, 详细的环境信息有助于快速复现定位问题.
@ -82,4 +88,8 @@ assignees: ''
* **代码提交记录/git commit hash**:
* **操作系统及版本**:
* **硬件信息**:
* **crash backtrace**:
```
#崩溃信息backtrace粘贴至此
```
* **其他需要补充的信息**:

View File

@ -20,7 +20,7 @@ assignees: ''
* https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
-->
### 相关日志及环境信息
## 相关日志及环境信息
<!--
由于编译日志通长较长, 建议将日志信息填写到下面 `````` block 内,或者上传日志文件
@ -41,7 +41,7 @@ assignees: ''
编译目录下的 `CMakeCache.txt` 文件内容,请直接上传为附件。
### 各种环境信息
## 各种环境信息
<!--
请填写相关环境信息, 详细的环境信息有助于快速复现定位问题.

6
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,6 @@
blank_issues_enabled: false
contact_links:
- name: 技术咨询
url: https://t.zsxq.com/FcVK5
about: 请在知识星球发起技术咨询

View File

@ -7,8 +7,8 @@ assignees: ''
---
**描述该功能的用处,可以提供相关资料描述该功能**
## 描述该功能的用处,可以提供相关资料描述该功能
**该功能是否用于改进项目缺陷,如果是,请描述现有缺陷**
## 该功能是否用于改进项目缺陷,如果是,请描述现有缺陷
**描述你期望实现该功能的方式和最终效果**
## 描述你期望实现该功能的方式和最终效果

View File

@ -1,19 +0,0 @@
---
name: 技术咨询
about: 使用咨询、技术咨询等
title: "[技术咨询] 咨询描述(必填)"
labels: 技术咨询
assignees: ''
---
**咨询的功能模块**
- 请描述您想咨询zlmediakit的哪部分功能
**咨询的具体内容和问题**
- 此处展开您咨询内容的描述
**注意事项**
- 技术咨询前请先认真阅读readme, [wiki](https://github.com/ZLMediaKit/ZLMediaKit/wiki),如有必要您也可以同时搜索已经答复的issue如果没找到答案才在此提issue
- 技术咨询不属于bug缺陷要求用户先star(收藏)本项目否则会直接关闭issue

View File

@ -1,8 +0,0 @@
---
name: issue创建要求
about: 不符合模板要求不便定位问题,可能会被管理员直接关闭
title: ""
labels: ''
assignees: ''
---

51
.github/workflows/issue_lint.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: issue_lint
on:
issues:
types: [opened]
jobs:
issue_lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs').promises;
const getTitles = (str) => (
[...str.matchAll(/^## (.*)/gm)].map((m) => m[0])
);
const titles = getTitles(context.payload.issue.body);
for (let file of await fs.readdir('.github/ISSUE_TEMPLATE')) {
if (!file.endsWith('.md')) {
continue;
}
const template = await fs.readFile(`.github/ISSUE_TEMPLATE/${file}`, 'utf-8');
const templateTitles = getTitles(template);
if (templateTitles.every((title) => titles.includes(title))) {
process.exit(0);
}
}
await github.rest.issues.createComment({
owner: context.issue.owner,
repo: context.issue.repo,
issue_number: context.issue.number,
body: '此issue由于不符合模板规范已经自动关闭请重新按照模板规范确保包含模板中所有章节标题再提交\n',
});
await github.rest.issues.update({
owner: context.issue.owner,
repo: context.issue.repo,
issue_number: context.issue.number,
state: 'closed',
});

@ -1 +1 @@
Subproject commit 26d54bbc7b1860a450434dce49bbc8fcbcbae88b
Subproject commit 1e1a990783c6c09452419c0aaa6d72ce02d0202b

View File

@ -51,6 +51,9 @@ extern "C" {
//输出日志到回调函数(mk_events::on_mk_log)
#define LOG_CALLBACK (1 << 2)
//向下兼容
#define mk_env_init1 mk_env_init2
//回调user_data回调函数
typedef void(API_CALL *on_user_data_free)(void *user_data);
@ -104,7 +107,7 @@ API_EXPORT void API_CALL mk_stop_all_server();
* @param ssl ssl证书内容或路径NULL
* @param ssl_pwd NULL
*/
API_EXPORT void API_CALL mk_env_init1(int thread_num,
API_EXPORT void API_CALL mk_env_init2(int thread_num,
int log_level,
int log_mask,
const char *log_file_path,

View File

@ -32,6 +32,7 @@ typedef struct mk_proxy_player_t *mk_proxy_player;
*/
API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create(const char *vhost, const char *app, const char *stream, int hls_enabled, int mp4_enabled);
/**
*
* @param vhost __defaultVhost__
@ -43,6 +44,32 @@ API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create(const char *vhost, co
API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create2(const char *vhost, const char *app, const char *stream, mk_ini option);
/**
*
* @param vhost __defaultVhost__
* @param app
* @param stream
* @param rtp_type rtsp播放方式:RTP_TCP = 0, RTP_UDP = 1, RTP_MULTICAST = 2
* @param hls_enabled hls
* @param mp4_enabled mp4
* @param retry_count <0
* @return
*/
API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create3(const char *vhost, const char *app, const char *stream, int hls_enabled, int mp4_enabled, int retry_count);
/**
*
* @param vhost __defaultVhost__
* @param app
* @param stream
* @param option ProtocolOption相关配置
* @param retry_count <0
* @return
*/
API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create4(const char *vhost, const char *app, const char *stream, mk_ini option, int retry_count);
/**
*
* @param ctx

View File

@ -83,7 +83,7 @@ API_EXPORT void API_CALL mk_stop_all_server(){
stopAllTcpServer();
}
API_EXPORT void API_CALL mk_env_init1(int thread_num,
API_EXPORT void API_CALL mk_env_init2(int thread_num,
int log_level,
int log_mask,
const char *log_file_path,

View File

@ -16,22 +16,30 @@ using namespace toolkit;
using namespace mediakit;
API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create(const char *vhost, const char *app, const char *stream, int hls_enabled, int mp4_enabled) {
return mk_proxy_player_create3(vhost, app, stream, hls_enabled, mp4_enabled,-1);
}
API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create2(const char *vhost, const char *app, const char *stream, mk_ini ini) {
return mk_proxy_player_create4(vhost, app, stream, ini, -1);
}
API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create3(const char *vhost, const char *app, const char *stream, int hls_enabled, int mp4_enabled, int retry_count) {
assert(vhost && app && stream);
ProtocolOption option;
option.enable_hls = hls_enabled;
option.enable_mp4 = mp4_enabled;
PlayerProxy::Ptr *obj(new PlayerProxy::Ptr(new PlayerProxy(vhost, app, stream, option)));
return (mk_proxy_player) obj;
}
API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create2(const char *vhost, const char *app, const char *stream, mk_ini ini) {
assert(vhost && app && stream);
ProtocolOption option(*((mINI *)ini));
PlayerProxy::Ptr *obj(new PlayerProxy::Ptr(new PlayerProxy(vhost, app, stream, option)));
PlayerProxy::Ptr *obj(new PlayerProxy::Ptr(new PlayerProxy(vhost, app, stream, option, retry_count)));
return (mk_proxy_player)obj;
}
API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create4(const char *vhost, const char *app, const char *stream, mk_ini ini, int retry_count) {
assert(vhost && app && stream);
ProtocolOption option(*((mINI *)ini));
PlayerProxy::Ptr *obj(new PlayerProxy::Ptr(new PlayerProxy(vhost, app, stream, option, retry_count)));
return (mk_proxy_player)obj;
}
API_EXPORT void API_CALL mk_proxy_player_release(mk_proxy_player ctx) {
assert(ctx);
PlayerProxy::Ptr *obj = (PlayerProxy::Ptr *) ctx;

View File

@ -22,11 +22,12 @@
#include <map>
#include <iostream>
#include "Common/JemallocUtil.h"
#include "Common/macros.h"
#include "System.h"
#include "Util/util.h"
#include "Util/logger.h"
#include "Util/uv_errno.h"
#include "Common/macros.h"
#include "Common/JemallocUtil.h"
using namespace std;
using namespace toolkit;
@ -66,6 +67,16 @@ static void save_jemalloc_stats() {
out.flush();
}
static std::string get_func_symbol(const std::string &symbol) {
size_t pos1 = symbol.find("(");
if (pos1 == string::npos) {
return "";
}
size_t pos2 = symbol.find("+", pos1);
auto ret = symbol.substr(pos1 + 1, pos2 - pos1 - 1);
return ret;
}
static void sig_crash(int sig) {
signal(sig, SIG_DFL);
void *array[MAX_STACK_FRAMES];
@ -78,6 +89,10 @@ static void sig_crash(int sig) {
std::string symbol(strings[i]);
ref.emplace_back(symbol);
#if defined(__linux) || defined(__linux__)
auto func_symbol = get_func_symbol(symbol);
if (!func_symbol.empty()) {
ref.emplace_back(toolkit::demangle(func_symbol.data()));
}
static auto addr2line = [](const string &address) {
string cmd = StrPrinter << "addr2line -C -f -e " << exePath() << " " << address;
return System::execute(cmd);