Amit Hilbuch | dd9390c | 2018-11-13 16:26:05 -0800 | [diff] [blame] | 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 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #ifndef PC_CHANNEL_INTERFACE_H_ |
| 12 | #define PC_CHANNEL_INTERFACE_H_ |
Amit Hilbuch | dd9390c | 2018-11-13 16:26:05 -0800 | [diff] [blame] | 13 | |
| 14 | #include <string> |
Amit Hilbuch | bcd39d4 | 2019-01-25 17:13:56 -0800 | [diff] [blame] | 15 | #include <vector> |
Amit Hilbuch | dd9390c | 2018-11-13 16:26:05 -0800 | [diff] [blame] | 16 | |
| 17 | #include "api/jsep.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 18 | #include "api/media_types.h" |
| 19 | #include "media/base/media_channel.h" |
| 20 | #include "pc/rtp_transport_internal.h" |
Amit Hilbuch | dd9390c | 2018-11-13 16:26:05 -0800 | [diff] [blame] | 21 | |
| 22 | namespace cricket { |
| 23 | |
| 24 | class MediaContentDescription; |
| 25 | |
| 26 | // ChannelInterface contains methods common to voice, video and data channels. |
| 27 | // As more methods are added to BaseChannel, they should be included in the |
| 28 | // interface as well. |
| 29 | class ChannelInterface { |
| 30 | public: |
| 31 | virtual cricket::MediaType media_type() const = 0; |
| 32 | |
| 33 | virtual MediaChannel* media_channel() const = 0; |
| 34 | |
| 35 | // TODO(deadbeef): This is redundant; remove this. |
| 36 | virtual const std::string& transport_name() const = 0; |
| 37 | |
| 38 | virtual const std::string& content_name() const = 0; |
| 39 | |
| 40 | virtual bool enabled() const = 0; |
| 41 | |
| 42 | // Enables or disables this channel |
| 43 | virtual bool Enable(bool enable) = 0; |
| 44 | |
| 45 | // Used for latency measurements. |
| 46 | virtual sigslot::signal1<ChannelInterface*>& SignalFirstPacketReceived() = 0; |
| 47 | |
| 48 | // Channel control |
| 49 | virtual bool SetLocalContent(const MediaContentDescription* content, |
| 50 | webrtc::SdpType type, |
| 51 | std::string* error_desc) = 0; |
| 52 | virtual bool SetRemoteContent(const MediaContentDescription* content, |
| 53 | webrtc::SdpType type, |
| 54 | std::string* error_desc) = 0; |
| 55 | |
Amit Hilbuch | bcd39d4 | 2019-01-25 17:13:56 -0800 | [diff] [blame] | 56 | // Access to the local and remote streams that were set on the channel. |
| 57 | virtual const std::vector<StreamParams>& local_streams() const = 0; |
| 58 | virtual const std::vector<StreamParams>& remote_streams() const = 0; |
| 59 | |
Amit Hilbuch | dd9390c | 2018-11-13 16:26:05 -0800 | [diff] [blame] | 60 | // Set an RTP level transport. |
| 61 | // Some examples: |
| 62 | // * An RtpTransport without encryption. |
| 63 | // * An SrtpTransport for SDES. |
| 64 | // * A DtlsSrtpTransport for DTLS-SRTP. |
| 65 | virtual bool SetRtpTransport(webrtc::RtpTransportInternal* rtp_transport) = 0; |
| 66 | |
| 67 | protected: |
| 68 | virtual ~ChannelInterface() = default; |
| 69 | }; |
| 70 | |
| 71 | } // namespace cricket |
| 72 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 73 | #endif // PC_CHANNEL_INTERFACE_H_ |