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}
This commit is contained in:
Taylor Brandstetter 2020-03-24 15:41:19 -07:00 committed by Commit Bot
parent 8cdd2c7d3c
commit 21c80320ca
2 changed files with 11 additions and 2 deletions

View file

@ -72,6 +72,11 @@ NS_ASSUME_NONNULL_BEGIN
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;

View file

@ -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);
}