RTCRtpTransceiver.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * Copyright 2018 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. #import <Foundation/Foundation.h>
  11. #import "RTCMacros.h"
  12. #import "RTCRtpReceiver.h"
  13. #import "RTCRtpSender.h"
  14. NS_ASSUME_NONNULL_BEGIN
  15. /** https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverdirection */
  16. typedef NS_ENUM(NSInteger, RTCRtpTransceiverDirection) {
  17. RTCRtpTransceiverDirectionSendRecv,
  18. RTCRtpTransceiverDirectionSendOnly,
  19. RTCRtpTransceiverDirectionRecvOnly,
  20. RTCRtpTransceiverDirectionInactive,
  21. RTCRtpTransceiverDirectionStopped
  22. };
  23. /** Structure for initializing an RTCRtpTransceiver in a call to
  24. * RTCPeerConnection.addTransceiver.
  25. * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiverinit
  26. */
  27. RTC_OBJC_EXPORT
  28. @interface RTC_OBJC_TYPE (RTCRtpTransceiverInit) : NSObject
  29. /** Direction of the RTCRtpTransceiver. See RTCRtpTransceiver.direction. */
  30. @property(nonatomic) RTCRtpTransceiverDirection direction;
  31. /** The added RTCRtpTransceiver will be added to these streams. */
  32. @property(nonatomic) NSArray<NSString *> *streamIds;
  33. /** TODO(bugs.webrtc.org/7600): Not implemented. */
  34. @property(nonatomic) NSArray<RTC_OBJC_TYPE(RTCRtpEncodingParameters) *> *sendEncodings;
  35. @end
  36. @class RTC_OBJC_TYPE(RTCRtpTransceiver);
  37. /** The RTCRtpTransceiver maps to the RTCRtpTransceiver defined by the
  38. * WebRTC specification. A transceiver represents a combination of an RTCRtpSender
  39. * and an RTCRtpReceiver that share a common mid. As defined in JSEP, an
  40. * RTCRtpTransceiver is said to be associated with a media description if its
  41. * mid property is non-nil; otherwise, it is said to be disassociated.
  42. * JSEP: https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24
  43. *
  44. * Note that RTCRtpTransceivers are only supported when using
  45. * RTCPeerConnection with Unified Plan SDP.
  46. *
  47. * WebRTC specification for RTCRtpTransceiver, the JavaScript analog:
  48. * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver
  49. */
  50. RTC_OBJC_EXPORT
  51. @protocol RTC_OBJC_TYPE
  52. (RTCRtpTransceiver)<NSObject>
  53. /** Media type of the transceiver. The sender and receiver will also have this
  54. * type.
  55. */
  56. @property(nonatomic, readonly) RTCRtpMediaType mediaType;
  57. /** The mid attribute is the mid negotiated and present in the local and
  58. * remote descriptions. Before negotiation is complete, the mid value may be
  59. * nil. After rollbacks, the value may change from a non-nil value to nil.
  60. * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-mid
  61. */
  62. @property(nonatomic, readonly) NSString *mid;
  63. /** The sender attribute exposes the RTCRtpSender corresponding to the RTP
  64. * media that may be sent with the transceiver's mid. The sender is always
  65. * present, regardless of the direction of media.
  66. * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-sender
  67. */
  68. @property(nonatomic, readonly) RTC_OBJC_TYPE(RTCRtpSender) * sender;
  69. /** The receiver attribute exposes the RTCRtpReceiver corresponding to the RTP
  70. * media that may be received with the transceiver's mid. The receiver is
  71. * always present, regardless of the direction of media.
  72. * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-receiver
  73. */
  74. @property(nonatomic, readonly) RTC_OBJC_TYPE(RTCRtpReceiver) * receiver;
  75. /** The isStopped attribute indicates that the sender of this transceiver will
  76. * no longer send, and that the receiver will no longer receive. It is true if
  77. * either stop has been called or if setting the local or remote description
  78. * has caused the RTCRtpTransceiver to be stopped.
  79. * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stopped
  80. */
  81. @property(nonatomic, readonly) BOOL isStopped;
  82. /** The direction attribute indicates the preferred direction of this
  83. * transceiver, which will be used in calls to createOffer and createAnswer.
  84. * An update of directionality does not take effect immediately. Instead,
  85. * future calls to createOffer and createAnswer mark the corresponding media
  86. * descriptions as sendrecv, sendonly, recvonly, or inactive.
  87. * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-direction
  88. */
  89. @property(nonatomic) RTCRtpTransceiverDirection direction;
  90. /** The currentDirection attribute indicates the current direction negotiated
  91. * for this transceiver. If this transceiver has never been represented in an
  92. * offer/answer exchange, or if the transceiver is stopped, the value is not
  93. * present and this method returns NO.
  94. * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection
  95. */
  96. - (BOOL)currentDirection:(RTCRtpTransceiverDirection *)currentDirectionOut;
  97. /** The stop method irreversibly stops the RTCRtpTransceiver. The sender of
  98. * this transceiver will no longer send, the receiver will no longer receive.
  99. * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop
  100. */
  101. - (void)stop;
  102. @end
  103. RTC_OBJC_EXPORT
  104. @interface RTC_OBJC_TYPE (RTCRtpTransceiver) : NSObject <RTC_OBJC_TYPE(RTCRtpTransceiver)>
  105. - (instancetype)init NS_UNAVAILABLE;
  106. @end
  107. NS_ASSUME_NONNULL_END