Add a prefix for objc category.
According to the Google Objective-C style [1], category names should
start with an appropriate prefix. WebRTC has some category definitions
for system interfaces, but it doesn't use prefixes.
$ otool -ov WebRTC.framework/WebRTC | grep -E "^[0-9a-z]{16} 0x[0-9a-z]+ __OBJC_._CATEGORY" | grep -v "_RTC"
0000000002160840 0x217c3c0 __OBJC_$_CATEGORY_UIDevice_$_H264Profile
0000000002160850 0x21808b8 __OBJC_$_CATEGORY_AVCaptureSession_$_DevicePosition
0000000002160858 0x2180968 __OBJC_$_CATEGORY_NSString_$_StdString
0000000002160860 0x21809c8 __OBJC_$_CATEGORY_NSString_$_AbslStringView
To avoid conflicts, prefix the names and methods of those categories.
Also remove sdk/objc/Framework/Classes/Common/NSString+StdString.h as
it is not used by any other files.
[1] https://google.github.io/styleguide/objcguide.html#category-naming
Bug: webrtc:13884
Change-Id: I2cf2742af198ab4e0bfb15c0476d72971e50ceee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262341
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36880}
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index b004993..1d7dc30 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -136,10 +136,10 @@
rtc_library("helpers_objc") {
sources = [
- "objc/helpers/AVCaptureSession+DevicePosition.h",
- "objc/helpers/AVCaptureSession+DevicePosition.mm",
- "objc/helpers/NSString+StdString.h",
- "objc/helpers/NSString+StdString.mm",
+ "objc/helpers/AVCaptureSession+RTCDevicePosition.h",
+ "objc/helpers/AVCaptureSession+RTCDevicePosition.mm",
+ "objc/helpers/NSString+RTCStdString.h",
+ "objc/helpers/NSString+RTCStdString.mm",
"objc/helpers/RTCDispatcher+Private.h",
"objc/helpers/RTCDispatcher.h",
"objc/helpers/RTCDispatcher.m",
@@ -648,8 +648,8 @@
]
if (is_ios) {
sources += [
- "objc/components/video_codec/UIDevice+H264Profile.h",
- "objc/components/video_codec/UIDevice+H264Profile.mm",
+ "objc/components/video_codec/UIDevice+RTCH264Profile.h",
+ "objc/components/video_codec/UIDevice+RTCH264Profile.mm",
]
}
diff --git a/sdk/objc/Framework/Classes/Common/NSString+StdString.h b/sdk/objc/Framework/Classes/Common/NSString+StdString.h
deleted file mode 100644
index 3ec1b61..0000000
--- a/sdk/objc/Framework/Classes/Common/NSString+StdString.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Copyright 2015 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#import "helpers/NSString+StdString.h"
diff --git a/sdk/objc/api/logging/RTCCallbackLogger.mm b/sdk/objc/api/logging/RTCCallbackLogger.mm
index ba6fe1b..fe4b2ce 100644
--- a/sdk/objc/api/logging/RTCCallbackLogger.mm
+++ b/sdk/objc/api/logging/RTCCallbackLogger.mm
@@ -10,7 +10,7 @@
#import "RTCCallbackLogger.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include <memory>
@@ -32,7 +32,7 @@
void OnLogMessage(absl::string_view message) override {
if (callback_handler_) {
- callback_handler_([NSString stringForAbslStringView:message]);
+ callback_handler_([NSString rtc_stringForAbslStringView:message]);
}
}
@@ -54,7 +54,7 @@
void OnLogMessage(absl::string_view message, rtc::LoggingSeverity severity) override {
if (callback_handler_) {
RTCLoggingSeverity loggingSeverity = NativeSeverityToObjcSeverity(severity);
- callback_handler_([NSString stringForAbslStringView:message], loggingSeverity);
+ callback_handler_([NSString rtc_stringForAbslStringView:message], loggingSeverity);
}
}
diff --git a/sdk/objc/api/peerconnection/RTCAudioTrack.mm b/sdk/objc/api/peerconnection/RTCAudioTrack.mm
index 5c1736f..679d18b 100644
--- a/sdk/objc/api/peerconnection/RTCAudioTrack.mm
+++ b/sdk/objc/api/peerconnection/RTCAudioTrack.mm
@@ -13,7 +13,7 @@
#import "RTCAudioSource+Private.h"
#import "RTCMediaStreamTrack+Private.h"
#import "RTCPeerConnectionFactory+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include "rtc_base/checks.h"
@@ -28,7 +28,7 @@
RTC_DCHECK(source);
RTC_DCHECK(trackId.length);
- std::string nativeId = [NSString stdStringForString:trackId];
+ std::string nativeId = [NSString rtc_stdStringForString:trackId];
rtc::scoped_refptr<webrtc::AudioTrackInterface> track =
factory.nativeFactory->CreateAudioTrack(nativeId, source.nativeAudioSource.get());
if (self = [self initWithFactory:factory nativeTrack:track type:RTCMediaStreamTrackTypeAudio]) {
diff --git a/sdk/objc/api/peerconnection/RTCDataChannel.mm b/sdk/objc/api/peerconnection/RTCDataChannel.mm
index 4a79cef..4d1bc33 100644
--- a/sdk/objc/api/peerconnection/RTCDataChannel.mm
+++ b/sdk/objc/api/peerconnection/RTCDataChannel.mm
@@ -10,7 +10,7 @@
#import "RTCDataChannel+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include <memory>
@@ -98,7 +98,7 @@
}
- (NSString *)label {
- return [NSString stringForStdString:_nativeDataChannel->label()];
+ return [NSString rtc_stringForStdString:_nativeDataChannel->label()];
}
- (BOOL)isReliable {
@@ -122,7 +122,7 @@
}
- (NSString *)protocol {
- return [NSString stringForStdString:_nativeDataChannel->protocol()];
+ return [NSString rtc_stringForStdString:_nativeDataChannel->protocol()];
}
- (BOOL)isNegotiated {
diff --git a/sdk/objc/api/peerconnection/RTCDataChannelConfiguration.mm b/sdk/objc/api/peerconnection/RTCDataChannelConfiguration.mm
index bf775b1..6c6e3be 100644
--- a/sdk/objc/api/peerconnection/RTCDataChannelConfiguration.mm
+++ b/sdk/objc/api/peerconnection/RTCDataChannelConfiguration.mm
@@ -10,7 +10,7 @@
#import "RTCDataChannelConfiguration+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCDataChannelConfiguration)
@@ -53,11 +53,11 @@
}
- (NSString *)protocol {
- return [NSString stringForStdString:_nativeDataChannelInit.protocol];
+ return [NSString rtc_stringForStdString:_nativeDataChannelInit.protocol];
}
- (void)setProtocol:(NSString *)protocol {
- _nativeDataChannelInit.protocol = [NSString stdStringForString:protocol];
+ _nativeDataChannelInit.protocol = [NSString rtc_stdStringForString:protocol];
}
- (BOOL)isNegotiated {
diff --git a/sdk/objc/api/peerconnection/RTCDtmfSender.mm b/sdk/objc/api/peerconnection/RTCDtmfSender.mm
index ee3b79c..5349ea5 100644
--- a/sdk/objc/api/peerconnection/RTCDtmfSender.mm
+++ b/sdk/objc/api/peerconnection/RTCDtmfSender.mm
@@ -11,7 +11,7 @@
#import "RTCDtmfSender+Private.h"
#import "base/RTCLogging.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include "rtc_base/time_utils.h"
@@ -31,11 +31,11 @@
int durationMs = static_cast<int>(duration * rtc::kNumMillisecsPerSec);
int interToneGapMs = static_cast<int>(interToneGap * rtc::kNumMillisecsPerSec);
return _nativeDtmfSender->InsertDtmf(
- [NSString stdStringForString:tones], durationMs, interToneGapMs);
+ [NSString rtc_stdStringForString:tones], durationMs, interToneGapMs);
}
- (nonnull NSString *)remainingTones {
- return [NSString stringForStdString:_nativeDtmfSender->tones()];
+ return [NSString rtc_stringForStdString:_nativeDtmfSender->tones()];
}
- (NSTimeInterval)duration {
diff --git a/sdk/objc/api/peerconnection/RTCIceCandidate.mm b/sdk/objc/api/peerconnection/RTCIceCandidate.mm
index 48385ef..ece7c8b 100644
--- a/sdk/objc/api/peerconnection/RTCIceCandidate.mm
+++ b/sdk/objc/api/peerconnection/RTCIceCandidate.mm
@@ -13,7 +13,7 @@
#include <memory>
#import "base/RTCLogging.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCIceCandidate)
@@ -51,10 +51,10 @@
candidate->ToString(&sdp);
RTC_OBJC_TYPE(RTCIceCandidate) *rtcCandidate =
- [self initWithSdp:[NSString stringForStdString:sdp]
+ [self initWithSdp:[NSString rtc_stringForStdString:sdp]
sdpMLineIndex:candidate->sdp_mline_index()
- sdpMid:[NSString stringForStdString:candidate->sdp_mid()]];
- rtcCandidate->_serverUrl = [NSString stringForStdString:candidate->server_url()];
+ sdpMid:[NSString rtc_stringForStdString:candidate->sdp_mid()]];
+ rtcCandidate->_serverUrl = [NSString rtc_stringForStdString:candidate->server_url()];
return rtcCandidate;
}
diff --git a/sdk/objc/api/peerconnection/RTCIceCandidateErrorEvent.mm b/sdk/objc/api/peerconnection/RTCIceCandidateErrorEvent.mm
index 573e306..bbf6881 100644
--- a/sdk/objc/api/peerconnection/RTCIceCandidateErrorEvent.mm
+++ b/sdk/objc/api/peerconnection/RTCIceCandidateErrorEvent.mm
@@ -10,7 +10,7 @@
#import "RTCIceCandidateErrorEvent+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCIceCandidateErrorEvent)
@@ -30,11 +30,11 @@
errorCode:(const int)errorCode
errorText:(const std::string&)errorText {
if (self = [self init]) {
- _address = [NSString stringForStdString:address];
+ _address = [NSString rtc_stringForStdString:address];
_port = port;
- _url = [NSString stringForStdString:url];
+ _url = [NSString rtc_stringForStdString:url];
_errorCode = errorCode;
- _errorText = [NSString stringForStdString:errorText];
+ _errorText = [NSString rtc_stringForStdString:errorText];
}
return self;
}
diff --git a/sdk/objc/api/peerconnection/RTCIceServer.mm b/sdk/objc/api/peerconnection/RTCIceServer.mm
index 19a0a7e..14aea46 100644
--- a/sdk/objc/api/peerconnection/RTCIceServer.mm
+++ b/sdk/objc/api/peerconnection/RTCIceServer.mm
@@ -10,7 +10,7 @@
#import "RTCIceServer+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCIceServer)
@@ -121,9 +121,9 @@
- (webrtc::PeerConnectionInterface::IceServer)nativeServer {
__block webrtc::PeerConnectionInterface::IceServer iceServer;
- iceServer.username = [NSString stdStringForString:_username];
- iceServer.password = [NSString stdStringForString:_credential];
- iceServer.hostname = [NSString stdStringForString:_hostname];
+ iceServer.username = [NSString rtc_stdStringForString:_username];
+ iceServer.password = [NSString rtc_stdStringForString:_credential];
+ iceServer.hostname = [NSString rtc_stdStringForString:_hostname];
[_tlsAlpnProtocols enumerateObjectsUsingBlock:^(NSString *proto, NSUInteger idx, BOOL *stop) {
iceServer.tls_alpn_protocols.push_back(proto.stdString);
@@ -157,20 +157,20 @@
NSMutableArray *urls =
[NSMutableArray arrayWithCapacity:nativeServer.urls.size()];
for (auto const &url : nativeServer.urls) {
- [urls addObject:[NSString stringForStdString:url]];
+ [urls addObject:[NSString rtc_stringForStdString:url]];
}
- NSString *username = [NSString stringForStdString:nativeServer.username];
- NSString *credential = [NSString stringForStdString:nativeServer.password];
- NSString *hostname = [NSString stringForStdString:nativeServer.hostname];
+ NSString *username = [NSString rtc_stringForStdString:nativeServer.username];
+ NSString *credential = [NSString rtc_stringForStdString:nativeServer.password];
+ NSString *hostname = [NSString rtc_stringForStdString:nativeServer.hostname];
NSMutableArray *tlsAlpnProtocols =
[NSMutableArray arrayWithCapacity:nativeServer.tls_alpn_protocols.size()];
for (auto const &proto : nativeServer.tls_alpn_protocols) {
- [tlsAlpnProtocols addObject:[NSString stringForStdString:proto]];
+ [tlsAlpnProtocols addObject:[NSString rtc_stringForStdString:proto]];
}
NSMutableArray *tlsEllipticCurves =
[NSMutableArray arrayWithCapacity:nativeServer.tls_elliptic_curves.size()];
for (auto const &curve : nativeServer.tls_elliptic_curves) {
- [tlsEllipticCurves addObject:[NSString stringForStdString:curve]];
+ [tlsEllipticCurves addObject:[NSString rtc_stringForStdString:curve]];
}
RTCTlsCertPolicy tlsCertPolicy;
diff --git a/sdk/objc/api/peerconnection/RTCLegacyStatsReport.mm b/sdk/objc/api/peerconnection/RTCLegacyStatsReport.mm
index bd7a1ad..24cad10 100644
--- a/sdk/objc/api/peerconnection/RTCLegacyStatsReport.mm
+++ b/sdk/objc/api/peerconnection/RTCLegacyStatsReport.mm
@@ -11,7 +11,7 @@
#import "RTCLegacyStatsReport+Private.h"
#import "base/RTCLogging.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include "rtc_base/checks.h"
@@ -35,18 +35,15 @@
- (instancetype)initWithNativeReport:(const webrtc::StatsReport &)nativeReport {
if (self = [super init]) {
_timestamp = nativeReport.timestamp();
- _type = [NSString stringForStdString:nativeReport.TypeToString()];
- _reportId = [NSString stringForStdString:
- nativeReport.id()->ToString()];
+ _type = [NSString rtc_stringForStdString:nativeReport.TypeToString()];
+ _reportId = [NSString rtc_stringForStdString:nativeReport.id()->ToString()];
NSUInteger capacity = nativeReport.values().size();
NSMutableDictionary *values =
[NSMutableDictionary dictionaryWithCapacity:capacity];
for (auto const &valuePair : nativeReport.values()) {
- NSString *key = [NSString stringForStdString:
- valuePair.second->display_name()];
- NSString *value = [NSString stringForStdString:
- valuePair.second->ToString()];
+ NSString *key = [NSString rtc_stringForStdString:valuePair.second->display_name()];
+ NSString *value = [NSString rtc_stringForStdString:valuePair.second->ToString()];
// Not expecting duplicate keys.
RTC_DCHECK(![values objectForKey:key]);
diff --git a/sdk/objc/api/peerconnection/RTCMediaConstraints.mm b/sdk/objc/api/peerconnection/RTCMediaConstraints.mm
index 0f46e4b..b0e0401 100644
--- a/sdk/objc/api/peerconnection/RTCMediaConstraints.mm
+++ b/sdk/objc/api/peerconnection/RTCMediaConstraints.mm
@@ -10,7 +10,7 @@
#import "RTCMediaConstraints+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include <memory>
diff --git a/sdk/objc/api/peerconnection/RTCMediaStream.mm b/sdk/objc/api/peerconnection/RTCMediaStream.mm
index a6292b5..bd20701 100644
--- a/sdk/objc/api/peerconnection/RTCMediaStream.mm
+++ b/sdk/objc/api/peerconnection/RTCMediaStream.mm
@@ -16,7 +16,7 @@
#import "RTCMediaStreamTrack+Private.h"
#import "RTCPeerConnectionFactory+Private.h"
#import "RTCVideoTrack+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCMediaStream) {
RTC_OBJC_TYPE(RTCPeerConnectionFactory) * _factory;
@@ -29,7 +29,7 @@
streamId:(NSString *)streamId {
NSParameterAssert(factory);
NSParameterAssert(streamId.length);
- std::string nativeId = [NSString stdStringForString:streamId];
+ std::string nativeId = [NSString rtc_stdStringForString:streamId];
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
factory.nativeFactory->CreateLocalMediaStream(nativeId);
return [self initWithFactory:factory nativeMediaStream:stream];
@@ -44,7 +44,7 @@
}
- (NSString *)streamId {
- return [NSString stringForStdString:_nativeMediaStream->id()];
+ return [NSString rtc_stringForStdString:_nativeMediaStream->id()];
}
- (void)addAudioTrack:(RTC_OBJC_TYPE(RTCAudioTrack) *)audioTrack {
diff --git a/sdk/objc/api/peerconnection/RTCMediaStreamTrack.mm b/sdk/objc/api/peerconnection/RTCMediaStreamTrack.mm
index f1e128c..19ba3b5 100644
--- a/sdk/objc/api/peerconnection/RTCMediaStreamTrack.mm
+++ b/sdk/objc/api/peerconnection/RTCMediaStreamTrack.mm
@@ -12,7 +12,7 @@
#import "RTCMediaStreamTrack+Private.h"
#import "RTCVideoTrack+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
NSString * const kRTCMediaStreamTrackKindAudio =
@(webrtc::MediaStreamTrackInterface::kAudioKind);
@@ -26,11 +26,11 @@
}
- (NSString *)kind {
- return [NSString stringForStdString:_nativeTrack->kind()];
+ return [NSString rtc_stringForStdString:_nativeTrack->kind()];
}
- (NSString *)trackId {
- return [NSString stringForStdString:_nativeTrack->id()];
+ return [NSString rtc_stringForStdString:_nativeTrack->id()];
}
- (BOOL)isEnabled {
diff --git a/sdk/objc/api/peerconnection/RTCMetricsSampleInfo.mm b/sdk/objc/api/peerconnection/RTCMetricsSampleInfo.mm
index e4be94e..5b8335e 100644
--- a/sdk/objc/api/peerconnection/RTCMetricsSampleInfo.mm
+++ b/sdk/objc/api/peerconnection/RTCMetricsSampleInfo.mm
@@ -10,7 +10,7 @@
#import "RTCMetricsSampleInfo+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCMetricsSampleInfo)
@@ -25,7 +25,7 @@
- (instancetype)initWithNativeSampleInfo:
(const webrtc::metrics::SampleInfo &)info {
if (self = [super init]) {
- _name = [NSString stringForStdString:info.name];
+ _name = [NSString rtc_stringForStdString:info.name];
_min = info.min;
_max = info.max;
_bucketCount = info.bucket_count;
diff --git a/sdk/objc/api/peerconnection/RTCPeerConnection+DataChannel.mm b/sdk/objc/api/peerconnection/RTCPeerConnection+DataChannel.mm
index cb75f06..d493383 100644
--- a/sdk/objc/api/peerconnection/RTCPeerConnection+DataChannel.mm
+++ b/sdk/objc/api/peerconnection/RTCPeerConnection+DataChannel.mm
@@ -12,7 +12,7 @@
#import "RTCDataChannel+Private.h"
#import "RTCDataChannelConfiguration+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCPeerConnection)
(DataChannel)
@@ -20,7 +20,7 @@
- (nullable RTC_OBJC_TYPE(RTCDataChannel) *)dataChannelForLabel
: (NSString *)label configuration
: (RTC_OBJC_TYPE(RTCDataChannelConfiguration) *)configuration {
- std::string labelString = [NSString stdStringForString:label];
+ std::string labelString = [NSString rtc_stdStringForString:label];
const webrtc::DataChannelInit nativeInit =
configuration.nativeDataChannelInit;
auto result = self.nativePeerConnection->CreateDataChannelOrError(labelString, &nativeInit);
diff --git a/sdk/objc/api/peerconnection/RTCPeerConnection+Stats.mm b/sdk/objc/api/peerconnection/RTCPeerConnection+Stats.mm
index f8d3814..0273b04 100644
--- a/sdk/objc/api/peerconnection/RTCPeerConnection+Stats.mm
+++ b/sdk/objc/api/peerconnection/RTCPeerConnection+Stats.mm
@@ -15,7 +15,7 @@
#import "RTCRtpReceiver+Private.h"
#import "RTCRtpSender+Private.h"
#import "RTCStatisticsReport+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include "rtc_base/checks.h"
diff --git a/sdk/objc/api/peerconnection/RTCPeerConnection.mm b/sdk/objc/api/peerconnection/RTCPeerConnection.mm
index f4db472..26a39ac 100644
--- a/sdk/objc/api/peerconnection/RTCPeerConnection.mm
+++ b/sdk/objc/api/peerconnection/RTCPeerConnection.mm
@@ -24,7 +24,7 @@
#import "RTCRtpTransceiver+Private.h"
#import "RTCSessionDescription+Private.h"
#import "base/RTCLogging.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include <memory>
@@ -63,7 +63,7 @@
completion_handler_(nil);
} else {
// TODO(hta): Add handling of error.type()
- NSString *str = [NSString stringForStdString:error.message()];
+ NSString *str = [NSString rtc_stringForStdString:error.message()];
NSError *err = [NSError errorWithDomain:kRTCPeerConnectionErrorDomain
code:kRTCPeerConnnectionSessionDescriptionError
userInfo:@{NSLocalizedDescriptionKey : str}];
@@ -101,7 +101,7 @@
void OnFailure(RTCError error) override {
RTC_DCHECK(completion_handler_);
// TODO(hta): Add handling of error.type()
- NSString *str = [NSString stringForStdString:error.message()];
+ NSString *str = [NSString rtc_stringForStdString:error.message()];
NSError* err =
[NSError errorWithDomain:kRTCPeerConnectionErrorDomain
code:kRTCPeerConnnectionSessionDescriptionError
@@ -274,7 +274,7 @@
RTC_OBJC_TYPE(RTCIceCandidate) *remote_candidate = [[RTC_OBJC_TYPE(RTCIceCandidate) alloc]
initWithNativeCandidate:remote_candidate_wrapper.release()];
RTC_OBJC_TYPE(RTCPeerConnection) *peer_connection = peer_connection_;
- NSString *nsstr_reason = [NSString stringForStdString:event.reason];
+ NSString *nsstr_reason = [NSString rtc_stringForStdString:event.reason];
if ([peer_connection.delegate
respondsToSelector:@selector
(peerConnection:didChangeLocalCandidate:remoteCandidate:lastReceivedMs:changeReason:)]) {
@@ -467,7 +467,7 @@
if (error.ok()) {
completionHandler(nil);
} else {
- NSString *str = [NSString stringForStdString:error.message()];
+ NSString *str = [NSString rtc_stringForStdString:error.message()];
NSError *err = [NSError errorWithDomain:kRTCPeerConnectionErrorDomain
code:static_cast<NSInteger>(error.type())
userInfo:@{NSLocalizedDescriptionKey : str}];
@@ -666,8 +666,8 @@
}
- (RTC_OBJC_TYPE(RTCRtpSender) *)senderWithKind:(NSString *)kind streamId:(NSString *)streamId {
- std::string nativeKind = [NSString stdStringForString:kind];
- std::string nativeStreamId = [NSString stdStringForString:streamId];
+ std::string nativeKind = [NSString rtc_stdStringForString:kind];
+ std::string nativeStreamId = [NSString rtc_stdStringForString:streamId];
rtc::scoped_refptr<webrtc::RtpSenderInterface> nativeSender(
_peerConnection->CreateSender(nativeKind, nativeStreamId));
return nativeSender ? [[RTC_OBJC_TYPE(RTCRtpSender) alloc] initWithFactory:self.factory
diff --git a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm
index 4e5aa19..f976639 100644
--- a/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm
+++ b/sdk/objc/api/peerconnection/RTCPeerConnectionFactory.mm
@@ -24,7 +24,7 @@
#import "base/RTCLogging.h"
#import "base/RTCVideoDecoderFactory.h"
#import "base/RTCVideoEncoderFactory.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include "rtc_base/checks.h"
#include "sdk/objc/native/api/network_monitor_factory.h"
#include "sdk/objc/native/api/ssl_certificate_verifier.h"
diff --git a/sdk/objc/api/peerconnection/RTCRtcpParameters.mm b/sdk/objc/api/peerconnection/RTCRtcpParameters.mm
index e92ee4b..c610e1d 100644
--- a/sdk/objc/api/peerconnection/RTCRtcpParameters.mm
+++ b/sdk/objc/api/peerconnection/RTCRtcpParameters.mm
@@ -10,7 +10,7 @@
#import "RTCRtcpParameters+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCRtcpParameters)
@@ -24,7 +24,7 @@
- (instancetype)initWithNativeParameters:(const webrtc::RtcpParameters &)nativeParameters {
if (self = [super init]) {
- _cname = [NSString stringForStdString:nativeParameters.cname];
+ _cname = [NSString rtc_stringForStdString:nativeParameters.cname];
_isReducedSize = nativeParameters.reduced_size;
}
return self;
@@ -32,7 +32,7 @@
- (webrtc::RtcpParameters)nativeParameters {
webrtc::RtcpParameters parameters;
- parameters.cname = [NSString stdStringForString:_cname];
+ parameters.cname = [NSString rtc_stdStringForString:_cname];
parameters.reduced_size = _isReducedSize;
return parameters;
}
diff --git a/sdk/objc/api/peerconnection/RTCRtpCodecParameters.mm b/sdk/objc/api/peerconnection/RTCRtpCodecParameters.mm
index 753667b..c00053c 100644
--- a/sdk/objc/api/peerconnection/RTCRtpCodecParameters.mm
+++ b/sdk/objc/api/peerconnection/RTCRtpCodecParameters.mm
@@ -11,7 +11,7 @@
#import "RTCRtpCodecParameters+Private.h"
#import "RTCMediaStreamTrack.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include "media/base/media_constants.h"
#include "rtc_base/checks.h"
@@ -52,7 +52,7 @@
(const webrtc::RtpCodecParameters &)nativeParameters {
if (self = [super init]) {
_payloadType = nativeParameters.payload_type;
- _name = [NSString stringForStdString:nativeParameters.name];
+ _name = [NSString rtc_stringForStdString:nativeParameters.name];
switch (nativeParameters.kind) {
case cricket::MEDIA_TYPE_AUDIO:
_kind = kRTCMediaStreamTrackKindAudio;
@@ -75,8 +75,8 @@
}
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
for (const auto ¶meter : nativeParameters.parameters) {
- [parameters setObject:[NSString stringForStdString:parameter.second]
- forKey:[NSString stringForStdString:parameter.first]];
+ [parameters setObject:[NSString rtc_stringForStdString:parameter.second]
+ forKey:[NSString rtc_stringForStdString:parameter.first]];
}
_parameters = parameters;
}
@@ -86,7 +86,7 @@
- (webrtc::RtpCodecParameters)nativeParameters {
webrtc::RtpCodecParameters parameters;
parameters.payload_type = _payloadType;
- parameters.name = [NSString stdStringForString:_name];
+ parameters.name = [NSString rtc_stdStringForString:_name];
// NSString pointer comparison is safe here since "kind" is readonly and only
// populated above.
if (_kind == kRTCMediaStreamTrackKindAudio) {
@@ -103,8 +103,8 @@
parameters.num_channels = absl::optional<int>(_numChannels.intValue);
}
for (NSString *paramKey in _parameters.allKeys) {
- std::string key = [NSString stdStringForString:paramKey];
- std::string value = [NSString stdStringForString:_parameters[paramKey]];
+ std::string key = [NSString rtc_stdStringForString:paramKey];
+ std::string value = [NSString rtc_stdStringForString:_parameters[paramKey]];
parameters.parameters[key] = value;
}
return parameters;
diff --git a/sdk/objc/api/peerconnection/RTCRtpEncodingParameters.mm b/sdk/objc/api/peerconnection/RTCRtpEncodingParameters.mm
index d6087da..71845bc 100644
--- a/sdk/objc/api/peerconnection/RTCRtpEncodingParameters.mm
+++ b/sdk/objc/api/peerconnection/RTCRtpEncodingParameters.mm
@@ -10,7 +10,7 @@
#import "RTCRtpEncodingParameters+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCRtpEncodingParameters)
@@ -35,7 +35,7 @@
(const webrtc::RtpEncodingParameters &)nativeParameters {
if (self = [super init]) {
if (!nativeParameters.rid.empty()) {
- _rid = [NSString stringForStdString:nativeParameters.rid];
+ _rid = [NSString rtc_stringForStdString:nativeParameters.rid];
}
_isActive = nativeParameters.active;
if (nativeParameters.max_bitrate_bps) {
@@ -70,7 +70,7 @@
- (webrtc::RtpEncodingParameters)nativeParameters {
webrtc::RtpEncodingParameters parameters;
if (_rid != nil) {
- parameters.rid = [NSString stdStringForString:_rid];
+ parameters.rid = [NSString rtc_stdStringForString:_rid];
}
parameters.active = _isActive;
if (_maxBitrateBps != nil) {
diff --git a/sdk/objc/api/peerconnection/RTCRtpHeaderExtension.mm b/sdk/objc/api/peerconnection/RTCRtpHeaderExtension.mm
index 68093e9..d5e0731 100644
--- a/sdk/objc/api/peerconnection/RTCRtpHeaderExtension.mm
+++ b/sdk/objc/api/peerconnection/RTCRtpHeaderExtension.mm
@@ -10,7 +10,7 @@
#import "RTCRtpHeaderExtension+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCRtpHeaderExtension)
@@ -25,7 +25,7 @@
- (instancetype)initWithNativeParameters:(const webrtc::RtpExtension &)nativeParameters {
if (self = [super init]) {
- _uri = [NSString stringForStdString:nativeParameters.uri];
+ _uri = [NSString rtc_stringForStdString:nativeParameters.uri];
_id = nativeParameters.id;
_encrypted = nativeParameters.encrypt;
}
@@ -34,7 +34,7 @@
- (webrtc::RtpExtension)nativeParameters {
webrtc::RtpExtension extension;
- extension.uri = [NSString stdStringForString:_uri];
+ extension.uri = [NSString rtc_stdStringForString:_uri];
extension.id = _id;
extension.encrypt = _encrypted;
return extension;
diff --git a/sdk/objc/api/peerconnection/RTCRtpParameters.mm b/sdk/objc/api/peerconnection/RTCRtpParameters.mm
index 2baf0ec..11b6cd8 100644
--- a/sdk/objc/api/peerconnection/RTCRtpParameters.mm
+++ b/sdk/objc/api/peerconnection/RTCRtpParameters.mm
@@ -14,7 +14,7 @@
#import "RTCRtpCodecParameters+Private.h"
#import "RTCRtpEncodingParameters+Private.h"
#import "RTCRtpHeaderExtension+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCRtpParameters)
@@ -33,7 +33,7 @@
- (instancetype)initWithNativeParameters:
(const webrtc::RtpParameters &)nativeParameters {
if (self = [super init]) {
- _transactionId = [NSString stringForStdString:nativeParameters.transaction_id];
+ _transactionId = [NSString rtc_stringForStdString:nativeParameters.transaction_id];
_rtcp =
[[RTC_OBJC_TYPE(RTCRtcpParameters) alloc] initWithNativeParameters:nativeParameters.rtcp];
@@ -67,7 +67,7 @@
- (webrtc::RtpParameters)nativeParameters {
webrtc::RtpParameters parameters;
- parameters.transaction_id = [NSString stdStringForString:_transactionId];
+ parameters.transaction_id = [NSString rtc_stdStringForString:_transactionId];
parameters.rtcp = [_rtcp nativeParameters];
for (RTC_OBJC_TYPE(RTCRtpHeaderExtension) * headerExtension in _headerExtensions) {
parameters.header_extensions.push_back(headerExtension.nativeParameters);
diff --git a/sdk/objc/api/peerconnection/RTCRtpReceiver.mm b/sdk/objc/api/peerconnection/RTCRtpReceiver.mm
index 60af86a..9bbfa22 100644
--- a/sdk/objc/api/peerconnection/RTCRtpReceiver.mm
+++ b/sdk/objc/api/peerconnection/RTCRtpReceiver.mm
@@ -14,7 +14,7 @@
#import "RTCRtpParameters+Private.h"
#import "RTCRtpReceiver+Native.h"
#import "base/RTCLogging.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include "api/media_stream_interface.h"
@@ -44,7 +44,7 @@
@synthesize delegate = _delegate;
- (NSString *)receiverId {
- return [NSString stringForStdString:_nativeRtpReceiver->id()];
+ return [NSString rtc_stringForStdString:_nativeRtpReceiver->id()];
}
- (RTC_OBJC_TYPE(RTCRtpParameters) *)parameters {
diff --git a/sdk/objc/api/peerconnection/RTCRtpSender.mm b/sdk/objc/api/peerconnection/RTCRtpSender.mm
index 4fadb30..b35a138 100644
--- a/sdk/objc/api/peerconnection/RTCRtpSender.mm
+++ b/sdk/objc/api/peerconnection/RTCRtpSender.mm
@@ -15,7 +15,7 @@
#import "RTCRtpParameters+Private.h"
#import "RTCRtpSender+Native.h"
#import "base/RTCLogging.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include "api/media_stream_interface.h"
@@ -27,7 +27,7 @@
@synthesize dtmfSender = _dtmfSender;
- (NSString *)senderId {
- return [NSString stringForStdString:_nativeRtpSender->id()];
+ return [NSString rtc_stringForStdString:_nativeRtpSender->id()];
}
- (RTC_OBJC_TYPE(RTCRtpParameters) *)parameters {
@@ -61,7 +61,7 @@
std::vector<std::string> nativeStreamIds = _nativeRtpSender->stream_ids();
NSMutableArray *streamIds = [NSMutableArray arrayWithCapacity:nativeStreamIds.size()];
for (const auto &s : nativeStreamIds) {
- [streamIds addObject:[NSString stringForStdString:s]];
+ [streamIds addObject:[NSString rtc_stringForStdString:s]];
}
return streamIds;
}
diff --git a/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm b/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm
index ae1cf79..fec6fc6 100644
--- a/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm
+++ b/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm
@@ -15,7 +15,7 @@
#import "RTCRtpReceiver+Private.h"
#import "RTCRtpSender+Private.h"
#import "base/RTCLogging.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
NSString *const kRTCRtpTransceiverErrorDomain = @"org.webrtc.RTCRtpTranceiver";
@@ -59,7 +59,7 @@
- (NSString *)mid {
if (_nativeRtpTransceiver->mid()) {
- return [NSString stringForStdString:*_nativeRtpTransceiver->mid()];
+ return [NSString rtc_stringForStdString:*_nativeRtpTransceiver->mid()];
} else {
return nil;
}
diff --git a/sdk/objc/api/peerconnection/RTCSessionDescription.mm b/sdk/objc/api/peerconnection/RTCSessionDescription.mm
index 539c90b..d4a8326 100644
--- a/sdk/objc/api/peerconnection/RTCSessionDescription.mm
+++ b/sdk/objc/api/peerconnection/RTCSessionDescription.mm
@@ -11,7 +11,7 @@
#import "RTCSessionDescription+Private.h"
#import "base/RTCLogging.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#include "rtc_base/checks.h"
@@ -22,7 +22,7 @@
+ (NSString *)stringForType:(RTCSdpType)type {
std::string string = [[self class] stdStringForType:type];
- return [NSString stringForStdString:string];
+ return [NSString rtc_stringForStdString:string];
}
+ (RTCSdpType)typeForString:(NSString *)string {
@@ -68,8 +68,7 @@
nativeDescription->ToString(&sdp);
RTCSdpType type = [[self class] typeForStdString:nativeDescription->type()];
- return [self initWithType:type
- sdp:[NSString stringForStdString:sdp]];
+ return [self initWithType:type sdp:[NSString rtc_stringForStdString:sdp]];
}
+ (std::string)stdStringForType:(RTCSdpType)type {
diff --git a/sdk/objc/api/peerconnection/RTCStatisticsReport.mm b/sdk/objc/api/peerconnection/RTCStatisticsReport.mm
index 28ef326..573a265 100644
--- a/sdk/objc/api/peerconnection/RTCStatisticsReport.mm
+++ b/sdk/objc/api/peerconnection/RTCStatisticsReport.mm
@@ -10,7 +10,7 @@
#import "RTCStatisticsReport+Private.h"
-#include "helpers/NSString+StdString.h"
+#include "helpers/NSString+RTCStdString.h"
#include "rtc_base/checks.h"
namespace webrtc {
@@ -33,7 +33,7 @@
case RTCStatsMemberInterface::kDouble:
return [NSNumber numberWithDouble:*member->cast_to<RTCStatsMember<double>>()];
case RTCStatsMemberInterface::kString:
- return [NSString stringForStdString:*member->cast_to<RTCStatsMember<std::string>>()];
+ return [NSString rtc_stringForStdString:*member->cast_to<RTCStatsMember<std::string>>()];
case RTCStatsMemberInterface::kSequenceBool: {
std::vector<bool> sequence = *member->cast_to<RTCStatsMember<std::vector<bool>>>();
NSMutableArray *array = [NSMutableArray arrayWithCapacity:sequence.size()];
@@ -87,7 +87,7 @@
*member->cast_to<RTCStatsMember<std::vector<std::string>>>();
NSMutableArray<NSString *> *array = [NSMutableArray arrayWithCapacity:sequence.size()];
for (const auto &item : sequence) {
- [array addObject:[NSString stringForStdString:item]];
+ [array addObject:[NSString rtc_stringForStdString:item]];
}
return [array copy];
}
@@ -97,7 +97,7 @@
NSMutableDictionary<NSString *, NSNumber *> *dictionary =
[NSMutableDictionary dictionaryWithCapacity:map.size()];
for (const auto &item : map) {
- dictionary[[NSString stringForStdString:item.first]] = @(item.second);
+ dictionary[[NSString rtc_stringForStdString:item.first]] = @(item.second);
}
return [dictionary copy];
}
@@ -107,7 +107,7 @@
NSMutableDictionary<NSString *, NSNumber *> *dictionary =
[NSMutableDictionary dictionaryWithCapacity:map.size()];
for (const auto &item : map) {
- dictionary[[NSString stringForStdString:item.first]] = @(item.second);
+ dictionary[[NSString rtc_stringForStdString:item.first]] = @(item.second);
}
return [dictionary copy];
}
@@ -129,7 +129,7 @@
- (instancetype)initWithStatistics:(const webrtc::RTCStats &)statistics {
if (self = [super init]) {
- _id = [NSString stringForStdString:statistics.id()];
+ _id = [NSString rtc_stringForStdString:statistics.id()];
_timestamp_us = statistics.timestamp_us();
_type = [NSString stringWithCString:statistics.type() encoding:NSUTF8StringEncoding];
diff --git a/sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.mm b/sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.mm
index 2eb8d36..b13ae97 100644
--- a/sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.mm
+++ b/sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.mm
@@ -10,7 +10,7 @@
#import "RTCVideoCodecInfo+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCVideoCodecInfo)
(Private)
@@ -18,21 +18,21 @@
- (instancetype)initWithNativeSdpVideoFormat : (webrtc::SdpVideoFormat)format {
NSMutableDictionary *params = [NSMutableDictionary dictionary];
for (auto it = format.parameters.begin(); it != format.parameters.end(); ++it) {
- [params setObject:[NSString stringForStdString:it->second]
- forKey:[NSString stringForStdString:it->first]];
+ [params setObject:[NSString rtc_stringForStdString:it->second]
+ forKey:[NSString rtc_stringForStdString:it->first]];
}
- return [self initWithName:[NSString stringForStdString:format.name] parameters:params];
+ return [self initWithName:[NSString rtc_stringForStdString:format.name] parameters:params];
}
- (webrtc::SdpVideoFormat)nativeSdpVideoFormat {
std::map<std::string, std::string> parameters;
for (NSString *paramKey in self.parameters.allKeys) {
- std::string key = [NSString stdStringForString:paramKey];
- std::string value = [NSString stdStringForString:self.parameters[paramKey]];
+ std::string key = [NSString rtc_stdStringForString:paramKey];
+ std::string value = [NSString rtc_stdStringForString:self.parameters[paramKey]];
parameters[key] = value;
}
- return webrtc::SdpVideoFormat([NSString stdStringForString:self.name], parameters);
+ return webrtc::SdpVideoFormat([NSString rtc_stdStringForString:self.name], parameters);
}
@end
diff --git a/sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.mm b/sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.mm
index dec3a61..35d1557 100644
--- a/sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.mm
+++ b/sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.mm
@@ -10,7 +10,7 @@
#import "RTCVideoEncoderSettings+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCVideoEncoderSettings)
(Private)
diff --git a/sdk/objc/api/peerconnection/RTCVideoTrack.mm b/sdk/objc/api/peerconnection/RTCVideoTrack.mm
index 8944d26..63dd9e2 100644
--- a/sdk/objc/api/peerconnection/RTCVideoTrack.mm
+++ b/sdk/objc/api/peerconnection/RTCVideoTrack.mm
@@ -14,7 +14,7 @@
#import "RTCPeerConnectionFactory+Private.h"
#import "RTCVideoSource+Private.h"
#import "api/RTCVideoRendererAdapter+Private.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCVideoTrack) {
NSMutableArray *_adapters;
@@ -28,7 +28,7 @@
NSParameterAssert(factory);
NSParameterAssert(source);
NSParameterAssert(trackId.length);
- std::string nativeId = [NSString stdStringForString:trackId];
+ std::string nativeId = [NSString rtc_stdStringForString:trackId];
rtc::scoped_refptr<webrtc::VideoTrackInterface> track =
factory.nativeFactory->CreateVideoTrack(nativeId, source.nativeVideoSource.get());
if (self = [self initWithFactory:factory nativeTrack:track type:RTCMediaStreamTrackTypeVideo]) {
diff --git a/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm b/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm
index 261874d..fa2c079 100644
--- a/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm
+++ b/sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.mm
@@ -12,7 +12,7 @@
#import "RTCWrappedNativeVideoDecoder.h"
#import "base/RTCMacros.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCWrappedNativeVideoDecoder) {
std::unique_ptr<webrtc::VideoDecoder> _wrappedDecoder;
diff --git a/sdk/objc/api/video_codec/RTCWrappedNativeVideoEncoder.mm b/sdk/objc/api/video_codec/RTCWrappedNativeVideoEncoder.mm
index 4160572..48baaae 100644
--- a/sdk/objc/api/video_codec/RTCWrappedNativeVideoEncoder.mm
+++ b/sdk/objc/api/video_codec/RTCWrappedNativeVideoEncoder.mm
@@ -12,7 +12,7 @@
#import "RTCWrappedNativeVideoEncoder.h"
#import "base/RTCMacros.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@implementation RTC_OBJC_TYPE (RTCWrappedNativeVideoEncoder) {
std::unique_ptr<webrtc::VideoEncoder> _wrappedEncoder;
diff --git a/sdk/objc/components/capturer/RTCCameraVideoCapturer.m b/sdk/objc/components/capturer/RTCCameraVideoCapturer.m
index e0e9e41..fee1a80 100644
--- a/sdk/objc/components/capturer/RTCCameraVideoCapturer.m
+++ b/sdk/objc/components/capturer/RTCCameraVideoCapturer.m
@@ -19,7 +19,7 @@
#import "helpers/UIDevice+RTCDevice.h"
#endif
-#import "helpers/AVCaptureSession+DevicePosition.h"
+#import "helpers/AVCaptureSession+RTCDevicePosition.h"
#import "helpers/RTCDispatcher+Private.h"
#include "rtc_base/system/gcd_helpers.h"
@@ -256,7 +256,7 @@
// Check the image's EXIF for the camera the image came from as the image could have been
// delayed as we set alwaysDiscardsLateVideoFrames to NO.
AVCaptureDevicePosition cameraPosition =
- [AVCaptureSession devicePositionForSampleBuffer:sampleBuffer];
+ [AVCaptureSession rtc_devicePositionForSampleBuffer:sampleBuffer];
if (cameraPosition != AVCaptureDevicePositionUnspecified) {
usingFrontCamera = AVCaptureDevicePositionFront == cameraPosition;
} else {
diff --git a/sdk/objc/components/video_codec/RTCH264ProfileLevelId.mm b/sdk/objc/components/video_codec/RTCH264ProfileLevelId.mm
index f0ef3ec..d382da3 100644
--- a/sdk/objc/components/video_codec/RTCH264ProfileLevelId.mm
+++ b/sdk/objc/components/video_codec/RTCH264ProfileLevelId.mm
@@ -11,9 +11,9 @@
#import "RTCH264ProfileLevelId.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
#if defined(WEBRTC_IOS)
-#import "UIDevice+H264Profile.h"
+#import "UIDevice+RTCH264Profile.h"
#endif
#include "api/video_codecs/h264_profile_level_id.h"
@@ -40,12 +40,12 @@
NSString *MaxSupportedLevelForProfile(webrtc::H264Profile profile) {
const absl::optional<webrtc::H264ProfileLevelId> profileLevelId =
- [UIDevice maxSupportedH264Profile];
+ [UIDevice rtc_maxSupportedH264Profile];
if (profileLevelId && profileLevelId->profile >= profile) {
const absl::optional<std::string> profileString =
H264ProfileLevelIdToString(webrtc::H264ProfileLevelId(profile, profileLevelId->level));
if (profileString) {
- return [NSString stringForStdString:*profileString];
+ return [NSString rtc_stringForStdString:*profileString];
}
}
return nil;
diff --git a/sdk/objc/components/video_codec/UIDevice+H264Profile.h b/sdk/objc/components/video_codec/UIDevice+RTCH264Profile.h
similarity index 81%
rename from sdk/objc/components/video_codec/UIDevice+H264Profile.h
rename to sdk/objc/components/video_codec/UIDevice+RTCH264Profile.h
index a51debb..7498b9f 100644
--- a/sdk/objc/components/video_codec/UIDevice+H264Profile.h
+++ b/sdk/objc/components/video_codec/UIDevice+RTCH264Profile.h
@@ -12,8 +12,8 @@
#include "api/video_codecs/h264_profile_level_id.h"
-@interface UIDevice (H264Profile)
+@interface UIDevice (RTCH264Profile)
-+ (absl::optional<webrtc::H264ProfileLevelId>)maxSupportedH264Profile;
++ (absl::optional<webrtc::H264ProfileLevelId>)rtc_maxSupportedH264Profile;
@end
diff --git a/sdk/objc/components/video_codec/UIDevice+H264Profile.mm b/sdk/objc/components/video_codec/UIDevice+RTCH264Profile.mm
similarity index 98%
rename from sdk/objc/components/video_codec/UIDevice+H264Profile.mm
rename to sdk/objc/components/video_codec/UIDevice+RTCH264Profile.mm
index 0ef6a8d..e592111 100644
--- a/sdk/objc/components/video_codec/UIDevice+H264Profile.mm
+++ b/sdk/objc/components/video_codec/UIDevice+RTCH264Profile.mm
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#import "UIDevice+H264Profile.h"
+#import "UIDevice+RTCH264Profile.h"
#import "helpers/UIDevice+RTCDevice.h"
#include <algorithm>
@@ -196,9 +196,9 @@
} // namespace
-@implementation UIDevice (H264Profile)
+@implementation UIDevice (RTCH264Profile)
-+ (absl::optional<webrtc::H264ProfileLevelId>)maxSupportedH264Profile {
++ (absl::optional<webrtc::H264ProfileLevelId>)rtc_maxSupportedH264Profile {
return FindMaxSupportedProfileForDevice([self deviceType]);
}
diff --git a/sdk/objc/helpers/AVCaptureSession+DevicePosition.h b/sdk/objc/helpers/AVCaptureSession+RTCDevicePosition.h
similarity index 80%
rename from sdk/objc/helpers/AVCaptureSession+DevicePosition.h
rename to sdk/objc/helpers/AVCaptureSession+RTCDevicePosition.h
index 32ab687..45efce5 100644
--- a/sdk/objc/helpers/AVCaptureSession+DevicePosition.h
+++ b/sdk/objc/helpers/AVCaptureSession+RTCDevicePosition.h
@@ -13,10 +13,10 @@
NS_ASSUME_NONNULL_BEGIN
-@interface AVCaptureSession (DevicePosition)
+@interface AVCaptureSession (RTCDevicePosition)
// Check the image's EXIF for the camera the image came from.
-+ (AVCaptureDevicePosition)devicePositionForSampleBuffer:(CMSampleBufferRef)sampleBuffer;
++ (AVCaptureDevicePosition)rtc_devicePositionForSampleBuffer:(CMSampleBufferRef)sampleBuffer;
@end
diff --git a/sdk/objc/helpers/AVCaptureSession+DevicePosition.mm b/sdk/objc/helpers/AVCaptureSession+RTCDevicePosition.mm
similarity index 90%
rename from sdk/objc/helpers/AVCaptureSession+DevicePosition.mm
rename to sdk/objc/helpers/AVCaptureSession+RTCDevicePosition.mm
index 0814ecc..2bb6bfa 100644
--- a/sdk/objc/helpers/AVCaptureSession+DevicePosition.mm
+++ b/sdk/objc/helpers/AVCaptureSession+RTCDevicePosition.mm
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#import "AVCaptureSession+DevicePosition.h"
+#import "AVCaptureSession+RTCDevicePosition.h"
BOOL CFStringContainsString(CFStringRef theString, CFStringRef stringToFind) {
return CFStringFindWithOptions(theString,
@@ -18,9 +18,9 @@
nil);
}
-@implementation AVCaptureSession (DevicePosition)
+@implementation AVCaptureSession (RTCDevicePosition)
-+ (AVCaptureDevicePosition)devicePositionForSampleBuffer:(CMSampleBufferRef)sampleBuffer {
++ (AVCaptureDevicePosition)rtc_devicePositionForSampleBuffer:(CMSampleBufferRef)sampleBuffer {
// Check the image's EXIF for the camera the image came from.
AVCaptureDevicePosition cameraPosition = AVCaptureDevicePositionUnspecified;
CFDictionaryRef attachments = CMCopyDictionaryOfAttachments(
diff --git a/sdk/objc/helpers/NSString+StdString.h b/sdk/objc/helpers/NSString+RTCStdString.h
similarity index 68%
rename from sdk/objc/helpers/NSString+StdString.h
rename to sdk/objc/helpers/NSString+RTCStdString.h
index b0324e8..20e9589 100644
--- a/sdk/objc/helpers/NSString+StdString.h
+++ b/sdk/objc/helpers/NSString+RTCStdString.h
@@ -16,18 +16,18 @@
NS_ASSUME_NONNULL_BEGIN
-@interface NSString (StdString)
+@interface NSString (RTCStdString)
@property(nonatomic, readonly) std::string stdString;
-+ (std::string)stdStringForString:(NSString *)nsString;
-+ (NSString *)stringForStdString:(const std::string &)stdString;
++ (std::string)rtc_stdStringForString:(NSString *)nsString;
++ (NSString *)rtc_stringForStdString:(const std::string &)stdString;
@end
-@interface NSString (AbslStringView)
+@interface NSString (RTCAbslStringView)
-+ (NSString *)stringForAbslStringView:(const absl::string_view)abslStringView;
++ (NSString *)rtc_stringForAbslStringView:(const absl::string_view)abslStringView;
@end
diff --git a/sdk/objc/helpers/NSString+StdString.mm b/sdk/objc/helpers/NSString+RTCStdString.mm
similarity index 73%
rename from sdk/objc/helpers/NSString+StdString.mm
rename to sdk/objc/helpers/NSString+RTCStdString.mm
index c98432c..7775fdc 100644
--- a/sdk/objc/helpers/NSString+StdString.mm
+++ b/sdk/objc/helpers/NSString+RTCStdString.mm
@@ -8,23 +8,22 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#import "NSString+StdString.h"
+#import "NSString+RTCStdString.h"
#include "absl/strings/string_view.h"
-@implementation NSString (StdString)
+@implementation NSString (RTCStdString)
- (std::string)stdString {
- return [NSString stdStringForString:self];
+ return [NSString rtc_stdStringForString:self];
}
-+ (std::string)stdStringForString:(NSString *)nsString {
++ (std::string)rtc_stdStringForString:(NSString *)nsString {
NSData *charData = [nsString dataUsingEncoding:NSUTF8StringEncoding];
- return std::string(reinterpret_cast<const char *>(charData.bytes),
- charData.length);
+ return std::string(reinterpret_cast<const char *>(charData.bytes), charData.length);
}
-+ (NSString *)stringForStdString:(const std::string&)stdString {
++ (NSString *)rtc_stringForStdString:(const std::string &)stdString {
// std::string may contain null termination character so we construct
// using length.
return [[NSString alloc] initWithBytes:stdString.data()
@@ -34,9 +33,9 @@
@end
-@implementation NSString (AbslStringView)
+@implementation NSString (RTCAbslStringView)
-+ (NSString *)stringForAbslStringView:(const absl::string_view)abslStringView {
++ (NSString *)rtc_stringForAbslStringView:(const absl::string_view)abslStringView {
return [[NSString alloc] initWithBytes:abslStringView.data()
length:abslStringView.length()
encoding:NSUTF8StringEncoding];
diff --git a/sdk/objc/native/src/objc_video_decoder_factory.mm b/sdk/objc/native/src/objc_video_decoder_factory.mm
index da3b302..f843498 100644
--- a/sdk/objc/native/src/objc_video_decoder_factory.mm
+++ b/sdk/objc/native/src/objc_video_decoder_factory.mm
@@ -19,7 +19,7 @@
#import "sdk/objc/api/peerconnection/RTCEncodedImage+Private.h"
#import "sdk/objc/api/peerconnection/RTCVideoCodecInfo+Private.h"
#import "sdk/objc/api/video_codec/RTCWrappedNativeVideoDecoder.h"
-#import "sdk/objc/helpers/NSString+StdString.h"
+#import "sdk/objc/helpers/NSString+RTCStdString.h"
#include "api/video_codecs/sdp_video_format.h"
#include "api/video_codecs/video_decoder.h"
diff --git a/sdk/objc/native/src/objc_video_encoder_factory.mm b/sdk/objc/native/src/objc_video_encoder_factory.mm
index d4ea79c..b42ca72 100644
--- a/sdk/objc/native/src/objc_video_encoder_factory.mm
+++ b/sdk/objc/native/src/objc_video_encoder_factory.mm
@@ -21,7 +21,7 @@
#import "sdk/objc/api/peerconnection/RTCVideoEncoderSettings+Private.h"
#import "sdk/objc/api/video_codec/RTCVideoCodecConstants.h"
#import "sdk/objc/api/video_codec/RTCWrappedNativeVideoEncoder.h"
-#import "sdk/objc/helpers/NSString+StdString.h"
+#import "sdk/objc/helpers/NSString+RTCStdString.h"
#include "api/video/video_frame.h"
#include "api/video_codecs/sdp_video_format.h"
diff --git a/sdk/objc/unittests/RTCCameraVideoCapturerTests.mm b/sdk/objc/unittests/RTCCameraVideoCapturerTests.mm
index 6235fb4..96bb53e 100644
--- a/sdk/objc/unittests/RTCCameraVideoCapturerTests.mm
+++ b/sdk/objc/unittests/RTCCameraVideoCapturerTests.mm
@@ -19,7 +19,7 @@
#import "base/RTCVideoFrame.h"
#import "components/capturer/RTCCameraVideoCapturer.h"
-#import "helpers/AVCaptureSession+DevicePosition.h"
+#import "helpers/AVCaptureSession+RTCDevicePosition.h"
#import "helpers/RTCDispatcher.h"
#import "helpers/scoped_cftyperef.h"
@@ -338,8 +338,8 @@
CMSampleBufferRef sampleBuffer = createTestSampleBufferRef();
[self setExif:sampleBuffer];
- AVCaptureDevicePosition cameraPosition = [AVCaptureSession
- devicePositionForSampleBuffer:sampleBuffer];
+ AVCaptureDevicePosition cameraPosition =
+ [AVCaptureSession rtc_devicePositionForSampleBuffer:sampleBuffer];
EXPECT_EQ(cameraPosition, AVCaptureDevicePositionBack);
#endif
}
diff --git a/sdk/objc/unittests/RTCCertificateTest.mm b/sdk/objc/unittests/RTCCertificateTest.mm
index bc13473..dace3df 100644
--- a/sdk/objc/unittests/RTCCertificateTest.mm
+++ b/sdk/objc/unittests/RTCCertificateTest.mm
@@ -21,7 +21,7 @@
#import "api/peerconnection/RTCMediaConstraints.h"
#import "api/peerconnection/RTCPeerConnection.h"
#import "api/peerconnection/RTCPeerConnectionFactory.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@interface RTCCertificateTest : XCTestCase
@end
diff --git a/sdk/objc/unittests/RTCConfigurationTest.mm b/sdk/objc/unittests/RTCConfigurationTest.mm
index 18cc971..1a10d56 100644
--- a/sdk/objc/unittests/RTCConfigurationTest.mm
+++ b/sdk/objc/unittests/RTCConfigurationTest.mm
@@ -18,7 +18,7 @@
#import "api/peerconnection/RTCConfiguration+Private.h"
#import "api/peerconnection/RTCConfiguration.h"
#import "api/peerconnection/RTCIceServer.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@interface RTCConfigurationTest : XCTestCase
@end
diff --git a/sdk/objc/unittests/RTCDataChannelConfigurationTest.mm b/sdk/objc/unittests/RTCDataChannelConfigurationTest.mm
index ccebd74..e59876e 100644
--- a/sdk/objc/unittests/RTCDataChannelConfigurationTest.mm
+++ b/sdk/objc/unittests/RTCDataChannelConfigurationTest.mm
@@ -15,7 +15,7 @@
#import "api/peerconnection/RTCDataChannelConfiguration+Private.h"
#import "api/peerconnection/RTCDataChannelConfiguration.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@interface RTCDataChannelConfigurationTest : XCTestCase
@end
diff --git a/sdk/objc/unittests/RTCIceCandidateTest.mm b/sdk/objc/unittests/RTCIceCandidateTest.mm
index 5764119..2b6eb20 100644
--- a/sdk/objc/unittests/RTCIceCandidateTest.mm
+++ b/sdk/objc/unittests/RTCIceCandidateTest.mm
@@ -17,7 +17,7 @@
#import "api/peerconnection/RTCIceCandidate+Private.h"
#import "api/peerconnection/RTCIceCandidate.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@interface RTCIceCandidateTest : XCTestCase
@end
diff --git a/sdk/objc/unittests/RTCIceServerTest.mm b/sdk/objc/unittests/RTCIceServerTest.mm
index 772653c..1b3a12c 100644
--- a/sdk/objc/unittests/RTCIceServerTest.mm
+++ b/sdk/objc/unittests/RTCIceServerTest.mm
@@ -17,7 +17,7 @@
#import "api/peerconnection/RTCIceServer+Private.h"
#import "api/peerconnection/RTCIceServer.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@interface RTCIceServerTest : XCTestCase
@end
@@ -125,10 +125,10 @@
[[RTC_OBJC_TYPE(RTCIceServer) alloc] initWithNativeServer:nativeServer];
EXPECT_EQ(1u, iceServer.urlStrings.count);
EXPECT_EQ("stun:stun.example.net",
- [NSString stdStringForString:iceServer.urlStrings.firstObject]);
- EXPECT_EQ("username", [NSString stdStringForString:iceServer.username]);
- EXPECT_EQ("password", [NSString stdStringForString:iceServer.credential]);
- EXPECT_EQ("hostname", [NSString stdStringForString:iceServer.hostname]);
+ [NSString rtc_stdStringForString:iceServer.urlStrings.firstObject]);
+ EXPECT_EQ("username", [NSString rtc_stdStringForString:iceServer.username]);
+ EXPECT_EQ("password", [NSString rtc_stdStringForString:iceServer.credential]);
+ EXPECT_EQ("hostname", [NSString rtc_stdStringForString:iceServer.hostname]);
EXPECT_EQ(2u, iceServer.tlsAlpnProtocols.count);
EXPECT_EQ(2u, iceServer.tlsEllipticCurves.count);
}
diff --git a/sdk/objc/unittests/RTCMediaConstraintsTest.mm b/sdk/objc/unittests/RTCMediaConstraintsTest.mm
index 6ed7859..57a3fb8 100644
--- a/sdk/objc/unittests/RTCMediaConstraintsTest.mm
+++ b/sdk/objc/unittests/RTCMediaConstraintsTest.mm
@@ -17,7 +17,7 @@
#import "api/peerconnection/RTCMediaConstraints+Private.h"
#import "api/peerconnection/RTCMediaConstraints.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@interface RTCMediaConstraintsTests : XCTestCase
@end
diff --git a/sdk/objc/unittests/RTCPeerConnectionTest.mm b/sdk/objc/unittests/RTCPeerConnectionTest.mm
index 9ca8403..45c9ce5 100644
--- a/sdk/objc/unittests/RTCPeerConnectionTest.mm
+++ b/sdk/objc/unittests/RTCPeerConnectionTest.mm
@@ -26,7 +26,7 @@
#import "api/peerconnection/RTCPeerConnectionFactory+Native.h"
#import "api/peerconnection/RTCPeerConnectionFactory.h"
#import "api/peerconnection/RTCSessionDescription.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@interface RTCPeerConnectionTests : XCTestCase
@end
diff --git a/sdk/objc/unittests/RTCSessionDescriptionTest.mm b/sdk/objc/unittests/RTCSessionDescriptionTest.mm
index 70c82f7..fcacc26 100644
--- a/sdk/objc/unittests/RTCSessionDescriptionTest.mm
+++ b/sdk/objc/unittests/RTCSessionDescriptionTest.mm
@@ -15,7 +15,7 @@
#import "api/peerconnection/RTCSessionDescription+Private.h"
#import "api/peerconnection/RTCSessionDescription.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@interface RTCSessionDescriptionTests : XCTestCase
@end
diff --git a/sdk/objc/unittests/RTCTracingTest.mm b/sdk/objc/unittests/RTCTracingTest.mm
index ff93047..133a54d 100644
--- a/sdk/objc/unittests/RTCTracingTest.mm
+++ b/sdk/objc/unittests/RTCTracingTest.mm
@@ -16,7 +16,7 @@
#include "rtc_base/gunit.h"
#import "api/peerconnection/RTCTracing.h"
-#import "helpers/NSString+StdString.h"
+#import "helpers/NSString+RTCStdString.h"
@interface RTCTracingTests : XCTestCase
@end
diff --git a/test/ios/test_support.mm b/test/ios/test_support.mm
index 24cbcc7..1f834e7 100644
--- a/test/ios/test_support.mm
+++ b/test/ios/test_support.mm
@@ -15,7 +15,7 @@
#include "test/ios/test_support.h"
#include "test/testsupport/perf_test.h"
-#import "sdk/objc/helpers/NSString+StdString.h"
+#import "sdk/objc/helpers/NSString+RTCStdString.h"
// Springboard will kill any iOS app that fails to check in after launch within
// a given time. Starting a UIApplication before invoking TestSuite::Run
@@ -97,7 +97,7 @@
if ([outputDirectories count] != 0) {
NSString *outputPath = [outputDirectories[0] stringByAppendingPathComponent:fileName];
- if (!webrtc::test::WritePerfResults([NSString stdStringForString:outputPath])) {
+ if (!webrtc::test::WritePerfResults([NSString rtc_stdStringForString:outputPath])) {
return 1;
}
}
diff --git a/test/testsupport/ios_file_utils.mm b/test/testsupport/ios_file_utils.mm
index ef36937..38d5e37 100644
--- a/test/testsupport/ios_file_utils.mm
+++ b/test/testsupport/ios_file_utils.mm
@@ -13,7 +13,7 @@
#import <Foundation/Foundation.h>
#include <string.h>
-#import "sdk/objc/helpers/NSString+StdString.h"
+#import "sdk/objc/helpers/NSString+RTCStdString.h"
#include "absl/strings/string_view.h"
#include "rtc_base/checks.h"
@@ -26,20 +26,20 @@
// therefore removes any prepended folders and uses only the actual file name.
std::string IOSResourcePath(absl::string_view name, absl::string_view extension) {
@autoreleasepool {
- NSString* path = [NSString stringForAbslStringView:name];
+ NSString* path = [NSString rtc_stringForAbslStringView:name];
NSString* fileName = path.lastPathComponent;
- NSString* fileType = [NSString stringForAbslStringView:extension];
+ NSString* fileType = [NSString rtc_stringForAbslStringView:extension];
// Get full pathname for the resource identified by the name and extension.
NSString* pathString = [[NSBundle mainBundle] pathForResource:fileName
ofType:fileType];
- return [NSString stdStringForString:pathString];
+ return [NSString rtc_stdStringForString:pathString];
}
}
std::string IOSRootPath() {
@autoreleasepool {
NSBundle* mainBundle = [NSBundle mainBundle];
- return [NSString stdStringForString:mainBundle.bundlePath] + "/";
+ return [NSString rtc_stdStringForString:mainBundle.bundlePath] + "/";
}
}
@@ -51,7 +51,7 @@
NSString* tempDir = NSTemporaryDirectory();
if (tempDir == nil)
tempDir = @"/tmp";
- return [NSString stdStringForString:tempDir];
+ return [NSString rtc_stdStringForString:tempDir];
}
}