Reland of BWE allocation strategy

TBR=stefan@webrtc.org,alexnarest@webrtc.org

Bug: webrtc:8243
Change-Id: Ie68e4f414b2ac32ba4e64877cb250fabcb089a07
Reviewed-on: https://webrtc-review.googlesource.com/13940
Commit-Queue: Alex Narest <alexnarest@webrtc.org>
Reviewed-by: Alex Narest <alexnarest@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20369}
This commit is contained in:
Alex Narest
2017-10-20 10:37:47 +02:00
committed by Commit Bot
parent b82de30080
commit 78609d5b6b
31 changed files with 543 additions and 24 deletions

View File

@ -25,6 +25,7 @@
#import "WebRTC/RTCVideoTrack.h"
#import "ARDAppEngineClient.h"
#import "ARDBitrateAllocationStrategy.h"
#import "ARDJoinResponse.h"
#import "ARDMessageResponse.h"
#import "ARDSettingsModel.h"
@ -50,6 +51,7 @@ static NSString * const kARDMediaStreamId = @"ARDAMS";
static NSString * const kARDAudioTrackId = @"ARDAMSa0";
static NSString * const kARDVideoTrackId = @"ARDAMSv0";
static NSString * const kARDVideoTrackKind = @"video";
static uint32_t const kSufficientAudioBitrate = 16000;
// TODO(tkchin): Add these as UI options.
static BOOL const kARDAppClientEnableTracing = NO;
@ -104,6 +106,7 @@ static int const kKbpsMultiplier = 1000;
ARDTimerProxy *_statsTimer;
ARDSettingsModel *_settings;
RTCVideoTrack *_localVideoTrack;
ARDBitrateAllocationStrategy *_bitrateAllocationStrategy;
}
@synthesize shouldGetStats = _shouldGetStats;
@ -306,12 +309,14 @@ static int const kKbpsMultiplier = 1000;
_hasReceivedSdp = NO;
_messageQueue = [NSMutableArray array];
_localVideoTrack = nil;
#if defined(WEBRTC_IOS)
[_factory stopAecDump];
[_peerConnection stopRtcEventLog];
#endif
[_peerConnection close];
_peerConnection = nil;
_bitrateAllocationStrategy = nil;
self.state = kARDAppClientStateDisconnected;
#if defined(WEBRTC_IOS)
if (kARDAppClientEnableTracing) {
@ -533,8 +538,14 @@ static int const kKbpsMultiplier = 1000;
_peerConnection = [_factory peerConnectionWithConfiguration:config
constraints:constraints
delegate:self];
_bitrateAllocationStrategy = [ARDBitrateAllocationStrategy
createAudioPriorityBitrateAllocationStrategyForPeerConnection:_peerConnection
withAudioTrack:kARDAudioTrackId
sufficientAudioBitrate:kSufficientAudioBitrate];
// Create AV senders.
[self createMediaSenders];
if (_isInitiator) {
// Send offer.
__weak ARDAppClient *weakSelf = self;