blob: 46170a721baf1fb987aae480544662e708163c51 [file] [log] [blame]
Amit Hilbuchdd9390c2018-11-13 16:26:05 -08001/*
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 Anton10542f22019-01-11 09:11:00 -080011#ifndef PC_CHANNEL_INTERFACE_H_
12#define PC_CHANNEL_INTERFACE_H_
Amit Hilbuchdd9390c2018-11-13 16:26:05 -080013
14#include <string>
Amit Hilbuchbcd39d42019-01-25 17:13:56 -080015#include <vector>
Amit Hilbuchdd9390c2018-11-13 16:26:05 -080016
17#include "api/jsep.h"
Steve Anton10542f22019-01-11 09:11:00 -080018#include "api/media_types.h"
19#include "media/base/media_channel.h"
20#include "pc/rtp_transport_internal.h"
Amit Hilbuchdd9390c2018-11-13 16:26:05 -080021
22namespace cricket {
23
24class 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.
29class 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
Amit Hilbuchdd9390c2018-11-13 16:26:05 -080040 // Enables or disables this channel
Tommi1959f8f2021-04-26 10:20:19 +020041 virtual void Enable(bool enable) = 0;
Amit Hilbuchdd9390c2018-11-13 16:26:05 -080042
43 // Used for latency measurements.
44 virtual sigslot::signal1<ChannelInterface*>& SignalFirstPacketReceived() = 0;
45
46 // Channel control
47 virtual bool SetLocalContent(const MediaContentDescription* content,
48 webrtc::SdpType type,
49 std::string* error_desc) = 0;
50 virtual bool SetRemoteContent(const MediaContentDescription* content,
51 webrtc::SdpType type,
52 std::string* error_desc) = 0;
Taylor Brandstetterd0acbd82021-01-25 13:44:55 -080053 virtual bool SetPayloadTypeDemuxingEnabled(bool enabled) = 0;
Amit Hilbuchdd9390c2018-11-13 16:26:05 -080054
Amit Hilbuchbcd39d42019-01-25 17:13:56 -080055 // Access to the local and remote streams that were set on the channel.
56 virtual const std::vector<StreamParams>& local_streams() const = 0;
57 virtual const std::vector<StreamParams>& remote_streams() const = 0;
58
Amit Hilbuchdd9390c2018-11-13 16:26:05 -080059 // Set an RTP level transport.
60 // Some examples:
61 // * An RtpTransport without encryption.
62 // * An SrtpTransport for SDES.
63 // * A DtlsSrtpTransport for DTLS-SRTP.
64 virtual bool SetRtpTransport(webrtc::RtpTransportInternal* rtp_transport) = 0;
65
Markus Handell5932fe12020-12-17 22:19:40 +010066 // Returns the last negotiated header extensions.
67 virtual RtpHeaderExtensions GetNegotiatedRtpHeaderExtensions() const = 0;
68
Amit Hilbuchdd9390c2018-11-13 16:26:05 -080069 protected:
70 virtual ~ChannelInterface() = default;
71};
72
73} // namespace cricket
74
Steve Anton10542f22019-01-11 09:11:00 -080075#endif // PC_CHANNEL_INTERFACE_H_