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

Side by Side Diff: webrtc/examples/objc/AppRTCMobile/ARDAppClient.m

Issue 2484733002: Expose bit rate property in ARDAppClient and set max bitrate for video RTCRtcSender. (Closed)
Patch Set: Inline property instead of introducing local var Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « webrtc/examples/objc/AppRTCMobile/ARDAppClient.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 - (void)timerDidFire:(NSTimer *)timer { 95 - (void)timerDidFire:(NSTimer *)timer {
96 _timerHandler(); 96 _timerHandler();
97 } 97 }
98 98
99 @end 99 @end
100 100
101 @implementation ARDAppClient { 101 @implementation ARDAppClient {
102 RTCFileLogger *_fileLogger; 102 RTCFileLogger *_fileLogger;
103 ARDTimerProxy *_statsTimer; 103 ARDTimerProxy *_statsTimer;
104 RTCMediaConstraints *_cameraConstraints; 104 RTCMediaConstraints *_cameraConstraints;
105 NSNumber *_maxBitrate;
105 } 106 }
106 107
107 @synthesize shouldGetStats = _shouldGetStats; 108 @synthesize shouldGetStats = _shouldGetStats;
108 @synthesize state = _state; 109 @synthesize state = _state;
109 @synthesize delegate = _delegate; 110 @synthesize delegate = _delegate;
110 @synthesize roomServerClient = _roomServerClient; 111 @synthesize roomServerClient = _roomServerClient;
111 @synthesize channel = _channel; 112 @synthesize channel = _channel;
112 @synthesize loopbackChannel = _loopbackChannel; 113 @synthesize loopbackChannel = _loopbackChannel;
113 @synthesize turnClient = _turnClient; 114 @synthesize turnClient = _turnClient;
114 @synthesize peerConnection = _peerConnection; 115 @synthesize peerConnection = _peerConnection;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 self.state = kARDAppClientStateDisconnected; 320 self.state = kARDAppClientStateDisconnected;
320 #if defined(WEBRTC_IOS) 321 #if defined(WEBRTC_IOS)
321 RTCStopInternalCapture(); 322 RTCStopInternalCapture();
322 #endif 323 #endif
323 } 324 }
324 325
325 - (void)setCameraConstraints:(RTCMediaConstraints *)mediaConstraints { 326 - (void)setCameraConstraints:(RTCMediaConstraints *)mediaConstraints {
326 _cameraConstraints = mediaConstraints; 327 _cameraConstraints = mediaConstraints;
327 } 328 }
328 329
330 - (void)setMaxBitrate:(NSNumber *)maxBitrate {
331 _maxBitrate = maxBitrate;
332 }
333
329 #pragma mark - ARDSignalingChannelDelegate 334 #pragma mark - ARDSignalingChannelDelegate
330 335
331 - (void)channel:(id<ARDSignalingChannel>)channel 336 - (void)channel:(id<ARDSignalingChannel>)channel
332 didReceiveMessage:(ARDSignalingMessage *)message { 337 didReceiveMessage:(ARDSignalingMessage *)message {
333 switch (message.type) { 338 switch (message.type) {
334 case kARDSignalingMessageTypeOffer: 339 case kARDSignalingMessageTypeOffer:
335 case kARDSignalingMessageTypeAnswer: 340 case kARDSignalingMessageTypeAnswer:
336 // Offers and answers must be processed before any other message, so we 341 // Offers and answers must be processed before any other message, so we
337 // place them at the front of the queue. 342 // place them at the front of the queue.
338 _hasReceivedSdp = YES; 343 _hasReceivedSdp = YES;
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 }]; 671 }];
667 } else { 672 } else {
668 [_channel sendMessage:message]; 673 [_channel sendMessage:message];
669 } 674 }
670 } 675 }
671 676
672 - (RTCRtpSender *)createVideoSender { 677 - (RTCRtpSender *)createVideoSender {
673 RTCRtpSender *sender = 678 RTCRtpSender *sender =
674 [_peerConnection senderWithKind:kRTCMediaStreamTrackKindVideo 679 [_peerConnection senderWithKind:kRTCMediaStreamTrackKindVideo
675 streamId:kARDMediaStreamId]; 680 streamId:kARDMediaStreamId];
681
682 [self setMaxBitrate:_maxBitrate forVideoSender:sender];
683
676 RTCVideoTrack *track = [self createLocalVideoTrack]; 684 RTCVideoTrack *track = [self createLocalVideoTrack];
677 if (track) { 685 if (track) {
678 sender.track = track; 686 sender.track = track;
679 [_delegate appClient:self didReceiveLocalVideoTrack:track]; 687 [_delegate appClient:self didReceiveLocalVideoTrack:track];
680 } 688 }
681 return sender; 689 return sender;
682 } 690 }
683 691
692 - (void)setMaxBitrate:(NSNumber *)maxBitrate forVideoSender:(RTCRtpSender *)send er {
693 for (RTCRtpEncodingParameters *encoding in sender.parameters.encodings) {
694 encoding.maxBitrateBps = maxBitrate;
695 }
696 }
697
684 - (RTCRtpSender *)createAudioSender { 698 - (RTCRtpSender *)createAudioSender {
685 RTCMediaConstraints *constraints = [self defaultMediaAudioConstraints]; 699 RTCMediaConstraints *constraints = [self defaultMediaAudioConstraints];
686 RTCAudioSource *source = [_factory audioSourceWithConstraints:constraints]; 700 RTCAudioSource *source = [_factory audioSourceWithConstraints:constraints];
687 RTCAudioTrack *track = [_factory audioTrackWithSource:source 701 RTCAudioTrack *track = [_factory audioTrackWithSource:source
688 trackId:kARDAudioTrackId]; 702 trackId:kARDAudioTrackId];
689 RTCRtpSender *sender = 703 RTCRtpSender *sender =
690 [_peerConnection senderWithKind:kRTCMediaStreamTrackKindAudio 704 [_peerConnection senderWithKind:kRTCMediaStreamTrackKindAudio
691 streamId:kARDMediaStreamId]; 705 streamId:kARDMediaStreamId];
692 sender.track = track; 706 sender.track = track;
693 return sender; 707 return sender;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 code:kARDAppClientErrorInvalidRoom 852 code:kARDAppClientErrorInvalidRoom
839 userInfo:@{ 853 userInfo:@{
840 NSLocalizedDescriptionKey: @"Invalid room.", 854 NSLocalizedDescriptionKey: @"Invalid room.",
841 }]; 855 }];
842 break; 856 break;
843 } 857 }
844 return error; 858 return error;
845 } 859 }
846 860
847 @end 861 @end
OLDNEW
« no previous file with comments | « webrtc/examples/objc/AppRTCMobile/ARDAppClient.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698