blob: 902347995be0cb1c40cc6c226bc8fd12f2f805e5 [file] [log] [blame]
Anders Carlsson7bca8ca2018-08-30 09:30:29 +02001/*
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 "RTCMacros.h"
14#import "RTCMediaStreamTrack.h"
15#import "RTCRtpParameters.h"
16
17NS_ASSUME_NONNULL_BEGIN
18
19/** 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
48RTC_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, nullable) RTCMediaStreamTrack *track;
69
70/** The delegate for this RtpReceiver. */
71@property(nonatomic, weak) id<RTCRtpReceiverDelegate> delegate;
72
73@end
74
75RTC_EXPORT
76@interface RTCRtpReceiver : NSObject <RTCRtpReceiver>
77
78- (instancetype)init NS_UNAVAILABLE;
79
80@end
81
82NS_ASSUME_NONNULL_END