| 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 classes that implement RtpReceiverInterface. |
| 12 | // An RtpReceiver associates a MediaStreamTrackInterface with an underlying |
| 13 | // transport (provided by cricket::VoiceChannel/cricket::VideoChannel) |
| 14 |
| 15 | #ifndef PC_RTP_RECEIVER_H_ |
| 16 | #define PC_RTP_RECEIVER_H_ |
| 17 |
| 18 | #include <stdint.h> |
| 19 |
| 20 | #include <string> |
| 21 | #include <vector> |
| 22 |
| 23 | #include "absl/types/optional.h" |
| 24 | #include "api/crypto/frame_decryptor_interface.h" |
| 25 | #include "api/dtls_transport_interface.h" |
| 26 | #include "api/media_stream_interface.h" |
| 27 | #include "api/media_types.h" |
| 28 | #include "api/rtp_parameters.h" |
| 29 | #include "api/rtp_receiver_interface.h" |
| 30 | #include "api/scoped_refptr.h" |
| 31 | #include "api/video/video_frame.h" |
| 32 | #include "api/video/video_sink_interface.h" |
| 33 | #include "api/video/video_source_interface.h" |
| 34 | #include "media/base/media_channel.h" |
| 35 | #include "media/base/video_broadcaster.h" |
| 36 | #include "pc/video_track_source.h" |
| 37 | #include "rtc_base/ref_counted_object.h" |
| 38 | #include "rtc_base/thread.h" |
| 39 |
| 40 | namespace webrtc { |
| 41 |
| 42 | // Internal class used by PeerConnection. |
| 43 | class RtpReceiverInternal : public RtpReceiverInterface { |
| 44 | public: |
| 45 | // Stops receiving. The track may be reactivated. |
| 46 | virtual void Stop() = 0; |
| 47 | // Stops the receiver permanently. |
| 48 | // Causes the associated track to enter kEnded state. Cannot be reversed. |
| 49 | virtual void StopAndEndTrack() = 0; |
| 50 |
| 51 | // Sets the underlying MediaEngine channel associated with this RtpSender. |
| 52 | // A VoiceMediaChannel should be used for audio RtpSenders and |
| 53 | // a VideoMediaChannel should be used for video RtpSenders. |
| 54 | // Must call SetMediaChannel(nullptr) before the media channel is destroyed. |
| 55 | virtual void SetMediaChannel(cricket::MediaChannel* media_channel) = 0; |
| 56 |
| 57 | // Configures the RtpReceiver with the underlying media channel, with the |
| 58 | // given SSRC as the stream identifier. |
| 59 | virtual void SetupMediaChannel(uint32_t ssrc) = 0; |
| 60 |
| 61 | // Configures the RtpReceiver with the underlying media channel to receive an |
| 62 | // unsignaled receive stream. |
| 63 | virtual void SetupUnsignaledMediaChannel() = 0; |
| 64 |
| 65 | virtual void set_transport( |
| 66 | rtc::scoped_refptr<DtlsTransportInterface> dtls_transport) = 0; |
| 67 | // This SSRC is used as an identifier for the receiver between the API layer |
| 68 | // and the WebRtcVideoEngine, WebRtcVoiceEngine layer. |
| 69 | virtual uint32_t ssrc() const = 0; |
| 70 |
| 71 | // Call this to notify the RtpReceiver when the first packet has been received |
| 72 | // on the corresponding channel. |
| 73 | virtual void NotifyFirstPacketReceived() = 0; |
| 74 |
| 75 | // Set the associated remote media streams for this receiver. The remote track |
| 76 | // will be removed from any streams that are no longer present and added to |
| 77 | // any new streams. |
| 78 | virtual void set_stream_ids(std::vector<std::string> stream_ids) = 0; |
| 79 | // TODO(https://crbug.com/webrtc/9480): Remove SetStreams() in favor of |
| 80 | // set_stream_ids() as soon as downstream projects are no longer dependent on |
| 81 | // stream objects. |
| 82 | virtual void SetStreams( |
| 83 | const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& streams) = 0; |
| 84 |
| 85 | // Returns an ID that changes if the attached track changes, but |
| 86 | // otherwise remains constant. Used to generate IDs for stats. |
| 87 | // The special value zero means that no track is attached. |
| 88 | virtual int AttachmentId() const = 0; |
| 89 |
| 90 | protected: |
| 91 | static int GenerateUniqueId(); |
| 92 |
| 93 | static std::vector<rtc::scoped_refptr<MediaStreamInterface>> |
| 94 | CreateStreamsFromIds(std::vector<std::string> stream_ids); |
| 95 | }; |
| 96 |
| 97 | } // namespace webrtc |
| 98 |
| 99 | #endif // PC_RTP_RECEIVER_H_ |
| 100 |