Remove more self assignment in if-clause
More follow-up to https://webrtc-review.googlesource.com/c/src/+/360460
Bug: chromium:361594695
Change-Id: Ic4445829c4bd73fa4ea5132776bce8ca6b61d23a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361401
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42922}
diff --git a/sdk/objc/api/peerconnection/RTCAudioTrack.mm b/sdk/objc/api/peerconnection/RTCAudioTrack.mm
index 5c1736f..ae6c08a 100644
--- a/sdk/objc/api/peerconnection/RTCAudioTrack.mm
+++ b/sdk/objc/api/peerconnection/RTCAudioTrack.mm
@@ -31,7 +31,8 @@
std::string nativeId = [NSString stdStringForString:trackId];
rtc::scoped_refptr<webrtc::AudioTrackInterface> track =
factory.nativeFactory->CreateAudioTrack(nativeId, source.nativeAudioSource.get());
- if (self = [self initWithFactory:factory nativeTrack:track type:RTCMediaStreamTrackTypeAudio]) {
+ self = [self initWithFactory:factory nativeTrack:track type:RTCMediaStreamTrackTypeAudio];
+ if (self) {
_source = source;
}
return self;
diff --git a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm
index 3d8ff86..826561c 100644
--- a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm
+++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm
@@ -140,7 +140,8 @@
}
- (instancetype)initWithNoMedia {
- if (self = [self initNative]) {
+ self = [self initNative];
+ if (self) {
webrtc::PeerConnectionFactoryDependencies dependencies;
dependencies.network_thread = _networkThread.get();
dependencies.worker_thread = _workerThread.get();
@@ -187,7 +188,8 @@
networkControllerFactory:
(std::unique_ptr<webrtc::NetworkControllerFactoryInterface>)
networkControllerFactory {
- if (self = [self initNative]) {
+ self = [self initNative];
+ if (self) {
webrtc::PeerConnectionFactoryDependencies dependencies;
dependencies.network_thread = _networkThread.get();
dependencies.worker_thread = _workerThread.get();
diff --git a/sdk/objc/api/peerconnection/RTCVideoTrack.mm b/sdk/objc/api/peerconnection/RTCVideoTrack.mm
index 8d9f86d..811d5f0 100644
--- a/sdk/objc/api/peerconnection/RTCVideoTrack.mm
+++ b/sdk/objc/api/peerconnection/RTCVideoTrack.mm
@@ -32,7 +32,8 @@
std::string nativeId = [NSString stdStringForString:trackId];
rtc::scoped_refptr<webrtc::VideoTrackInterface> track =
factory.nativeFactory->CreateVideoTrack(source.nativeVideoSource, nativeId);
- if (self = [self initWithFactory:factory nativeTrack:track type:RTCMediaStreamTrackTypeVideo]) {
+ self = [self initWithFactory:factory nativeTrack:track type:RTCMediaStreamTrackTypeVideo];
+ if (self) {
_source = source;
}
return self;