From 7eb861e5db9edab8ae8edf1ab6c4ab21f713619c Mon Sep 17 00:00:00 2001 From: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com> Date: Wed, 5 Jun 2024 03:36:22 +0900 Subject: [PATCH 1/7] implement --- sdk/objc/api/peerconnection/RTCFrameCryptor.h | 4 +- .../api/peerconnection/RTCFrameCryptor.mm | 107 ++++++++++-------- 2 files changed, 61 insertions(+), 50 deletions(-) diff --git a/sdk/objc/api/peerconnection/RTCFrameCryptor.h b/sdk/objc/api/peerconnection/RTCFrameCryptor.h index 5b58bf04d5..d3219a47a8 100644 --- a/sdk/objc/api/peerconnection/RTCFrameCryptor.h +++ b/sdk/objc/api/peerconnection/RTCFrameCryptor.h @@ -61,13 +61,13 @@ RTC_OBJC_EXPORT @property(nonatomic, weak, nullable) id delegate; -- (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory +- (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory rtpSender:(RTC_OBJC_TYPE(RTCRtpSender) *)sender participantId:(NSString *)participantId algorithm:(RTCCyrptorAlgorithm)algorithm keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider; -- (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory +- (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory rtpReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)receiver participantId:(NSString *)participantId algorithm:(RTCCyrptorAlgorithm)algorithm diff --git a/sdk/objc/api/peerconnection/RTCFrameCryptor.mm b/sdk/objc/api/peerconnection/RTCFrameCryptor.mm index e0b93c62bb..dbd89a48e3 100644 --- a/sdk/objc/api/peerconnection/RTCFrameCryptor.mm +++ b/sdk/objc/api/peerconnection/RTCFrameCryptor.mm @@ -16,9 +16,9 @@ #import "RTCFrameCryptor+Private.h" #import "RTCFrameCryptorKeyProvider+Private.h" +#import "RTCPeerConnectionFactory+Private.h" #import "RTCRtpReceiver+Private.h" #import "RTCRtpSender+Private.h" -#import "RTCPeerConnectionFactory+Private.h" #include @@ -94,7 +94,7 @@ @implementation RTC_OBJC_TYPE (RTCFrameCryptor) { const webrtc::RtpSenderInterface *_sender; const webrtc::RtpReceiverInterface *_receiver; NSString *_participantId; - rtc::scoped_refptr frame_crypto_transformer_; + rtc::scoped_refptr _frame_crypto_transformer; rtc::scoped_refptr _observer; } @@ -112,76 +112,87 @@ @implementation RTC_OBJC_TYPE (RTCFrameCryptor) { } } -- (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory - rtpSender:(RTC_OBJC_TYPE(RTCRtpSender) *)sender - participantId:(NSString *)participantId - algorithm:(RTCCyrptorAlgorithm)algorithm - keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider { +- (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory + rtpSender:(RTC_OBJC_TYPE(RTCRtpSender) *)sender + participantId:(NSString *)participantId + algorithm:(RTCCyrptorAlgorithm)algorithm + keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider { if (self = [super init]) { + rtc::scoped_refptr nativeRtpSender = sender.nativeRtpSender; + if (nativeRtpSender == nullptr) return nil; + + rtc::scoped_refptr nativeTrack = nativeRtpSender->track(); + if (nativeTrack == nullptr) return nil; + _observer = rtc::make_ref_counted(self); _participantId = participantId; - auto rtpSender = sender.nativeRtpSender; - auto mediaType = rtpSender->track()->kind() == "audio" ? - webrtc::FrameCryptorTransformer::MediaType::kAudioFrame : - webrtc::FrameCryptorTransformer::MediaType::kVideoFrame; - frame_crypto_transformer_ = rtc::scoped_refptr( - new webrtc::FrameCryptorTransformer(factory.signalingThread, - [participantId stdString], - mediaType, - [self algorithmFromEnum:algorithm], - keyProvider.nativeKeyProvider)); - - rtpSender->SetEncoderToPacketizerFrameTransformer(frame_crypto_transformer_); - frame_crypto_transformer_->SetEnabled(false); - frame_crypto_transformer_->RegisterFrameCryptorTransformerObserver(_observer); + + webrtc::FrameCryptorTransformer::MediaType mediaType = + nativeTrack->kind() == "audio" ? webrtc::FrameCryptorTransformer::MediaType::kAudioFrame + : webrtc::FrameCryptorTransformer::MediaType::kVideoFrame; + + _frame_crypto_transformer = + rtc::scoped_refptr(new webrtc::FrameCryptorTransformer( + factory.signalingThread, [participantId stdString], mediaType, + [self algorithmFromEnum:algorithm], keyProvider.nativeKeyProvider)); + + nativeRtpSender->SetEncoderToPacketizerFrameTransformer(_frame_crypto_transformer); + _frame_crypto_transformer->SetEnabled(false); + _frame_crypto_transformer->RegisterFrameCryptorTransformerObserver(_observer); } return self; } -- (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory - rtpReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)receiver - participantId:(NSString *)participantId - algorithm:(RTCCyrptorAlgorithm)algorithm - keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider { +- (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory + rtpReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)receiver + participantId:(NSString *)participantId + algorithm:(RTCCyrptorAlgorithm)algorithm + keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider { if (self = [super init]) { + rtc::scoped_refptr nativeRtpReceiver = receiver.nativeRtpReceiver; + if (nativeRtpReceiver == nullptr) return nil; + + rtc::scoped_refptr nativeTrack = nativeRtpReceiver->track(); + if (nativeTrack == nullptr) return nil; + _observer = rtc::make_ref_counted(self); _participantId = participantId; - auto rtpReceiver = receiver.nativeRtpReceiver; - auto mediaType = rtpReceiver->track()->kind() == "audio" ? - webrtc::FrameCryptorTransformer::MediaType::kAudioFrame : - webrtc::FrameCryptorTransformer::MediaType::kVideoFrame; - frame_crypto_transformer_ = rtc::scoped_refptr( - new webrtc::FrameCryptorTransformer(factory.signalingThread, - [participantId stdString], - mediaType, - [self algorithmFromEnum:algorithm], - keyProvider.nativeKeyProvider)); - - rtpReceiver->SetDepacketizerToDecoderFrameTransformer(frame_crypto_transformer_); - frame_crypto_transformer_->SetEnabled(false); - frame_crypto_transformer_->RegisterFrameCryptorTransformerObserver(_observer); + + webrtc::FrameCryptorTransformer::MediaType mediaType = + nativeTrack->kind() == "audio" ? webrtc::FrameCryptorTransformer::MediaType::kAudioFrame + : webrtc::FrameCryptorTransformer::MediaType::kVideoFrame; + + _frame_crypto_transformer = + rtc::scoped_refptr(new webrtc::FrameCryptorTransformer( + factory.signalingThread, [participantId stdString], mediaType, + [self algorithmFromEnum:algorithm], keyProvider.nativeKeyProvider)); + + nativeRtpReceiver->SetDepacketizerToDecoderFrameTransformer(_frame_crypto_transformer); + _frame_crypto_transformer->SetEnabled(false); + _frame_crypto_transformer->RegisterFrameCryptorTransformerObserver(_observer); } return self; } +- (void)dealloc { + if (_frame_crypto_transformer == nullptr) return; + _frame_crypto_transformer->UnRegisterFrameCryptorTransformerObserver(); +} + - (BOOL)enabled { - return frame_crypto_transformer_->enabled(); + return _frame_crypto_transformer->enabled(); } - (void)setEnabled:(BOOL)enabled { - frame_crypto_transformer_->SetEnabled(enabled); + _frame_crypto_transformer->SetEnabled(enabled); } - (int)keyIndex { - return frame_crypto_transformer_->key_index(); + return _frame_crypto_transformer->key_index(); } - (void)setKeyIndex:(int)keyIndex { - frame_crypto_transformer_->SetKeyIndex(keyIndex); -} - -- (void)dealloc { - frame_crypto_transformer_->UnRegisterFrameCryptorTransformerObserver(); + _frame_crypto_transformer->SetKeyIndex(keyIndex); } @end From d0f9b83912570c4d13e9903976f76a4541aa5a70 Mon Sep 17 00:00:00 2001 From: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com> Date: Wed, 5 Jun 2024 03:36:48 +0900 Subject: [PATCH 2/7] format --- sdk/objc/api/peerconnection/RTCFrameCryptor.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/objc/api/peerconnection/RTCFrameCryptor.h b/sdk/objc/api/peerconnection/RTCFrameCryptor.h index d3219a47a8..79fa1c5ed4 100644 --- a/sdk/objc/api/peerconnection/RTCFrameCryptor.h +++ b/sdk/objc/api/peerconnection/RTCFrameCryptor.h @@ -62,16 +62,16 @@ RTC_OBJC_EXPORT @property(nonatomic, weak, nullable) id delegate; - (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory - rtpSender:(RTC_OBJC_TYPE(RTCRtpSender) *)sender - participantId:(NSString *)participantId - algorithm:(RTCCyrptorAlgorithm)algorithm - keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider; + rtpSender:(RTC_OBJC_TYPE(RTCRtpSender) *)sender + participantId:(NSString *)participantId + algorithm:(RTCCyrptorAlgorithm)algorithm + keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider; - (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory - rtpReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)receiver - participantId:(NSString *)participantId - algorithm:(RTCCyrptorAlgorithm)algorithm - keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider; + rtpReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)receiver + participantId:(NSString *)participantId + algorithm:(RTCCyrptorAlgorithm)algorithm + keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider; @end From 8c59cfb9a679e8bbd07a5fd3de18a87a104df312 Mon Sep 17 00:00:00 2001 From: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com> Date: Wed, 5 Jun 2024 03:38:26 +0900 Subject: [PATCH 3/7] checks on methods --- sdk/objc/api/peerconnection/RTCFrameCryptor.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdk/objc/api/peerconnection/RTCFrameCryptor.mm b/sdk/objc/api/peerconnection/RTCFrameCryptor.mm index dbd89a48e3..e4aa68764b 100644 --- a/sdk/objc/api/peerconnection/RTCFrameCryptor.mm +++ b/sdk/objc/api/peerconnection/RTCFrameCryptor.mm @@ -140,6 +140,7 @@ - (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory _frame_crypto_transformer->SetEnabled(false); _frame_crypto_transformer->RegisterFrameCryptorTransformerObserver(_observer); } + return self; } @@ -171,6 +172,7 @@ - (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory _frame_crypto_transformer->SetEnabled(false); _frame_crypto_transformer->RegisterFrameCryptorTransformerObserver(_observer); } + return self; } @@ -180,18 +182,22 @@ - (void)dealloc { } - (BOOL)enabled { + if (_frame_crypto_transformer == nullptr) return NO; return _frame_crypto_transformer->enabled(); } - (void)setEnabled:(BOOL)enabled { + if (_frame_crypto_transformer == nullptr) return; _frame_crypto_transformer->SetEnabled(enabled); } - (int)keyIndex { + if (_frame_crypto_transformer == nullptr) return 0; return _frame_crypto_transformer->key_index(); } - (void)setKeyIndex:(int)keyIndex { + if (_frame_crypto_transformer == nullptr) return; _frame_crypto_transformer->SetKeyIndex(keyIndex); } From dcdd1b46606ff7315e554c0bff47d2c50acb4c15 Mon Sep 17 00:00:00 2001 From: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com> Date: Wed, 5 Jun 2024 03:51:28 +0900 Subject: [PATCH 4/7] lock --- .../api/peerconnection/RTCFrameCryptor.mm | 39 ++++++++++++++----- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/sdk/objc/api/peerconnection/RTCFrameCryptor.mm b/sdk/objc/api/peerconnection/RTCFrameCryptor.mm index e4aa68764b..d21336f022 100644 --- a/sdk/objc/api/peerconnection/RTCFrameCryptor.mm +++ b/sdk/objc/api/peerconnection/RTCFrameCryptor.mm @@ -20,6 +20,7 @@ #import "RTCRtpReceiver+Private.h" #import "RTCRtpSender+Private.h" +#import #include #import "base/RTCLogging.h" @@ -96,6 +97,7 @@ @implementation RTC_OBJC_TYPE (RTCFrameCryptor) { NSString *_participantId; rtc::scoped_refptr _frame_crypto_transformer; rtc::scoped_refptr _observer; + os_unfair_lock _lock; } @synthesize participantId = _participantId; @@ -118,6 +120,8 @@ - (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory algorithm:(RTCCyrptorAlgorithm)algorithm keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider { if (self = [super init]) { + _lock = OS_UNFAIR_LOCK_INIT; + rtc::scoped_refptr nativeRtpSender = sender.nativeRtpSender; if (nativeRtpSender == nullptr) return nil; @@ -150,6 +154,8 @@ - (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory algorithm:(RTCCyrptorAlgorithm)algorithm keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider { if (self = [super init]) { + _lock = OS_UNFAIR_LOCK_INIT; + rtc::scoped_refptr nativeRtpReceiver = receiver.nativeRtpReceiver; if (nativeRtpReceiver == nullptr) return nil; @@ -177,28 +183,41 @@ - (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory } - (void)dealloc { - if (_frame_crypto_transformer == nullptr) return; - _frame_crypto_transformer->UnRegisterFrameCryptorTransformerObserver(); + os_unfair_lock_lock(&_lock); + if (_frame_crypto_transformer != nullptr) { + _frame_crypto_transformer->UnRegisterFrameCryptorTransformerObserver(); + } + os_unfair_lock_unlock(&_lock); } - (BOOL)enabled { - if (_frame_crypto_transformer == nullptr) return NO; - return _frame_crypto_transformer->enabled(); + os_unfair_lock_lock(&_lock); + BOOL result = _frame_crypto_transformer != nullptr ? _frame_crypto_transformer->enabled() : NO; + os_unfair_lock_unlock(&_lock); + return result; } - (void)setEnabled:(BOOL)enabled { - if (_frame_crypto_transformer == nullptr) return; - _frame_crypto_transformer->SetEnabled(enabled); + os_unfair_lock_lock(&_lock); + if (_frame_crypto_transformer != nullptr) { + _frame_crypto_transformer->SetEnabled(enabled); + } + os_unfair_lock_unlock(&_lock); } - (int)keyIndex { - if (_frame_crypto_transformer == nullptr) return 0; - return _frame_crypto_transformer->key_index(); + os_unfair_lock_lock(&_lock); + int result = _frame_crypto_transformer != nullptr ? _frame_crypto_transformer->key_index() : 0; + os_unfair_lock_unlock(&_lock); + return result; } - (void)setKeyIndex:(int)keyIndex { - if (_frame_crypto_transformer == nullptr) return; - _frame_crypto_transformer->SetKeyIndex(keyIndex); + os_unfair_lock_lock(&_lock); + if (_frame_crypto_transformer != nullptr) { + _frame_crypto_transformer->SetKeyIndex(keyIndex); + } + os_unfair_lock_unlock(&_lock); } @end From 519bb0d47e67f758c6cbf2372b744c34e2fce320 Mon Sep 17 00:00:00 2001 From: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com> Date: Wed, 5 Jun 2024 04:00:08 +0900 Subject: [PATCH 5/7] minor dealloc tweak --- sdk/objc/api/peerconnection/RTCFrameCryptor.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/objc/api/peerconnection/RTCFrameCryptor.mm b/sdk/objc/api/peerconnection/RTCFrameCryptor.mm index d21336f022..f08c3262e3 100644 --- a/sdk/objc/api/peerconnection/RTCFrameCryptor.mm +++ b/sdk/objc/api/peerconnection/RTCFrameCryptor.mm @@ -186,6 +186,10 @@ - (void)dealloc { os_unfair_lock_lock(&_lock); if (_frame_crypto_transformer != nullptr) { _frame_crypto_transformer->UnRegisterFrameCryptorTransformerObserver(); + _frame_crypto_transformer = nullptr; + } + if (_observer != nullptr) { + _observer = nullptr; } os_unfair_lock_unlock(&_lock); } From c5d2dd4fbb5f37c043d5ba2a34f3c491b0516842 Mon Sep 17 00:00:00 2001 From: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com> Date: Wed, 5 Jun 2024 04:01:41 +0900 Subject: [PATCH 6/7] fix typo RTCCyrptorAlgorithm -> RTCCryptorAlgorithm --- sdk/objc/api/peerconnection/RTCFrameCryptor.h | 10 +++++----- sdk/objc/api/peerconnection/RTCFrameCryptor.mm | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sdk/objc/api/peerconnection/RTCFrameCryptor.h b/sdk/objc/api/peerconnection/RTCFrameCryptor.h index 79fa1c5ed4..864e55be95 100644 --- a/sdk/objc/api/peerconnection/RTCFrameCryptor.h +++ b/sdk/objc/api/peerconnection/RTCFrameCryptor.h @@ -26,9 +26,9 @@ NS_ASSUME_NONNULL_BEGIN @class RTC_OBJC_TYPE(RTCFrameCryptor); @class RTC_OBJC_TYPE(RTCPeerConnectionFactory); -typedef NS_ENUM(NSUInteger, RTCCyrptorAlgorithm) { - RTCCyrptorAlgorithmAesGcm = 0, - RTCCyrptorAlgorithmAesCbc, +typedef NS_ENUM(NSUInteger, RTCCryptorAlgorithm) { + RTCCryptorAlgorithmAesGcm = 0, + RTCCryptorAlgorithmAesCbc, }; typedef NS_ENUM(NSInteger, FrameCryptionState) { @@ -64,13 +64,13 @@ RTC_OBJC_EXPORT - (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory rtpSender:(RTC_OBJC_TYPE(RTCRtpSender) *)sender participantId:(NSString *)participantId - algorithm:(RTCCyrptorAlgorithm)algorithm + algorithm:(RTCCryptorAlgorithm)algorithm keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider; - (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory rtpReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)receiver participantId:(NSString *)participantId - algorithm:(RTCCyrptorAlgorithm)algorithm + algorithm:(RTCCryptorAlgorithm)algorithm keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider; @end diff --git a/sdk/objc/api/peerconnection/RTCFrameCryptor.mm b/sdk/objc/api/peerconnection/RTCFrameCryptor.mm index f08c3262e3..68f7f48059 100644 --- a/sdk/objc/api/peerconnection/RTCFrameCryptor.mm +++ b/sdk/objc/api/peerconnection/RTCFrameCryptor.mm @@ -103,11 +103,11 @@ @implementation RTC_OBJC_TYPE (RTCFrameCryptor) { @synthesize participantId = _participantId; @synthesize delegate = _delegate; -- (webrtc::FrameCryptorTransformer::Algorithm)algorithmFromEnum:(RTCCyrptorAlgorithm)algorithm { +- (webrtc::FrameCryptorTransformer::Algorithm)algorithmFromEnum:(RTCCryptorAlgorithm)algorithm { switch (algorithm) { - case RTCCyrptorAlgorithmAesGcm: + case RTCCryptorAlgorithmAesGcm: return webrtc::FrameCryptorTransformer::Algorithm::kAesGcm; - case RTCCyrptorAlgorithmAesCbc: + case RTCCryptorAlgorithmAesCbc: return webrtc::FrameCryptorTransformer::Algorithm::kAesCbc; default: return webrtc::FrameCryptorTransformer::Algorithm::kAesGcm; @@ -117,7 +117,7 @@ @implementation RTC_OBJC_TYPE (RTCFrameCryptor) { - (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory rtpSender:(RTC_OBJC_TYPE(RTCRtpSender) *)sender participantId:(NSString *)participantId - algorithm:(RTCCyrptorAlgorithm)algorithm + algorithm:(RTCCryptorAlgorithm)algorithm keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider { if (self = [super init]) { _lock = OS_UNFAIR_LOCK_INIT; @@ -151,7 +151,7 @@ - (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory - (nullable instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory rtpReceiver:(RTC_OBJC_TYPE(RTCRtpReceiver) *)receiver participantId:(NSString *)participantId - algorithm:(RTCCyrptorAlgorithm)algorithm + algorithm:(RTCCryptorAlgorithm)algorithm keyProvider:(RTC_OBJC_TYPE(RTCFrameCryptorKeyProvider) *)keyProvider { if (self = [super init]) { _lock = OS_UNFAIR_LOCK_INIT; From 15deb3b4d3f7b679802d8a50d2452f9fb13c0e87 Mon Sep 17 00:00:00 2001 From: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com> Date: Wed, 5 Jun 2024 04:22:17 +0900 Subject: [PATCH 7/7] minor clean up --- sdk/objc/api/peerconnection/RTCFrameCryptor.mm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sdk/objc/api/peerconnection/RTCFrameCryptor.mm b/sdk/objc/api/peerconnection/RTCFrameCryptor.mm index 68f7f48059..c51b77e9c5 100644 --- a/sdk/objc/api/peerconnection/RTCFrameCryptor.mm +++ b/sdk/objc/api/peerconnection/RTCFrameCryptor.mm @@ -94,7 +94,6 @@ @implementation RTC_OBJC_TYPE (RTCFrameCryptor) { const webrtc::RtpSenderInterface *_sender; const webrtc::RtpReceiverInterface *_receiver; - NSString *_participantId; rtc::scoped_refptr _frame_crypto_transformer; rtc::scoped_refptr _observer; os_unfair_lock _lock; @@ -188,9 +187,7 @@ - (void)dealloc { _frame_crypto_transformer->UnRegisterFrameCryptorTransformerObserver(); _frame_crypto_transformer = nullptr; } - if (_observer != nullptr) { - _observer = nullptr; - } + _observer = nullptr; os_unfair_lock_unlock(&_lock); }