channel_interface.h 2.5 KB

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