| 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 | // This file contains interfaces for RtpSenders |
| 12 | // http://w3c.github.io/webrtc-pc/#rtcrtpsender-interface |
| 13 |
| 14 | #ifndef API_RTP_SENDER_INTERFACE_H_ |
| 15 | #define API_RTP_SENDER_INTERFACE_H_ |
| 16 |
| 17 | #include <string> |
| 18 | #include <vector> |
| 19 |
| 20 | #include "api/crypto/frame_encryptor_interface.h" |
| 21 | #include "api/dtls_transport_interface.h" |
| 22 | #include "api/dtmf_sender_interface.h" |
| 23 | #include "api/frame_transformer_interface.h" |
| 24 | #include "api/media_stream_interface.h" |
| 25 | #include "api/media_types.h" |
| 26 | #include "api/rtc_error.h" |
| 27 | #include "api/rtp_parameters.h" |
| 28 | #include "api/scoped_refptr.h" |
| 29 | #include "rtc_base/ref_count.h" |
| 30 | #include "rtc_base/system/rtc_export.h" |
| 31 |
| 32 | namespace webrtc { |
| 33 |
| 34 | class RTC_EXPORT RtpSenderInterface : public rtc::RefCountInterface { |
| 35 | public: |
| 36 | // Returns true if successful in setting the track. |
| 37 | // Fails if an audio track is set on a video RtpSender, or vice-versa. |
| 38 | virtual bool SetTrack(MediaStreamTrackInterface* track) = 0; |
| 39 | virtual rtc::scoped_refptr<MediaStreamTrackInterface> track() const = 0; |
| 40 |
| 41 | // The dtlsTransport attribute exposes the DTLS transport on which the |
| 42 | // media is sent. It may be null. |
| 43 | // https://w3c.github.io/webrtc-pc/#dom-rtcrtpsender-transport |
| 44 | // TODO(https://bugs.webrtc.org/907849) remove default implementation |
| 45 | virtual rtc::scoped_refptr<DtlsTransportInterface> dtls_transport() const; |
| 46 |
| 47 | // Returns primary SSRC used by this sender for sending media. |
| 48 | // Returns 0 if not yet determined. |
| 49 | // TODO(deadbeef): Change to absl::optional. |
| 50 | // TODO(deadbeef): Remove? With GetParameters this should be redundant. |
| 51 | virtual uint32_t ssrc() const = 0; |
| 52 |
| 53 | // Audio or video sender? |
| 54 | virtual cricket::MediaType media_type() const = 0; |
| 55 |
| 56 | // Not to be confused with "mid", this is a field we can temporarily use |
| 57 | // to uniquely identify a receiver until we implement Unified Plan SDP. |
| 58 | virtual std::string id() const = 0; |
| 59 |
| 60 | // Returns a list of media stream ids associated with this sender's track. |
| 61 | // These are signalled in the SDP so that the remote side can associate |
| 62 | // tracks. |
| 63 | virtual std::vector<std::string> stream_ids() const = 0; |
| 64 |
| 65 | // Sets the IDs of the media streams associated with this sender's track. |
| 66 | // These are signalled in the SDP so that the remote side can associate |
| 67 | // tracks. |
| 68 | virtual void SetStreams(const std::vector<std::string>& stream_ids) {} |
| 69 |
| 70 | // Returns the list of encoding parameters that will be applied when the SDP |
| 71 | // local description is set. These initial encoding parameters can be set by |
| 72 | // PeerConnection::AddTransceiver, and later updated with Get/SetParameters. |
| 73 | // TODO(orphis): Make it pure virtual once Chrome has updated |
| 74 | virtual std::vector<RtpEncodingParameters> init_send_encodings() const; |
| 75 |
| 76 | virtual RtpParameters GetParameters() const = 0; |
| 77 | // Note that only a subset of the parameters can currently be changed. See |
| 78 | // rtpparameters.h |
| 79 | // The encodings are in increasing quality order for simulcast. |
| 80 | virtual RTCError SetParameters(const RtpParameters& parameters) = 0; |
| 81 |
| 82 | // Returns null for a video sender. |
| 83 | virtual rtc::scoped_refptr<DtmfSenderInterface> GetDtmfSender() const = 0; |
| 84 |
| 85 | // Sets a user defined frame encryptor that will encrypt the entire frame |
| 86 | // before it is sent across the network. This will encrypt the entire frame |
| 87 | // using the user provided encryption mechanism regardless of whether SRTP is |
| 88 | // enabled or not. |
| 89 | virtual void SetFrameEncryptor( |
| 90 | rtc::scoped_refptr<FrameEncryptorInterface> frame_encryptor); |
| 91 |
| 92 | // Returns a pointer to the frame encryptor set previously by the |
| 93 | // user. This can be used to update the state of the object. |
| 94 | virtual rtc::scoped_refptr<FrameEncryptorInterface> GetFrameEncryptor() const; |
| 95 |
| 96 | virtual void SetEncoderToPacketizerFrameTransformer( |
| 97 | rtc::scoped_refptr<FrameTransformerInterface> frame_transformer); |
| 98 |
| 99 | protected: |
| 100 | ~RtpSenderInterface() override = default; |
| 101 | }; |
| 102 |
| 103 | } // namespace webrtc |
| 104 |
| 105 | #endif // API_RTP_SENDER_INTERFACE_H_ |
| 106 |