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

Unified Diff: webrtc/examples/objc/AppRTCDemo/ARDAppClient.m

Issue 2294913003: Update iOS AppRTCDemo to use level controller. (Closed)
Patch Set: Remove blank line. Created 4 years, 4 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/AppRTCDemo/ARDAppClient.m
diff --git a/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m b/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m
index a9dd8b15fbcd377e4099f7e53c6db92e0d81d119..ea86c5ed48279e2b6da87edb1cf28cf263b0bf5c 100644
--- a/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m
+++ b/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m
@@ -131,6 +131,7 @@ static int64_t const kARDAppClientRtcEventLogMaxSizeInBytes = 5e6; // 5 MB.
@synthesize isAudioOnly = _isAudioOnly;
@synthesize shouldMakeAecDump = _shouldMakeAecDump;
@synthesize isAecDumpActive = _isAecDumpActive;
+@synthesize shouldUseLevelControl = _shouldUseLevelControl;
- (instancetype)init {
if (self = [super init]) {
@@ -223,12 +224,14 @@ static int64_t const kARDAppClientRtcEventLogMaxSizeInBytes = 5e6; // 5 MB.
- (void)connectToRoomWithId:(NSString *)roomId
isLoopback:(BOOL)isLoopback
isAudioOnly:(BOOL)isAudioOnly
- shouldMakeAecDump:(BOOL)shouldMakeAecDump {
+ shouldMakeAecDump:(BOOL)shouldMakeAecDump
+ shouldUseLevelControl:(BOOL)shouldUseLevelControl {
NSParameterAssert(roomId.length);
NSParameterAssert(_state == kARDAppClientStateDisconnected);
_isLoopback = isLoopback;
_isAudioOnly = isAudioOnly;
_shouldMakeAecDump = shouldMakeAecDump;
+ _shouldUseLevelControl = shouldUseLevelControl;
self.state = kARDAppClientStateConnecting;
#if defined(WEBRTC_IOS)
@@ -689,10 +692,13 @@ static int64_t const kARDAppClientRtcEventLogMaxSizeInBytes = 5e6; // 5 MB.
}
- (RTCRtpSender *)createAudioSender {
+ RTCMediaConstraints *constraints = [self defaultMediaAudioConstraints];
+ RTCAudioSource *source = [_factory audioSourceWithConstraints:constraints];
+ RTCAudioTrack *track = [_factory audioTrackWithSource:source
+ trackId:kARDAudioTrackId];
RTCRtpSender *sender =
[_peerConnection senderWithKind:kRTCMediaStreamTrackKindAudio
streamId:kARDMediaStreamId];
- RTCAudioTrack *track = [_factory audioTrackWithTrackId:kARDAudioTrackId];
sender.track = track;
return sender;
}
@@ -744,6 +750,16 @@ static int64_t const kARDAppClientRtcEventLogMaxSizeInBytes = 5e6; // 5 MB.
#pragma mark - Defaults
+ - (RTCMediaConstraints *)defaultMediaAudioConstraints {
+ NSString *valueLevelControl = _shouldUseLevelControl ?
+ kRTCMediaConstraintsValueTrue : kRTCMediaConstraintsValueFalse;
+ NSDictionary *mandatoryConstraints = @{ kRTCMediaConstraintsLevelControl : valueLevelControl };
+ RTCMediaConstraints* constraints =
+ [[RTCMediaConstraints alloc] initWithMandatoryConstraints:mandatoryConstraints
+ optionalConstraints:nil];
+ return constraints;
+}
+
- (RTCMediaConstraints *)defaultMediaStreamConstraints {
RTCMediaConstraints* constraints =
[[RTCMediaConstraints alloc]
« no previous file with comments | « webrtc/examples/objc/AppRTCDemo/ARDAppClient.h ('k') | webrtc/examples/objc/AppRTCDemo/ARDAppClient+Internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698