优化RTMP播放器重连和稳定性
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// Copyright (c) 2010-2026, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
@@ -14,8 +14,8 @@
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
import CocoaLumberjack
|
||||
import CocoaLumberjackSwiftSupport
|
||||
public import CocoaLumberjack
|
||||
public import CocoaLumberjackSwiftSupport
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -29,9 +29,91 @@ import CocoaLumberjackSwiftSupport
|
||||
* The default is an empty string.
|
||||
*/
|
||||
@inlinable
|
||||
public func DDAssert(_ condition: @autoclosure () -> Bool, _ message: @autoclosure () -> String = "", level: DDLogLevel = DDDefaultLogLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = false, ddlog: DDLog = DDLog.sharedInstance) {
|
||||
public func DDAssert(_ condition: @autoclosure () -> Bool,
|
||||
_ message: @autoclosure () -> DDLogMessageFormat = "",
|
||||
level: DDLogLevel = DDDefaultLogLevel,
|
||||
context: Int = 0,
|
||||
file: StaticString = #file,
|
||||
function: StaticString = #function,
|
||||
line: UInt = #line,
|
||||
tag: Any? = nil,
|
||||
asynchronous async: Bool? = nil,
|
||||
ddlog: DDLog = DDLog.sharedInstance) {
|
||||
if !condition() {
|
||||
DDLogError(message(), level: level, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
|
||||
DDLogError(message(),
|
||||
level: level,
|
||||
context: context,
|
||||
file: file,
|
||||
function: function,
|
||||
line: line,
|
||||
tag: tag,
|
||||
asynchronous: async,
|
||||
ddlog: ddlog)
|
||||
Swift.assertionFailure(message().formatted, file: file, line: line)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replacement for Swift's `assertionFailure` function that will output a log message even
|
||||
* when assertions are disabled.
|
||||
*
|
||||
* - Parameters:
|
||||
* - message: A string to log (using `DDLogError`). The default is an empty string.
|
||||
*/
|
||||
@inlinable
|
||||
public func DDAssertionFailure(_ message: @autoclosure () -> DDLogMessageFormat = "",
|
||||
level: DDLogLevel = DDDefaultLogLevel,
|
||||
context: Int = 0,
|
||||
file: StaticString = #file,
|
||||
function: StaticString = #function,
|
||||
line: UInt = #line,
|
||||
tag: Any? = nil,
|
||||
asynchronous async: Bool? = nil,
|
||||
ddlog: DDLog = DDLog.sharedInstance) {
|
||||
DDLogError(message(),
|
||||
level: level,
|
||||
context: context,
|
||||
file: file,
|
||||
function: function,
|
||||
line: line,
|
||||
tag: tag,
|
||||
asynchronous: async,
|
||||
ddlog: ddlog)
|
||||
Swift.assertionFailure(message().formatted, file: file, line: line)
|
||||
}
|
||||
|
||||
/**
|
||||
* Replacement for Swift's `assert` function that will output a log message even when assertions
|
||||
* are disabled.
|
||||
*
|
||||
* - Parameters:
|
||||
* - condition: The condition to test. Unlike `Swift.assert`, `condition` is always evaluated,
|
||||
* even when assertions are disabled.
|
||||
* - message: A string to log (using `DDLogError`) if `condition` evaluates to `false`.
|
||||
* The default is an empty string.
|
||||
*/
|
||||
@inlinable
|
||||
@available(*, deprecated, message: "Use an interpolated message.")
|
||||
public func DDAssert(_ condition: @autoclosure () -> Bool,
|
||||
_ message: @autoclosure () -> String = "",
|
||||
level: DDLogLevel = DDDefaultLogLevel,
|
||||
context: Int = 0,
|
||||
file: StaticString = #file,
|
||||
function: StaticString = #function,
|
||||
line: UInt = #line,
|
||||
tag: Any? = nil,
|
||||
asynchronous async: Bool? = nil,
|
||||
ddlog: DDLog = DDLog.sharedInstance) {
|
||||
if !condition() {
|
||||
DDLogError(message(),
|
||||
level: level,
|
||||
context: context,
|
||||
file: file,
|
||||
function: function,
|
||||
line: line,
|
||||
tag: tag,
|
||||
asynchronous: async,
|
||||
ddlog: ddlog)
|
||||
Swift.assertionFailure(message(), file: file, line: line)
|
||||
}
|
||||
}
|
||||
@@ -44,7 +126,24 @@ public func DDAssert(_ condition: @autoclosure () -> Bool, _ message: @autoclosu
|
||||
* - message: A string to log (using `DDLogError`). The default is an empty string.
|
||||
*/
|
||||
@inlinable
|
||||
public func DDAssertionFailure(_ message: @autoclosure () -> String = "", level: DDLogLevel = DDDefaultLogLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = false, ddlog: DDLog = DDLog.sharedInstance) {
|
||||
DDLogError(message(), level: level, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
|
||||
@available(*, deprecated, message: "Use an interpolated message.")
|
||||
public func DDAssertionFailure(_ message: @autoclosure () -> String = "",
|
||||
level: DDLogLevel = DDDefaultLogLevel,
|
||||
context: Int = 0,
|
||||
file: StaticString = #file,
|
||||
function: StaticString = #function,
|
||||
line: UInt = #line,
|
||||
tag: Any? = nil,
|
||||
asynchronous async: Bool? = nil,
|
||||
ddlog: DDLog = DDLog.sharedInstance) {
|
||||
DDLogError(message(),
|
||||
level: level,
|
||||
context: context,
|
||||
file: file,
|
||||
function: function,
|
||||
line: line,
|
||||
tag: tag,
|
||||
asynchronous: async,
|
||||
ddlog: ddlog)
|
||||
Swift.assertionFailure(message(), file: file, line: line)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user