Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1944)

Unified Diff: webrtc/examples/objc/AppRTCMobile/ARDBitrateAllocationStrategy.mm

Issue 2996643002: BWE allocation strategy
Patch Set: Comments handling Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/examples/objc/AppRTCMobile/ARDBitrateAllocationStrategy.mm
diff --git a/webrtc/examples/objc/AppRTCMobile/ARDBitrateAllocationStrategy.mm b/webrtc/examples/objc/AppRTCMobile/ARDBitrateAllocationStrategy.mm
new file mode 100644
index 0000000000000000000000000000000000000000..563082e84067d9c6ef556b72c2904b9ee7891b82
--- /dev/null
+++ b/webrtc/examples/objc/AppRTCMobile/ARDBitrateAllocationStrategy.mm
@@ -0,0 +1,48 @@
+/*
+ * 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 "ARDBitrateAllocationStrategy.h"
+#import "WebRTC/RTCBitrateAllocationStrategy.h"
+
+#include "webrtc/rtc_base/bitrateallocationstrategy.h"
+
+constexpr uint32_t kSufficientAudioBitrate = 16000;
+
+@implementation ARDBitrateAllocationStrategy {
+ rtc::AudioPriorityBitrateAllocationStrategy* audio_priority_strategy_;
+ __weak RTCPeerConnection* _peerConnection;
+}
+
+- (id)init {
+ if (self = [super init]) audio_priority_strategy_ = nullptr;
+ _peerConnection = nil;
+ return self;
+}
+
+- (void)setAudioPriorityStrategy:(RTCPeerConnection*)peerConnection
+ audioTrackId:(NSString*)audioTrackId {
+ _peerConnection = peerConnection;
+ audio_priority_strategy_ = new rtc::AudioPriorityBitrateAllocationStrategy(
+ std::string(audioTrackId.UTF8String), kSufficientAudioBitrate);
+ [peerConnection setBitrateAllocationStrategy:[[RTCBitrateAllocationStrategy alloc]
+ initWith:audio_priority_strategy_]];
+}
+
+- (void)dealloc {
+ if (_peerConnection) {
+ [_peerConnection setBitrateAllocationStrategy:nil];
+ }
+ if (audio_priority_strategy_) {
+ delete audio_priority_strategy_;
+ audio_priority_strategy_ = nullptr;
+ }
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698