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

This commit is contained in:
ziyue 2022-02-22 11:46:15 +08:00
commit caf6ddf554
5 changed files with 90 additions and 32 deletions

View File

@ -1,26 +0,0 @@
---
name: bug反馈
about: 反馈zlmediakit代码本身的bug
title: "[BUG]"
labels: bug
assignees: ''
---
**bug现象**
- bug产生时服务器的异常行为(例如: 崩溃/无法访问/丢包花屏)
- bug产生时打印的上下文日志(可以截图或粘贴文本)
- 调试core文件时崩溃触发点的函数调用栈(可以截图或粘贴文本)
**bug产生时的使用场景**
- 产生bug时您正在使用zlm的什么功能模块
**bug是否可以复现怎么复现**
- 请描述bug复现时的操作步骤
**zlm代码git commit hash值**
- git log查看
**操作系统环境**
- 什么类型的操作系统32位64位
- 什么cpu类型

80
.github/ISSUE_TEMPLATE/bug.md vendored Normal file
View File

@ -0,0 +1,80 @@
---
name: bug 反馈
about: 反馈 ZLMediaKit 代码本身的 bug
title: "[BUG]: <BUG 现象描述>"
labels: bug
assignees: ''
---
<!--
请仔细阅读相关注释提示, 请务必根据提示填写相关信息.
1. 信息不完整会影响问题的解决速度.
1. 乱七八糟的渲染格式也会影响开发者心情, 同样会影响问题的解决. 提交前请务必点击 Preview/预览下反馈的显示效果.
-->
<!--
markdown 语法参考:
* https://docs.github.com/cn/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
* 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 协议推送的图像有卡顿/花屏.
-->
### 如何复现?
<!--
明确的复现步骤对快速解决问题极有帮助.
格式参考:
1. 首先 ...
1. 然后 ...
1. 期望 ..., 结果 ...
-->
### 相关日志或截图
<!--
由于日志通长较长, 建议将日志信息填写到下面的 "日志内容..."
如果是程序异常崩溃/终止, 相关调用栈信息也极为有用, 可复制下面的格式, 添加相关调用栈信息.
-->
<details>
<summary>展开查看详细日志</summary>
<pre>
日志内容...
</pre>
</details>
### 配置
<!--
部分常见问题是由于配置错误导致的, 建议仔细阅读配置文件中的注释信息
-->
<details>
<summary>展开查看详细配置</summary>
<pre>
配置内容...
</pre>
</details>
### 各种环境信息
<!--
请填写相关环境信息, 详细的环境信息有助于快速复现定位问题.
* 代码提交记录, 可使用命令 `git rev-parse HEAD` 进行查看.
* 操作系统及版本, 如: Windows 10, CentOS 7, ...
* 硬件信息, 如: Intel, AMD, ARM, 飞腾, 龙芯, ...
-->
* **代码提交记录/git commit hash**:
* **操作系统及版本**:
* **硬件信息**:
* **其他需要补充的信息**:

View File

@ -33,10 +33,10 @@ std::shared_ptr<AVPacket> alloc_av_packet(){
//////////////////////////////////////////////////////////////////////////////////////////
template<bool decoder = true, typename ...ARGS>
AVCodec *getCodec(ARGS ...names);
const AVCodec *getCodec(ARGS ...names);
template<bool decoder = true>
AVCodec *getCodec(const char *name) {
const AVCodec *getCodec(const char *name) {
auto codec = decoder ? avcodec_find_decoder_by_name(name) : avcodec_find_encoder_by_name(name);
if (codec) {
InfoL << (decoder ? "got decoder:" : "got encoder:") << name;
@ -45,7 +45,7 @@ AVCodec *getCodec(const char *name) {
}
template<bool decoder = true>
AVCodec *getCodec(enum AVCodecID id) {
const AVCodec *getCodec(enum AVCodecID id) {
auto codec = decoder ? avcodec_find_decoder(id) : avcodec_find_encoder(id);
if (codec) {
InfoL << (decoder ? "got decoder:" : "got encoder:") << avcodec_get_name(id);
@ -54,7 +54,7 @@ AVCodec *getCodec(enum AVCodecID id) {
}
template<bool decoder = true, typename First, typename ...ARGS>
AVCodec *getCodec(First first, ARGS ...names) {
const AVCodec *getCodec(First first, ARGS ...names) {
auto codec = getCodec<decoder>(names...);
if (codec) {
return codec;
@ -139,9 +139,11 @@ FFmpegFrame::Ptr FFmpegSwr::inputFrame(const FFmpegFrame::Ptr &frame) {
///////////////////////////////////////////////////////////////////////////
FFmpegDecoder::FFmpegDecoder(const Track::Ptr &track) {
#if (LIBAVCODEC_VERSION_MAJOR < 58)
avcodec_register_all();
AVCodec *codec = nullptr;
AVCodec *codec_default = nullptr;
#endif
const AVCodec *codec = nullptr;
const AVCodec *codec_default = nullptr;
switch (track->getCodecId()) {
case CodecH264:
codec_default = getCodec(AV_CODEC_ID_H264);
@ -181,7 +183,9 @@ FFmpegDecoder::FFmpegDecoder(const Track::Ptr &track) {
}
//保存AVFrame的引用
#ifdef FF_API_OLD_ENCDEC
_context->refcounted_frames = 1;
#endif
_context->flags |= AV_CODEC_FLAG_LOW_DELAY;
_context->flags2 |= AV_CODEC_FLAG2_FAST;