Expose bit rate property in ARDAppClient and set max bitrate for video RTCRtcSender.

BUG=webrtc:6654

Review-Url: https://codereview.webrtc.org/2484733002
Cr-Commit-Position: refs/heads/master@{#14977}
This commit is contained in:
denicija 2016-11-08 06:28:17 -08:00 committed by Commit bot
parent 56827ef527
commit 8c375dedb2
2 changed files with 17 additions and 0 deletions

View File

@ -65,6 +65,9 @@ typedef NS_ENUM(NSInteger, ARDAppClientState) {
// Sets camera constraints.
- (void)setCameraConstraints:(RTCMediaConstraints *)mediaConstraints;
// Sets maximum bitrate the rtp sender should use.
- (void)setMaxBitrate:(NSNumber *)maxBitrate;
// Establishes a connection with the AppRTC servers for the given room id.
// If |isLoopback| is true, the call will connect to itself.
// If |isAudioOnly| is true, video will be disabled for the call.

View File

@ -102,6 +102,7 @@ static int64_t const kARDAppClientRtcEventLogMaxSizeInBytes = 5e6; // 5 MB.
RTCFileLogger *_fileLogger;
ARDTimerProxy *_statsTimer;
RTCMediaConstraints *_cameraConstraints;
NSNumber *_maxBitrate;
}
@synthesize shouldGetStats = _shouldGetStats;
@ -328,6 +329,10 @@ static int64_t const kARDAppClientRtcEventLogMaxSizeInBytes = 5e6; // 5 MB.
_cameraConstraints = mediaConstraints;
}
- (void)setMaxBitrate:(NSNumber *)maxBitrate {
_maxBitrate = maxBitrate;
}
#pragma mark - ARDSignalingChannelDelegate
- (void)channel:(id<ARDSignalingChannel>)channel
@ -675,6 +680,9 @@ static int64_t const kARDAppClientRtcEventLogMaxSizeInBytes = 5e6; // 5 MB.
RTCRtpSender *sender =
[_peerConnection senderWithKind:kRTCMediaStreamTrackKindVideo
streamId:kARDMediaStreamId];
[self setMaxBitrate:_maxBitrate forVideoSender:sender];
RTCVideoTrack *track = [self createLocalVideoTrack];
if (track) {
sender.track = track;
@ -683,6 +691,12 @@ static int64_t const kARDAppClientRtcEventLogMaxSizeInBytes = 5e6; // 5 MB.
return sender;
}
- (void)setMaxBitrate:(NSNumber *)maxBitrate forVideoSender:(RTCRtpSender *)sender {
for (RTCRtpEncodingParameters *encoding in sender.parameters.encodings) {
encoding.maxBitrateBps = maxBitrate;
}
}
- (RTCRtpSender *)createAudioSender {
RTCMediaConstraints *constraints = [self defaultMediaAudioConstraints];
RTCAudioSource *source = [_factory audioSourceWithConstraints:constraints];