tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

MediaConduitControl.h (3429B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
      5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef DOM_MEDIA_WEBRTC_LIBWEBRTCGLUE_MEDIACONDUITCONTROL_H_
      8 #define DOM_MEDIA_WEBRTC_LIBWEBRTCGLUE_MEDIACONDUITCONTROL_H_
      9 
     10 #include <string>
     11 #include <vector>
     12 
     13 #include "CodecConfig.h"  // For Audio/VideoCodecConfig
     14 #include "FrameTransformerProxy.h"
     15 #include "RtpRtcpConfig.h"
     16 #include "api/rtp_parameters.h"            // For webrtc::RtpExtension
     17 #include "api/video_codecs/video_codec.h"  // For webrtc::VideoCodecMode
     18 #include "jsapi/RTCDTMFSender.h"           // For DtmfEvent
     19 #include "mozilla/Maybe.h"
     20 #include "mozilla/StateMirroring.h"
     21 #include "mozilla/dom/RTCRtpParametersBinding.h"
     22 
     23 namespace mozilla {
     24 
     25 using RtpExtList = std::vector<webrtc::RtpExtension>;
     26 using Ssrc = uint32_t;
     27 using Ssrcs = std::vector<uint32_t>;
     28 
     29 /**
     30 * These are the interfaces used to control the async conduits. Some parameters
     31 * are common, and some are tied to the conduit type. See
     32 * MediaSessionConduit::InitConduitControl for how they are used.
     33 *
     34 * Put simply, the implementer of the interfaces below may set its canonicals on
     35 * any thread, and the conduits will react to those changes accordingly, on
     36 * their dedicated worker thread. One instance of these interfaces could control
     37 * multiple conduits as each canonical can connect to any number of mirrors.
     38 */
     39 
     40 class MediaConduitControlInterface {
     41 public:
     42  virtual Canonical<bool>& CanonicalReceiving() = 0;
     43  virtual Canonical<bool>& CanonicalTransmitting() = 0;
     44  virtual Canonical<Ssrcs>& CanonicalLocalSsrcs() = 0;
     45  virtual Canonical<std::string>& CanonicalLocalCname() = 0;
     46  virtual Canonical<std::string>& CanonicalMid() = 0;
     47  virtual Canonical<Ssrc>& CanonicalRemoteSsrc() = 0;
     48  virtual Canonical<std::string>& CanonicalSyncGroup() = 0;
     49  virtual Canonical<RtpExtList>& CanonicalLocalRecvRtpExtensions() = 0;
     50  virtual Canonical<RtpExtList>& CanonicalLocalSendRtpExtensions() = 0;
     51  virtual Canonical<RefPtr<FrameTransformerProxy>>&
     52  CanonicalFrameTransformerProxySend() = 0;
     53  virtual Canonical<RefPtr<FrameTransformerProxy>>&
     54  CanonicalFrameTransformerProxyRecv() = 0;
     55 };
     56 
     57 class AudioConduitControlInterface : public MediaConduitControlInterface {
     58 public:
     59  virtual Canonical<Maybe<AudioCodecConfig>>& CanonicalAudioSendCodec() = 0;
     60  virtual Canonical<std::vector<AudioCodecConfig>>&
     61  CanonicalAudioRecvCodecs() = 0;
     62  virtual MediaEventSource<DtmfEvent>& OnDtmfEvent() = 0;
     63 };
     64 
     65 class VideoConduitControlInterface : public MediaConduitControlInterface {
     66 public:
     67  virtual Canonical<Ssrcs>& CanonicalLocalVideoRtxSsrcs() = 0;
     68  virtual Canonical<Ssrc>& CanonicalRemoteVideoRtxSsrc() = 0;
     69  virtual Canonical<Maybe<VideoCodecConfig>>& CanonicalVideoSendCodec() = 0;
     70  virtual Canonical<Maybe<RtpRtcpConfig>>&
     71  CanonicalVideoSendRtpRtcpConfig() = 0;
     72  virtual Canonical<std::vector<VideoCodecConfig>>&
     73  CanonicalVideoRecvCodecs() = 0;
     74  virtual Canonical<Maybe<RtpRtcpConfig>>&
     75  CanonicalVideoRecvRtpRtcpConfig() = 0;
     76  virtual Canonical<webrtc::VideoCodecMode>& CanonicalVideoCodecMode() = 0;
     77  virtual Canonical<webrtc::DegradationPreference>&
     78  CanonicalVideoDegradationPreference() = 0;
     79 };
     80 
     81 }  // namespace mozilla
     82 
     83 #endif