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

Unified Diff: webrtc/api/objc/RTCPeerConnection.h

Issue 1640993002: Update API for Objective-C RTCPeerConnection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changes based on feedback Created 4 years, 11 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/api/objc/RTCPeerConnection.h
diff --git a/webrtc/api/objc/RTCPeerConnection.h b/webrtc/api/objc/RTCPeerConnection.h
new file mode 100644
index 0000000000000000000000000000000000000000..733a86779848cae07ecef407a6a4d382721400a9
--- /dev/null
+++ b/webrtc/api/objc/RTCPeerConnection.h
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#import <Foundation/Foundation.h>
+
+#import "webrtc/api/objc/RTCPeerConnection.h"
tkchin_webrtc 2016/02/05 16:15:16 ? :)
hjon_webrtc 2016/02/09 00:59:53 Oops. Fixed. :-)
+
+@class RTCConfiguration;
+@class RTCDataChannel;
+@class RTCDataChannelConfiguration;
+@class RTCIceCandidate;
+@class RTCMediaConstraints;
+@class RTCMediaStream;
+@class RTCMediaStreamTrack;
+@class RTCPeerConnectionFactory;
+@class RTCSessionDescription;
+@class RTCStatsReport;
+
+extern NSString * _Nonnull const kRTCPeerConnectionErrorDomain;
tkchin_webrtc 2016/02/05 16:15:16 don't need _Nonnull here?
hjon_webrtc 2016/02/09 00:59:54 I didn't expect so, but I got this error without i
tkchin_webrtc 2016/02/10 18:54:40 Yeah just move the NONNULL_BEGIN up
hjon_webrtc 2016/02/11 00:25:07 Done.
+extern int const kRTCSessionDescriptionErrorCode;
+
+/** Represents the signaling state of the peer connection. */
+typedef NS_ENUM(NSInteger, RTCSignalingState) {
+ RTCSignalingStateStable,
+ RTCSignalingStateHaveLocalOffer,
+ RTCSignalingStateHaveLocalPrAnswer,
+ RTCSignalingStateHaveRemoteOffer,
+ RTCSignalingStateHaveRemotePrAnswer,
+ RTCSignalingStateClosed,
+};
+
+/** Represents the ice connection state of the peer connection. */
+typedef NS_ENUM(NSInteger, RTCIceConnectionState) {
+ RTCIceConnectionStateNew,
+ RTCIceConnectionStateChecking,
+ RTCIceConnectionStateConnected,
+ RTCIceConnectionStateCompleted,
+ RTCIceConnectionStateFailed,
+ RTCIceConnectionStateDisconnected,
+ RTCIceConnectionStateClosed,
+ RTCIceConnectionStateMax,
+};
+
+/** Represents the ice gathering state of the peer connection. */
+typedef NS_ENUM(NSInteger, RTCIceGatheringState) {
+ RTCIceGatheringStateNew,
+ RTCIceGatheringStateGathering,
+ RTCIceGatheringStateComplete,
+};
+
+/** Represents the stats output level. */
+typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) {
+ RTCStatsOutputLevelStandard,
+ RTCStatsOutputLevelDebug,
+};
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class RTCPeerConnection;
+
+@protocol RTCPeerConnectionDelegate <NSObject>
+
+/** Called when the SignalingState changed. */
+- (void)peerConnection:(RTCPeerConnection *)peerConnection
+ signalingStateChanged:(RTCSignalingState)stateChanged;
tkchin_webrtc 2016/02/05 16:15:16 didChangeSignalingState
hjon_webrtc 2016/02/09 00:59:53 Done.
+
+/** Triggered when media is received on a new stream from remote peer. */
tkchin_webrtc 2016/02/05 16:15:15 ditto nit triggered
hjon_webrtc 2016/02/09 00:59:54 Done.
+- (void)peerConnection:(RTCPeerConnection *)peerConnection
+ addedStream:(RTCMediaStream *)stream;
+
+/** Triggered when a remote peer closes a stream. */
+- (void)peerConnection:(RTCPeerConnection *)peerConnection
+ removedStream:(RTCMediaStream *)stream;
+
+/** Triggered when renegotiation is needed, for example ICE has restarted. */
+- (void)peerConnectionNeedsRenegotiation:(RTCPeerConnection *)peerConnection;
tkchin_webrtc 2016/02/05 16:15:15 peerConnectionShouldNegotiate I don't think it's
hjon_webrtc 2016/02/09 00:59:53 You're right; the spec says negotiation, not reneg
+
+/** Called any time the IceConnectionState changes. */
+- (void)peerConnection:(RTCPeerConnection *)peerConnection
+ iceConnectionStateChanged:(RTCIceConnectionState)newState;
tkchin_webrtc 2016/02/05 16:15:16 didChangeIceConnectionState
hjon_webrtc 2016/02/09 00:59:53 Done.
+
+/** Called any time the IceGatheringState changes. */
+- (void)peerConnection:(RTCPeerConnection *)peerConnection
+ iceGatheringStateChanged:(RTCIceGatheringState)newState;
tkchin_webrtc 2016/02/05 16:15:15 didChangeIceGatheringState
hjon_webrtc 2016/02/09 00:59:54 Done.
+
+/** New ice candidate has been found. */
+- (void)peerConnection:(RTCPeerConnection *)peerConnection
+ receivedIceCandidate:(RTCIceCandidate *)candidate;
tkchin_webrtc 2016/02/05 16:15:16 didGenerateIceCandidate
hjon_webrtc 2016/02/09 00:59:54 Done.
+
+/** New data channel has been opened. */
+- (void)peerConnection:(RTCPeerConnection *)peerConnection
+ didOpenDataChannel:(RTCDataChannel *)dataChannel;
+
+@end
+
+
+@interface RTCPeerConnection : NSObject
+
+/**
+ * The object that will be notifed about events such as state changes and
+ * streams being added or removed.
+ */
+@property(nonatomic, weak) id<RTCPeerConnectionDelegate> delegate;
+
+/** The pending or current remote description. */
+@property(nonatomic, readonly) NSArray *localStreams;
+
+/** The pending or current local description. */
tkchin_webrtc 2016/02/05 16:15:16 ? Not pending I think.
hjon_webrtc 2016/02/09 00:59:54 The spec mentions pending, but I'm not seeing an o
+@property(nonatomic, readonly, nullable)
+ RTCSessionDescription *localDescription;
+
+/** The pending or current remote description. */
+@property(nonatomic, readonly, nullable)
+ RTCSessionDescription *remoteDescription;
+
+/** The signaling state of this RTCPeerConnection instance. */
+@property(nonatomic, readonly) RTCSignalingState signalingState;
+
+/** The ICE connection state of this RTCPeerConnection instance. */
+@property(nonatomic, readonly) RTCIceConnectionState iceConnectionState;
+
+/** The ICE gathering state of this RTCPeerConnection instance. */
+@property(nonatomic, readonly) RTCIceGatheringState iceGatheringState;
+
+- (instancetype)init NS_UNAVAILABLE;
+
+/**
+ * Initialize an RTCPeerConnection with a configuration, constraints, and
+ * delegate.
+ */
+- (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory
+ configuration:(RTCConfiguration *)configuration
+ constraints:(RTCMediaConstraints *)constraints
+ delegate:(id<RTCPeerConnectionDelegate>)delegate
+ NS_DESIGNATED_INITIALIZER;
+
+/** Terminate all media and close the transport. */
+- (void)close;
+
+/** Provide a remote candidate to the ICE Agent. */
+- (void)addIceCandidate:(RTCIceCandidate *)candidate;
+
+/** Add a new media stream to be sent on this peer connection. */
+- (void)addStream:(RTCMediaStream *)stream;
+
+/** Remove the given media stream from this peer connection. */
+- (void)removeStream:(RTCMediaStream *)stream;
+
+/** Create a new data channel with the given label and configuration. */
+- (RTCDataChannel *)dataChannelWithLabel:(NSString *)label
tkchin_webrtc 2016/02/05 16:15:15 If possible, move this to a category below. Corres
hjon_webrtc 2016/02/09 00:59:53 Done.
+ configuration:(RTCDataChannelConfiguration *)configuration;
+
+/** Generate an SDP offer. */
+- (void)offerWithConstraints:(RTCMediaConstraints *)constraints
tkchin_webrtc 2016/02/05 16:15:16 nit: offerForConstraints / answerForConstraints
hjon_webrtc 2016/02/09 00:59:54 Done.
+ completionHandler:(void (^)
+ (RTCSessionDescription *sessionDescription, NSError *error))completionHandler;
+
+/** Generate an SDP answer. */
+- (void)answerWithConstraints:(RTCMediaConstraints *)constraints
+ completionHandler:(void (^)
+ (RTCSessionDescription *sessionDescription, NSError *error))completionHandler;
+
+/** Apply the supplied RTCSessionDescription as the local description. */
+- (void)setLocalDescription:(RTCSessionDescription *)sdp
+ completionHandler:(void (^)(NSError *error))completionHandler;
+
+/** Apply the supplied RTCSessionDescription as the remote description. */
+- (void)setRemoteDescription:(RTCSessionDescription *)sdp
+ completionHandler:(void (^)(NSError *error))completionHandler;
+
+/**
+ * Gather stats for the given RTCMediaStreamTrack. If |mediaStreamTrack| is nil
+ * statistics are gathered for all tracks.
+ */
+- (void)statsForMediaStreamTrack:
+ (nullable RTCMediaStreamTrack *)mediaStreamTrack
+ statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel
+ completionHandler:
+ (void (^)(NSArray<RTCStatsReport *> *stats))completionHandler;
+
+@end
+
+NS_ASSUME_NONNULL_END

Powered by Google App Engine
This is Rietveld 408576698