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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/RTCPeerConnectionFactory.mm

Issue 2290583003: iOS: Add ability to specify audio constraints. (Closed)
Patch Set: Update ctor order. Created 4 years, 3 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 "RTCPeerConnectionFactory+Private.h" 11 #import "RTCPeerConnectionFactory+Private.h"
12 12
13 #import "NSString+StdString.h" 13 #import "NSString+StdString.h"
14 #import "RTCAVFoundationVideoSource+Private.h" 14 #import "RTCAVFoundationVideoSource+Private.h"
15 #import "RTCAudioSource+Private.h"
15 #import "RTCAudioTrack+Private.h" 16 #import "RTCAudioTrack+Private.h"
17 #import "RTCMediaConstraints+Private.h"
16 #import "RTCMediaStream+Private.h" 18 #import "RTCMediaStream+Private.h"
17 #import "RTCPeerConnection+Private.h" 19 #import "RTCPeerConnection+Private.h"
18 #import "RTCVideoSource+Private.h" 20 #import "RTCVideoSource+Private.h"
19 #import "RTCVideoTrack+Private.h" 21 #import "RTCVideoTrack+Private.h"
20 22
21 @implementation RTCPeerConnectionFactory { 23 @implementation RTCPeerConnectionFactory {
22 std::unique_ptr<rtc::Thread> _networkThread; 24 std::unique_ptr<rtc::Thread> _networkThread;
23 std::unique_ptr<rtc::Thread> _workerThread; 25 std::unique_ptr<rtc::Thread> _workerThread;
24 std::unique_ptr<rtc::Thread> _signalingThread; 26 std::unique_ptr<rtc::Thread> _signalingThread;
25 } 27 }
(...skipping 28 matching lines...) Expand all
54 // is passed to the recorder, and the recorder 56 // is passed to the recorder, and the recorder
55 // closes the file when needed. 57 // closes the file when needed.
56 return _nativeFactory->StartAecDump(fileDescriptor, maxFileSizeInBytes); 58 return _nativeFactory->StartAecDump(fileDescriptor, maxFileSizeInBytes);
57 } 59 }
58 60
59 - (void)stopAecDump { 61 - (void)stopAecDump {
60 // The file is closed by the call below. 62 // The file is closed by the call below.
61 _nativeFactory->StopAecDump(); 63 _nativeFactory->StopAecDump();
62 } 64 }
63 65
66 - (RTCAudioSource *)audioSourceWithConstraints:(nullable RTCMediaConstraints *)c onstraints {
67 std::unique_ptr<webrtc::MediaConstraints> nativeConstraints;
68 if (constraints) {
69 nativeConstraints = constraints.nativeConstraints;
70 }
71 rtc::scoped_refptr<webrtc::AudioSourceInterface> source =
72 _nativeFactory->CreateAudioSource(nativeConstraints.get());
73 return [[RTCAudioSource alloc] initWithNativeAudioSource:source];
74 }
75
76 - (RTCAudioTrack *)audioTrackWithTrackId:(NSString *)trackId {
77 RTCAudioSource *audioSource = [self audioSourceWithConstraints:nil];
78 return [self audioTrackWithSource:audioSource trackId:trackId];
79 }
80
81 - (RTCAudioTrack *)audioTrackWithSource:(RTCAudioSource *)source
82 trackId:(NSString *)trackId {
83 return [[RTCAudioTrack alloc] initWithFactory:self
84 source:source
85 trackId:trackId];
86 }
87
64 - (RTCAVFoundationVideoSource *)avFoundationVideoSourceWithConstraints: 88 - (RTCAVFoundationVideoSource *)avFoundationVideoSourceWithConstraints:
65 (nullable RTCMediaConstraints *)constraints { 89 (nullable RTCMediaConstraints *)constraints {
66 return [[RTCAVFoundationVideoSource alloc] initWithFactory:self 90 return [[RTCAVFoundationVideoSource alloc] initWithFactory:self
67 constraints:constraints]; 91 constraints:constraints];
68 } 92 }
69 93
70 - (RTCAudioTrack *)audioTrackWithTrackId:(NSString *)trackId {
71 return [[RTCAudioTrack alloc] initWithFactory:self
72 trackId:trackId];
73 }
74
75 - (RTCVideoTrack *)videoTrackWithSource:(RTCVideoSource *)source 94 - (RTCVideoTrack *)videoTrackWithSource:(RTCVideoSource *)source
76 trackId:(NSString *)trackId { 95 trackId:(NSString *)trackId {
77 return [[RTCVideoTrack alloc] initWithFactory:self 96 return [[RTCVideoTrack alloc] initWithFactory:self
78 source:source 97 source:source
79 trackId:trackId]; 98 trackId:trackId];
80 } 99 }
81 100
82 - (RTCMediaStream *)mediaStreamWithStreamId:(NSString *)streamId { 101 - (RTCMediaStream *)mediaStreamWithStreamId:(NSString *)streamId {
83 return [[RTCMediaStream alloc] initWithFactory:self 102 return [[RTCMediaStream alloc] initWithFactory:self
84 streamId:streamId]; 103 streamId:streamId];
85 } 104 }
86 105
87 - (RTCPeerConnection *)peerConnectionWithConfiguration: 106 - (RTCPeerConnection *)peerConnectionWithConfiguration:
88 (RTCConfiguration *)configuration 107 (RTCConfiguration *)configuration
89 constraints: 108 constraints:
90 (RTCMediaConstraints *)constraints 109 (RTCMediaConstraints *)constraints
91 delegate: 110 delegate:
92 (nullable id<RTCPeerConnectionDelegate>)delegate { 111 (nullable id<RTCPeerConnectionDelegate>)delegate {
93 return [[RTCPeerConnection alloc] initWithFactory:self 112 return [[RTCPeerConnection alloc] initWithFactory:self
94 configuration:configuration 113 configuration:configuration
95 constraints:constraints 114 constraints:constraints
96 delegate:delegate]; 115 delegate:delegate];
97 } 116 }
98 117
99 @end 118 @end
OLDNEW
« no previous file with comments | « webrtc/sdk/objc/Framework/Classes/RTCMediaSource+Private.h ('k') | webrtc/sdk/objc/Framework/Classes/RTCVideoSource.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698