mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 02:34:26 +08:00
更新并适配ZLToolKit
This commit is contained in:
parent
47b8435d7c
commit
da704ab2f1
@ -1 +1 @@
|
||||
Subproject commit fb695d203421d906c473018022a736fa4a7a47e4
|
||||
Subproject commit abf61efe35d99a775669d417f0c3e8f8d0992f0e
|
@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
#include "macros.h"
|
||||
#include "Util/util.h"
|
||||
|
||||
using namespace toolkit;
|
||||
|
||||
@ -17,20 +16,6 @@ using namespace toolkit;
|
||||
#include "ZLMVersion.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
void Assert_Throw(int failed, const char *exp, const char *func, const char *file, int line, const char *str) {
|
||||
if (failed) {
|
||||
_StrPrinter printer;
|
||||
printer << "Assertion failed: (" << exp ;
|
||||
if(str && *str){
|
||||
printer << ", " << str;
|
||||
}
|
||||
printer << "), function " << func << ", file " << file << ", line " << line << ".";
|
||||
throw mediakit::AssertFailedException(printer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
/**
|
||||
|
@ -11,9 +11,10 @@
|
||||
#ifndef ZLMEDIAKIT_MACROS_H
|
||||
#define ZLMEDIAKIT_MACROS_H
|
||||
|
||||
#include "Util/logger.h"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include "Util/util.h"
|
||||
#include "Util/logger.h"
|
||||
#if defined(__MACH__)
|
||||
#include <arpa/inet.h>
|
||||
#include <machine/endian.h>
|
||||
@ -40,7 +41,7 @@
|
||||
#define CHECK_RET(...) \
|
||||
try { \
|
||||
CHECK(__VA_ARGS__); \
|
||||
} catch (AssertFailedException & ex) { \
|
||||
} catch (toolkit::AssertFailedException & ex) { \
|
||||
WarnL << ex.what(); \
|
||||
return; \
|
||||
}
|
||||
@ -71,22 +72,8 @@
|
||||
#define VHOST_KEY "vhost"
|
||||
#define DEFAULT_VHOST "__defaultVhost__"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void Assert_Throw(int failed, const char *exp, const char *func, const char *file, int line, const char *str);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
class AssertFailedException : public std::runtime_error {
|
||||
public:
|
||||
template<typename ...T>
|
||||
AssertFailedException(T && ...args) : std::runtime_error(std::forward<T>(args)...) {}
|
||||
};
|
||||
|
||||
extern const char kServerName[];
|
||||
|
||||
template <typename... ARGS>
|
||||
|
@ -63,7 +63,7 @@ const char *PSDecoder::onSearchPacketTail(const char *data, size_t len) {
|
||||
|
||||
//解析失败,丢弃所有数据
|
||||
return data + len;
|
||||
} catch (AssertFailedException &ex) {
|
||||
} catch (toolkit::AssertFailedException &ex) {
|
||||
InfoL << "解析 ps 异常: bytes=" << len
|
||||
<< ", exception=" << ex.what()
|
||||
<< ", hex=" << hexdump(data, MIN(len, 32));
|
||||
|
@ -72,7 +72,7 @@ ssize_t RtspSplitter::onRecvHeader(const char *data, size_t len) {
|
||||
}
|
||||
try {
|
||||
_parser.parse(data, len);
|
||||
} catch (mediakit::AssertFailedException &ex){
|
||||
} catch (toolkit::AssertFailedException &ex){
|
||||
if (!_enableRecvRtp) {
|
||||
// 还在握手中,直接中断握手
|
||||
throw;
|
||||
|
Loading…
Reference in New Issue
Block a user