diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 890c4f97dc..787ca8c13c 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -420,6 +420,7 @@ if (is_ios || is_mac) { "objc/Framework/Classes/PeerConnection/RTCMetricsSampleInfo+Private.h", "objc/Framework/Classes/PeerConnection/RTCMetricsSampleInfo.mm", "objc/Framework/Classes/PeerConnection/RTCPeerConnection+DataChannel.mm", + "objc/Framework/Classes/PeerConnection/RTCPeerConnection+Native.h", "objc/Framework/Classes/PeerConnection/RTCPeerConnection+Private.h", "objc/Framework/Classes/PeerConnection/RTCPeerConnection+Stats.mm", "objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm", diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Native.h b/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Native.h new file mode 100644 index 0000000000..238f808bb5 --- /dev/null +++ b/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection+Native.h @@ -0,0 +1,34 @@ +/* + * Copyright 2017 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 "WebRTC/RTCPeerConnection.h" + +#include + +namespace rtc { +class BitrateAllocationStrategy; +} // namespace rtc + +NS_ASSUME_NONNULL_BEGIN + +/** + * This class extension exposes methods that work directly with injectable C++ components. + */ +@interface RTCPeerConnection () + +/** Sets current strategy. If not set default WebRTC allocator will be used. May be changed during + * an active session. + */ +- (void)setBitrateAllocationStrategy: + (std::unique_ptr)bitrateAllocationStrategy; + +@end + +NS_ASSUME_NONNULL_END diff --git a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm b/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm index e443e850da..6376ea0429 100644 --- a/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm +++ b/sdk/objc/Framework/Classes/PeerConnection/RTCPeerConnection.mm @@ -17,6 +17,7 @@ #import "RTCLegacyStatsReport+Private.h" #import "RTCMediaConstraints+Private.h" #import "RTCMediaStream+Private.h" +#import "RTCPeerConnection+Native.h" #import "RTCPeerConnectionFactory+Private.h" #import "RTCRtpReceiver+Private.h" #import "RTCRtpSender+Private.h" @@ -385,6 +386,11 @@ void PeerConnectionDelegateAdapter::OnIceCandidatesRemoved( return _peerConnection->SetBitrate(params).ok(); } +- (void)setBitrateAllocationStrategy: + (std::unique_ptr)bitrateAllocationStrategy { + _peerConnection->SetBitrateAllocationStrategy(std::move(bitrateAllocationStrategy)); +} + - (BOOL)startRtcEventLogWithFilePath:(NSString *)filePath maxSizeInBytes:(int64_t)maxSizeInBytes { RTC_DCHECK(filePath.length);