Backed out 3 changesets (bug 1876526) for causing crashes due to CubebDeviceEnumerato...
[gecko.git] / dom / media / webrtc / MediaEngine.h
blobd3e1ece45264cd3e9658a9b20e97061dbc6c2383
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef MEDIAENGINE_H_
6 #define MEDIAENGINE_H_
8 #include "DOMMediaStream.h"
9 #include "MediaEventSource.h"
10 #include "MediaTrackGraph.h"
11 #include "MediaTrackConstraints.h"
12 #include "mozilla/dom/MediaStreamTrackBinding.h"
13 #include "mozilla/dom/VideoStreamTrack.h"
14 #include "mozilla/RefPtr.h"
15 #include "mozilla/ThreadSafeWeakPtr.h"
17 namespace mozilla {
19 namespace dom {
20 class Blob;
21 } // namespace dom
23 class AllocationHandle;
24 class MediaDevice;
25 class MediaEngineSource;
27 enum MediaSinkEnum {
28 Speaker,
29 Other,
32 enum { kVideoTrack = 1, kAudioTrack = 2, kTrackCount };
34 class MediaEngine {
35 public:
36 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaEngine)
37 NS_DECL_OWNINGEVENTTARGET
39 void AssertIsOnOwningThread() const { NS_ASSERT_OWNINGTHREAD(MediaEngine); }
41 /**
42 * Populate an array of sources of the requested type in the nsTArray.
43 * Also include devices that are currently unavailable.
45 virtual void EnumerateDevices(dom::MediaSourceEnum, MediaSinkEnum,
46 nsTArray<RefPtr<MediaDevice>>*) = 0;
48 virtual void Shutdown() = 0;
50 virtual RefPtr<MediaEngineSource> CreateSource(
51 const MediaDevice* aDevice) = 0;
53 virtual MediaEventSource<void>& DeviceListChangeEvent() = 0;
54 /**
55 * Return true if devices returned from EnumerateDevices are emulated media
56 * devices.
58 virtual bool IsFake() const = 0;
60 protected:
61 virtual ~MediaEngine() = default;
64 } // namespace mozilla
66 #endif /* MEDIAENGINE_H_ */