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