Bug 1848242 - Mark basic.any.html subtest as intermittent. a=test-only
[gecko.git] / third_party / libwebrtc / pc / channel_interface.h
blob7495ad8931bfb508cb6d8b7fda2a2b056f64490d
1 /*
2 * Copyright 2018 The WebRTC project authors. All Rights Reserved.
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 */
11 #ifndef PC_CHANNEL_INTERFACE_H_
12 #define PC_CHANNEL_INTERFACE_H_
14 #include <memory>
15 #include <string>
16 #include <vector>
18 #include "absl/strings/string_view.h"
19 #include "api/jsep.h"
20 #include "api/media_types.h"
21 #include "media/base/media_channel.h"
22 #include "pc/rtp_transport_internal.h"
24 namespace webrtc {
25 class Call;
26 class VideoBitrateAllocatorFactory;
27 } // namespace webrtc
29 namespace cricket {
31 class MediaChannel;
32 class VoiceChannel;
33 class VideoChannel;
34 class MediaContentDescription;
35 struct MediaConfig;
37 // A Channel is a construct that groups media streams of the same type
38 // (audio or video), both outgoing and incoming.
39 // When the PeerConnection API is used, a Channel corresponds one to one
40 // to an RtpTransceiver.
41 // When Unified Plan is used, there can only be at most one outgoing and
42 // one incoming stream. With Plan B, there can be more than one.
44 // ChannelInterface contains methods common to voice and video channels.
45 // As more methods are added to BaseChannel, they should be included in the
46 // interface as well.
47 // TODO(bugs.webrtc.org/13931): Merge this class into RtpTransceiver.
48 class ChannelInterface {
49 public:
50 virtual ~ChannelInterface() = default;
51 virtual cricket::MediaType media_type() const = 0;
53 virtual VideoChannel* AsVideoChannel() = 0;
54 virtual VoiceChannel* AsVoiceChannel() = 0;
56 virtual MediaSendChannelInterface* media_send_channel() = 0;
57 // Typecasts of media_channel(). Will cause an exception if the
58 // channel is of the wrong type.
59 virtual VideoMediaSendChannelInterface* video_media_send_channel() = 0;
60 virtual VoiceMediaSendChannelInterface* voice_media_send_channel() = 0;
61 virtual MediaReceiveChannelInterface* media_receive_channel() = 0;
62 // Typecasts of media_channel(). Will cause an exception if the
63 // channel is of the wrong type.
64 virtual VideoMediaReceiveChannelInterface* video_media_receive_channel() = 0;
65 virtual VoiceMediaReceiveChannelInterface* voice_media_receive_channel() = 0;
67 // Returns a string view for the transport name. Fetching the transport name
68 // must be done on the network thread only and note that the lifetime of
69 // the returned object should be assumed to only be the calling scope.
70 // TODO(deadbeef): This is redundant; remove this.
71 virtual absl::string_view transport_name() const = 0;
73 // TODO(tommi): Change return type to string_view.
74 virtual const std::string& mid() const = 0;
76 // Enables or disables this channel
77 virtual void Enable(bool enable) = 0;
79 // Used for latency measurements.
80 virtual void SetFirstPacketReceivedCallback(
81 std::function<void()> callback) = 0;
83 // Channel control
84 virtual bool SetLocalContent(const MediaContentDescription* content,
85 webrtc::SdpType type,
86 std::string& error_desc) = 0;
87 virtual bool SetRemoteContent(const MediaContentDescription* content,
88 webrtc::SdpType type,
89 std::string& error_desc) = 0;
90 virtual bool SetPayloadTypeDemuxingEnabled(bool enabled) = 0;
92 // Access to the local and remote streams that were set on the channel.
93 virtual const std::vector<StreamParams>& local_streams() const = 0;
94 virtual const std::vector<StreamParams>& remote_streams() const = 0;
96 // Set an RTP level transport.
97 // Some examples:
98 // * An RtpTransport without encryption.
99 // * An SrtpTransport for SDES.
100 // * A DtlsSrtpTransport for DTLS-SRTP.
101 virtual bool SetRtpTransport(webrtc::RtpTransportInternal* rtp_transport) = 0;
104 } // namespace cricket
106 #endif // PC_CHANNEL_INTERFACE_H_