DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Implementation

Mercurial (882de07e4cbe)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */


#ifndef MEDIAENGINEWEBRTC_H_
#define MEDIAENGINEWEBRTC_H_

#include "AudioDeviceInfo.h"
#include "CamerasChild.h"
#include "CamerasChild.h"
#include "CubebUtils.h"
#include "DOMMediaStream.h"
#include "MediaEngine.h"
#include "MediaEnginePrefs.h"
#include "MediaEngineSource.h"
#include "MediaEngineSource.h"
#include "MediaEngineWrapper.h"
#include "MediaTrackGraph.h"
#include "NullTransport.h"
#include "VideoSegment.h"
#include "VideoUtils.h"
#include "VideoUtils.h"
#include "CubebDeviceEnumerator.h"
#include "ipc/IPCMessageUtils.h"
#include "mozilla/Mutex.h"
#include "mozilla/Mutex.h"
#include "mozilla/Mutex.h"
#include "mozilla/Sprintf.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/StaticMutex.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/MediaStreamTrackBinding.h"
#include "nsCOMPtr.h"
#include "nsComponentManagerUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsDirectoryServiceDefs.h"
#include "nsRefPtrHashtable.h"
#include "nsThreadUtils.h"
#include "prcvar.h"
#include "prthread.h"
#include "prthread.h"

// WebRTC library includes follow
// Video Engine
// conflicts with #include of scoped_ptr.h
#undef FF
#undef FF
#include "webrtc/modules/video_capture/video_capture_defines.h"

namespace mozilla {

class MediaEngineWebRTC : public MediaEngine {
class MediaEngineWebRTC : public MediaEngine {
  typedef MediaEngine Super;

 public:
 public:
  explicit MediaEngineWebRTC(MediaEnginePrefs& aPrefs);
  explicit MediaEngineWebRTC(MediaEnginePrefs& aPrefs);

  // Enable periodic fake "devicechange" event. Must always be called from the
  // same thread, and must be disabled before shutdown.
  // same thread, and must be disabled before shutdown.
  void SetFakeDeviceChangeEventsEnabled(bool aEnable) override;

  // Clients should ensure to clean-up sources video/audio sources
  // before invoking Shutdown on this class.
  void Shutdown() override;
  void Shutdown() override;

  // Returns whether the host supports duplex audio track.
  bool SupportsDuplex();

  void EnumerateDevices(uint64_t aWindowId, dom::MediaSourceEnum, MediaSinkEnum,
  void EnumerateDevices(uint64_t aWindowId, dom::MediaSourceEnum, MediaSinkEnum,
                        nsTArray<RefPtr<MediaDevice>>*) override;

  MediaEventSource<void>& DeviceListChangeEvent() override {
    return mDeviceListChangeEvent;
  }
  }

 private:
  ~MediaEngineWebRTC() = default;
  void EnumerateVideoDevices(uint64_t aWindowId,
                             camera::CaptureEngine aCapEngine,
                             camera::CaptureEngine aCapEngine,
                             nsTArray<RefPtr<MediaDevice>>*);
  void EnumerateMicrophoneDevices(uint64_t aWindowId,
                                  nsTArray<RefPtr<MediaDevice>>*);
  void EnumerateSpeakerDevices(uint64_t aWindowId,
                               nsTArray<RefPtr<MediaDevice>>*);
                               nsTArray<RefPtr<MediaDevice>>*);

  void DeviceListChanged() { mDeviceListChangeEvent.Notify(); }

  static void FakeDeviceChangeEventTimerTick(nsITimer* aTimer, void* aClosure);


  const bool mDelayAgnostic;
  const bool mExtendedFilter;
  // This also is set in the ctor and then never changed, but we can't make it
  // const because we pass it to a function that takes bool* in the ctor.
  bool mHasTabVideoSource;
  MediaEventListener mCameraListChangeListener;
  MediaEventListener mMicrophoneListChangeListener;
  MediaEventListener mMicrophoneListChangeListener;
  MediaEventListener mSpeakerListChangeListener;
  MediaEventProducer<void> mDeviceListChangeEvent;
  nsCOMPtr<nsITimer> mFakeDeviceChangeEventTimer;
};


}  // namespace mozilla

#endif /* NSMEDIAENGINEWEBRTC_H_ */