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

Side by Side Diff: webrtc/api/objc/RTCMediaStream.mm

Issue 1696673003: Tweaks for new Objective-C API. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changes based on feedback Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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
11 #import "RTCMediaStream.h" 11 #import "RTCMediaStream.h"
12 12
13 #include <vector> 13 #include <vector>
14 14
15 #import "webrtc/api/objc/RTCAudioTrack+Private.h" 15 #import "webrtc/api/objc/RTCAudioTrack+Private.h"
16 #import "webrtc/api/objc/RTCMediaStream+Private.h" 16 #import "webrtc/api/objc/RTCMediaStream+Private.h"
17 #import "webrtc/api/objc/RTCMediaStreamTrack+Private.h" 17 #import "webrtc/api/objc/RTCMediaStreamTrack+Private.h"
18 #import "webrtc/api/objc/RTCPeerConnectionFactory+Private.h"
18 #import "webrtc/api/objc/RTCVideoTrack+Private.h" 19 #import "webrtc/api/objc/RTCVideoTrack+Private.h"
19 #import "webrtc/base/objc/NSString+StdString.h" 20 #import "webrtc/base/objc/NSString+StdString.h"
20 21
21 @implementation RTCMediaStream { 22 @implementation RTCMediaStream {
22 NSMutableArray *_audioTracks; 23 NSMutableArray *_audioTracks;
23 NSMutableArray *_videoTracks; 24 NSMutableArray *_videoTracks;
24 rtc::scoped_refptr<webrtc::MediaStreamInterface> _nativeMediaStream; 25 rtc::scoped_refptr<webrtc::MediaStreamInterface> _nativeMediaStream;
25 } 26 }
26 27
28 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
29 streamId:(NSString *)streamId {
30 NSParameterAssert(factory);
31 NSParameterAssert(streamId.length);
32 std::string nativeId = [NSString stdStringForString:streamId];
33 rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
34 factory.nativeFactory->CreateLocalMediaStream(nativeId);
35 return [self initWithNativeMediaStream:stream];
36 }
37
27 - (NSArray<RTCAudioTrack *> *)audioTracks { 38 - (NSArray<RTCAudioTrack *> *)audioTracks {
28 return [_audioTracks copy]; 39 return [_audioTracks copy];
29 } 40 }
30 41
31 - (NSArray<RTCVideoTrack *> *)videoTracks { 42 - (NSArray<RTCVideoTrack *> *)videoTracks {
32 return [_videoTracks copy]; 43 return [_videoTracks copy];
33 } 44 }
34 45
35 - (NSString *)streamId { 46 - (NSString *)streamId {
36 return [NSString stringForStdString:_nativeMediaStream->label()]; 47 return [NSString stringForStdString:_nativeMediaStream->label()];
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 RTCMediaStreamTrackType type = RTCMediaStreamTrackTypeVideo; 114 RTCMediaStreamTrackType type = RTCMediaStreamTrackTypeVideo;
104 RTCVideoTrack *videoTrack = 115 RTCVideoTrack *videoTrack =
105 [[RTCVideoTrack alloc] initWithNativeTrack:track type:type]; 116 [[RTCVideoTrack alloc] initWithNativeTrack:track type:type];
106 [_videoTracks addObject:videoTrack]; 117 [_videoTracks addObject:videoTrack];
107 } 118 }
108 } 119 }
109 return self; 120 return self;
110 } 121 }
111 122
112 @end 123 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698