Expose enableDscp in Obj-C API.
network_priority was already exposed, but without the ability to set
enable_dscp, it wasn't actually doing anything.
Bug: webrtc:5658
Change-Id: I092bc3dd46e3e7be363313203428bccfccccf3c5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/171641
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Commit-Queue: Taylor <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30951}
diff --git a/sdk/objc/api/peerconnection/RTCConfiguration.h b/sdk/objc/api/peerconnection/RTCConfiguration.h
index 7400296..44d0922 100644
--- a/sdk/objc/api/peerconnection/RTCConfiguration.h
+++ b/sdk/objc/api/peerconnection/RTCConfiguration.h
@@ -72,6 +72,11 @@
RTC_OBJC_EXPORT
@interface RTCConfiguration : NSObject
+/** If true, allows DSCP codes to be set on outgoing packets, configured using
+ * networkPriority field of RTCRtpEncodingParameters. Defaults to false.
+ */
+@property(nonatomic, assign) BOOL enableDscp;
+
/** An array of Ice Servers available to be used by ICE. */
@property(nonatomic, copy) NSArray<RTCIceServer *> *iceServers;
diff --git a/sdk/objc/api/peerconnection/RTCConfiguration.mm b/sdk/objc/api/peerconnection/RTCConfiguration.mm
index 7f9f591..eeb9493 100644
--- a/sdk/objc/api/peerconnection/RTCConfiguration.mm
+++ b/sdk/objc/api/peerconnection/RTCConfiguration.mm
@@ -22,6 +22,7 @@
@implementation RTCConfiguration
+@synthesize enableDscp = _enableDscp;
@synthesize iceServers = _iceServers;
@synthesize certificate = _certificate;
@synthesize iceTransportPolicy = _iceTransportPolicy;
@@ -66,6 +67,7 @@
- (instancetype)initWithNativeConfiguration:
(const webrtc::PeerConnectionInterface::RTCConfiguration &)config {
if (self = [super init]) {
+ _enableDscp = config.dscp();
NSMutableArray *iceServers = [NSMutableArray array];
for (const webrtc::PeerConnectionInterface::IceServer& server : config.servers) {
RTCIceServer *iceServer = [[RTCIceServer alloc] initWithNativeServer:server];
@@ -140,7 +142,7 @@
- (NSString *)description {
static NSString *formatString = @"RTCConfiguration: "
@"{\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%d\n%d\n%d\n%d\n%d\n%d\n"
- @"%d\n%@\n%d\n%d\n%d\n%d\n%d\n%@\n}\n";
+ @"%d\n%@\n%d\n%d\n%d\n%d\n%d\n%@\n%d\n}\n";
return [NSString
stringWithFormat:formatString,
@@ -166,7 +168,8 @@
_disableIPV6OnWiFi,
_maxIPv6Networks,
_activeResetSrtpParams,
- _useMediaTransport];
+ _useMediaTransport,
+ _enableDscp];
}
#pragma mark - Private
@@ -177,6 +180,7 @@
nativeConfig(new webrtc::PeerConnectionInterface::RTCConfiguration(
webrtc::PeerConnectionInterface::RTCConfigurationType::kAggressive));
+ nativeConfig->set_dscp(_enableDscp);
for (RTCIceServer *iceServer in _iceServers) {
nativeConfig->servers.push_back(iceServer.nativeServer);
}