mirror of
https://gitee.com/xia-chu/ZLMediaKit.git
synced 2026-05-18 15:57:49 +08:00
Compare commits
3 Commits
7b1f8fedac
...
2bbd177d5a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bbd177d5a | ||
|
|
a050f38cc9 | ||
|
|
7a7f618a73 |
2
.github/workflows/linux.yml
vendored
2
.github/workflows/linux.yml
vendored
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user