Compare commits

...

3 Commits

Author SHA1 Message Date
PioLing
2bbd177d5a
Add win32 core dump (#4291)
Some checks failed
Android / build (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Docker / build (push) Has been cancelled
Linux / build (push) Has been cancelled
macOS / build (push) Has been cancelled
Windows / build (push) Has been cancelled
单元测试代码
int main() {
    System::systemSetup();
    int *p = nullptr;
    *p = 1; // 强制崩溃
    return 0;
}

崩溃后直接用 vs2019(2022) 打开 dmp 文件。
菜单选择 File → Open → File...,选择你的 .dmp 文件。
提示你“选择符号和源码”,若有源码和 pdb/symbol 文件能看到更详细的堆栈。
2025-05-31 11:26:00 +08:00
xiongguangjie
a050f38cc9
提升浏览器webrtc g711音频播放效果 (#4280 #4282)
For chrome (136.0.7103.93)
2025-05-11 11:18:34 +08:00
xia-chu
7a7f618a73 修复srtp编译失败导致webrtc特性打开失败问题 2025-05-09 20:25:42 +08:00
4 changed files with 53 additions and 5 deletions

View File

@ -18,7 +18,7 @@ jobs:
with:
repository: cisco/libsrtp
fetch-depth: 1
ref: v2.7.0
ref: v2.3.0
path: 3rdpart/libsrtp
- name: 下载 openssl

View File

@ -38,7 +38,8 @@ bool G711RtpEncoder::inputFrame(const Frame::Ptr &frame) {
_buffer.append(ptr, size);
while (_buffer.size() >= _pkt_bytes) {
RtpCodec::inputRtp(getRtpInfo().makeRtp(TrackAudio, _buffer.data(), _pkt_bytes, false, in_pts), false);
auto tmp = (in_pts+_pkt_dur_ms-1)/_pkt_dur_ms*_pkt_dur_ms;
RtpCodec::inputRtp(getRtpInfo().makeRtp(TrackAudio, _buffer.data(), _pkt_bytes, false, tmp), false);
in_pts += _pkt_dur_ms;
_buffer.erase(0, _pkt_bytes);
}

View File

@ -15,6 +15,12 @@
#if !defined(ANDROID)
#include <execinfo.h>
#endif//!defined(ANDROID)
#else
#include <fcntl.h>
#include <io.h>
#include <Windows.h>
#include <DbgHelp.h>
#pragma comment(lib, "DbgHelp.lib")
#endif//!defined(_WIN32)
#include <cstdlib>
@ -213,6 +219,48 @@ void System::systemSetup(){
// Ignore the hang up signal
signal(SIGHUP, SIG_IGN);
#endif// ANDROID
#else
// 避免系统弹窗导致程序阻塞,适合无界面或后台服务场景。
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
#if !defined(__MINGW32__)
// 将assert和error时错误输出
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
#endif
_setmode(0, _O_BINARY);
_setmode(1, _O_BINARY);
_setmode(2, _O_BINARY);
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
std::ios_base::sync_with_stdio(false);
// 注册crash自动生成dump等价core dump
SetUnhandledExceptionFilter([](EXCEPTION_POINTERS *pException) -> LONG {
// 生成 dump 文件名,带时间戳
char dumpPath[MAX_PATH];
std::time_t t = std::time(nullptr);
std::tm tm;
#ifdef _MSC_VER
localtime_s(&tm, &t);
#else
tm = *std::localtime(&t);
#endif
std::strftime(dumpPath, sizeof(dumpPath), "crash_%Y%m%d_%H%M%S.dmp", &tm);
HANDLE hFile = CreateFileA(dumpPath, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hFile != INVALID_HANDLE_VALUE) {
MINIDUMP_EXCEPTION_INFORMATION mdei;
mdei.ThreadId = GetCurrentThreadId();
mdei.ExceptionPointers = pException;
mdei.ClientPointers = FALSE;
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &mdei, nullptr, nullptr);
CloseHandle(hFile);
}
return EXCEPTION_EXECUTE_HANDLER;
});
#endif//!defined(_WIN32)
}

View File

@ -41,9 +41,7 @@
#include "ZLMVersion.h"
#endif
#if !defined(_WIN32)
#include "System.h"
#endif//!defined(_WIN32)
using namespace std;
using namespace toolkit;
@ -259,10 +257,11 @@ int start_main(int argc,char *argv[]) {
// Start daemon process
System::startDaemon(kill_parent_if_failed);
}
#endif //! defined(_WIN32)
// 开启崩溃捕获等 [AUTO-TRANSLATED:9c7c759c]
// Enable crash capture, etc.
System::systemSetup();
#endif//!defined(_WIN32)
// 启动异步日志线程 [AUTO-TRANSLATED:c93cc6f4]
// Start asynchronous log thread