| Index: webrtc/examples/objc/AppRTCDemo/ARDAppClient.m
|
| diff --git a/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m b/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m
|
| index 7d060c9e9f4509c6307d247c85e52f5ecbd363eb..86d18d1333c6b1bd58f77a366e557ff062e82010 100644
|
| --- a/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m
|
| +++ b/webrtc/examples/objc/AppRTCDemo/ARDAppClient.m
|
| @@ -22,6 +22,7 @@
|
| #import "WebRTC/RTCMediaConstraints.h"
|
| #import "WebRTC/RTCMediaStream.h"
|
| #import "WebRTC/RTCPeerConnectionFactory.h"
|
| +#import "WebRTC/RTCRtpSender.h"
|
|
|
| #import "ARDAppEngineClient.h"
|
| #import "ARDCEODTURNClient.h"
|
| @@ -48,6 +49,9 @@ static NSInteger const kARDAppClientErrorCreateSDP = -3;
|
| static NSInteger const kARDAppClientErrorSetSDP = -4;
|
| static NSInteger const kARDAppClientErrorInvalidClient = -5;
|
| static NSInteger const kARDAppClientErrorInvalidRoom = -6;
|
| +static NSString * const kARDMediaStreamId = @"ARDAMS";
|
| +static NSString * const kARDAudioTrackId = @"ARDAMSa0";
|
| +static NSString * const kARDVideoTrackId = @"ARDAMSv0";
|
|
|
| // TODO(tkchin): Remove guard once rtc_sdk_common_objc compiles on Mac.
|
| #if defined(WEBRTC_IOS)
|
| @@ -505,9 +509,9 @@ static BOOL const kARDAppClientEnableTracing = NO;
|
| _peerConnection = [_factory peerConnectionWithConfiguration:config
|
| constraints:constraints
|
| delegate:self];
|
| - // Create AV media stream and add it to the peer connection.
|
| - RTCMediaStream *localStream = [self createLocalMediaStream];
|
| - [_peerConnection addStream:localStream];
|
| + // Create AV senders.
|
| + [self createAudioSender];
|
| + [self createVideoSender];
|
| if (_isInitiator) {
|
| // Send offer.
|
| __weak ARDAppClient *weakSelf = self;
|
| @@ -606,17 +610,25 @@ static BOOL const kARDAppClientEnableTracing = NO;
|
| }
|
| }
|
|
|
| -- (RTCMediaStream *)createLocalMediaStream {
|
| - RTCMediaStream *localStream = [_factory mediaStreamWithStreamId:@"ARDAMS"];
|
| - RTCVideoTrack *localVideoTrack = [self createLocalVideoTrack];
|
| - if (localVideoTrack) {
|
| - [localStream addVideoTrack:localVideoTrack];
|
| - [_delegate appClient:self didReceiveLocalVideoTrack:localVideoTrack];
|
| +- (RTCRtpSender *)createVideoSender {
|
| + RTCRtpSender *sender =
|
| + [_peerConnection senderWithKind:kRTCMediaStreamTrackKindVideo
|
| + streamId:kARDMediaStreamId];
|
| + RTCVideoTrack *track = [self createLocalVideoTrack];
|
| + if (track) {
|
| + sender.track = track;
|
| + [_delegate appClient:self didReceiveLocalVideoTrack:track];
|
| }
|
| - RTCAudioTrack *localAudioTrack =
|
| - [_factory audioTrackWithTrackId:@"ARDAMSa0"];
|
| - [localStream addAudioTrack:localAudioTrack];
|
| - return localStream;
|
| + return sender;
|
| +}
|
| +
|
| +- (RTCRtpSender *)createAudioSender {
|
| + RTCRtpSender *sender =
|
| + [_peerConnection senderWithKind:kRTCMediaStreamTrackKindAudio
|
| + streamId:kARDMediaStreamId];
|
| + RTCAudioTrack *track = [_factory audioTrackWithTrackId:kARDAudioTrackId];
|
| + sender.track = track;
|
| + return sender;
|
| }
|
|
|
| - (RTCVideoTrack *)createLocalVideoTrack {
|
| @@ -634,7 +646,7 @@ static BOOL const kARDAppClientEnableTracing = NO;
|
| [_factory avFoundationVideoSourceWithConstraints:mediaConstraints];
|
| localVideoTrack =
|
| [_factory videoTrackWithSource:source
|
| - trackId:@"ARDAMSv0"];
|
| + trackId:kARDVideoTrackId];
|
| }
|
| #endif
|
| return localVideoTrack;
|
|
|