blob: 6c39a25310da5e9459b24835079e9c529c891b47 [file] [log] [blame]
Taylor Brandstetterdb0cd9e2016-05-16 11:40:30 -07001/*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#import <Foundation/Foundation.h>
12
13#import <WebRTC/RTCMacros.h>
14#import <WebRTC/RTCMediaStreamTrack.h>
15#import <WebRTC/RTCRtpParameters.h>
16
17NS_ASSUME_NONNULL_BEGIN
18
zhihuang4da058c2017-02-08 10:41:20 -080019/** Represents the media type of the RtpReceiver. */
20typedef NS_ENUM(NSInteger, RTCRtpMediaType) {
21 RTCRtpMediaTypeAudio,
22 RTCRtpMediaTypeVideo,
23 RTCRtpMediaTypeData,
24};
25
26@class RTCRtpReceiver;
27
28RTC_EXPORT
29@protocol RTCRtpReceiverDelegate <NSObject>
30
31/** Called when the first RTP packet is received.
32 *
33 * Note: Currently if there are multiple RtpReceivers of the same media type,
34 * they will all call OnFirstPacketReceived at once.
35 *
36 * For example, if we create three audio receivers, A/B/C, they will listen to
37 * the same signal from the underneath network layer. Whenever the first audio packet
38 * is received, the underneath signal will be fired. All the receivers A/B/C will be
39 * notified and the callback of the receiver's delegate will be called.
40 *
41 * The process is the same for video receivers.
42 */
43- (void)rtpReceiver:(RTCRtpReceiver *)rtpReceiver
44 didReceiveFirstPacketForMediaType:(RTCRtpMediaType)mediaType;
45
46@end
47
Taylor Brandstetterdb0cd9e2016-05-16 11:40:30 -070048RTC_EXPORT
49@protocol RTCRtpReceiver <NSObject>
50
51/** A unique identifier for this receiver. */
52@property(nonatomic, readonly) NSString *receiverId;
53
54/** The currently active RTCRtpParameters, as defined in
55 * https://www.w3.org/TR/webrtc/#idl-def-RTCRtpParameters.
56 *
57 * The WebRTC specification only defines RTCRtpParameters in terms of senders,
58 * but this API also applies them to receivers, similar to ORTC:
59 * http://ortc.org/wp-content/uploads/2016/03/ortc.html#rtcrtpparameters*.
60 */
61@property(nonatomic, readonly) RTCRtpParameters *parameters;
62
63/** The RTCMediaStreamTrack associated with the receiver.
64 * Note: reading this property returns a new instance of
65 * RTCMediaStreamTrack. Use isEqual: instead of == to compare
66 * RTCMediaStreamTrack instances.
67 */
68@property(nonatomic, readonly) RTCMediaStreamTrack *track;
69
zhihuang4da058c2017-02-08 10:41:20 -080070/** The delegate for this RtpReceiver. */
71@property(nonatomic, weak) id<RTCRtpReceiverDelegate> delegate;
72
Taylor Brandstetterdb0cd9e2016-05-16 11:40:30 -070073@end
74
75RTC_EXPORT
76@interface RTCRtpReceiver : NSObject <RTCRtpReceiver>
77
78- (instancetype)init NS_UNAVAILABLE;
79
80@end
81
82NS_ASSUME_NONNULL_END