Allow external initialization of libsrtp.
Bug: webrtc:11205 Change-Id: I906651e3afc5c50977ff567f13a44e5087604028 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161952 Reviewed-by: Per Kjellander <perkj@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30074}
This commit is contained in:
parent
6286bb0b2c
commit
22619b3ed6
@ -366,6 +366,11 @@ bool SrtpSession::UpdateKey(int type,
|
||||
ABSL_CONST_INIT int g_libsrtp_usage_count = 0;
|
||||
ABSL_CONST_INIT rtc::GlobalLock g_libsrtp_lock;
|
||||
|
||||
void ProhibitLibsrtpInitialization() {
|
||||
rtc::GlobalLockScope ls(&g_libsrtp_lock);
|
||||
++g_libsrtp_usage_count;
|
||||
}
|
||||
|
||||
// static
|
||||
bool SrtpSession::IncrementLibsrtpUsageCountAndMaybeInit() {
|
||||
rtc::GlobalLockScope ls(&g_libsrtp_lock);
|
||||
|
||||
@ -22,6 +22,11 @@ struct srtp_ctx_t_;
|
||||
|
||||
namespace cricket {
|
||||
|
||||
// Prohibits webrtc from initializing libsrtp. This can be used if libsrtp is
|
||||
// initialized by another library or explicitly. Note that this must be called
|
||||
// before creating an SRTP session with WebRTC.
|
||||
void ProhibitLibsrtpInitialization();
|
||||
|
||||
// Class that wraps a libSRTP session.
|
||||
class SrtpSession {
|
||||
public:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user