mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 11:15:34 +00:00
3ceaba23ab
The scope of flattening this hierarchy quickly grows large, so this patch does a couple more things: - Creates a pure interface MediaEngineSourceInterface and a base class MediaEngineSource with common defaults and refcount support (no state!) - Breaks out some of the helper classes to dedicated files, e.g., AllocationHandle, MediaEnginePrefs. - Clarifies the threading model (written on one thread *and* under lock, read under either) - Fixes style, indentation, include-sorting in the affected files - Adds comments, especially for clarifying what responsibilities methods have, and thread usage of class members - Changes Monitors to Mutexes since we only use them as Mutexes anyhow - Makes MediaEngineRemoteVideoSource no longer a shared source since we now support scaling in this source and CamerasChild can act as a broker of frames. This greatly simplifies it. The only shared source is now MediaEngineWebRTCMicrophoneSource, so the sharing specific common methods have been moved to that source. MozReview-Commit-ID: KeVZQo6gLm2 --HG-- rename : dom/media/webrtc/MediaEngine.h => dom/media/webrtc/MediaEnginePrefs.h extra : rebase_source : c785a5feb896312912170475d6b8d997e712e48f
96 lines
2.4 KiB
C++
96 lines
2.4 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* 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 MediaEnginePrefs_h
|
|
#define MediaEnginePrefs_h
|
|
|
|
namespace mozilla {
|
|
|
|
/**
|
|
* Video source and friends.
|
|
*/
|
|
class MediaEnginePrefs {
|
|
public:
|
|
static const int DEFAULT_VIDEO_FPS = 30;
|
|
static const int DEFAULT_43_VIDEO_WIDTH = 640;
|
|
static const int DEFAULT_43_VIDEO_HEIGHT = 480;
|
|
static const int DEFAULT_169_VIDEO_WIDTH = 1280;
|
|
static const int DEFAULT_169_VIDEO_HEIGHT = 720;
|
|
|
|
MediaEnginePrefs()
|
|
: mWidth(0)
|
|
, mHeight(0)
|
|
, mFPS(0)
|
|
, mFreq(0)
|
|
, mAecOn(false)
|
|
, mAgcOn(false)
|
|
, mNoiseOn(false)
|
|
, mAec(0)
|
|
, mAgc(0)
|
|
, mNoise(0)
|
|
, mFullDuplex(false)
|
|
, mExtendedFilter(false)
|
|
, mDelayAgnostic(false)
|
|
, mFakeDeviceChangeEventOn(false)
|
|
, mChannels(0)
|
|
{}
|
|
|
|
int32_t mWidth;
|
|
int32_t mHeight;
|
|
int32_t mFPS;
|
|
int32_t mFreq; // for test tones (fake:true)
|
|
bool mAecOn;
|
|
bool mAgcOn;
|
|
bool mNoiseOn;
|
|
int32_t mAec;
|
|
int32_t mAgc;
|
|
int32_t mNoise;
|
|
bool mFullDuplex;
|
|
bool mExtendedFilter;
|
|
bool mDelayAgnostic;
|
|
bool mFakeDeviceChangeEventOn;
|
|
int32_t mChannels;
|
|
|
|
// mWidth and/or mHeight may be zero (=adaptive default), so use functions.
|
|
|
|
int32_t GetWidth(bool aHD = false) const {
|
|
return mWidth? mWidth : (mHeight?
|
|
(mHeight * GetDefWidth(aHD)) / GetDefHeight(aHD) :
|
|
GetDefWidth(aHD));
|
|
}
|
|
|
|
int32_t GetHeight(bool aHD = false) const {
|
|
return mHeight? mHeight : (mWidth?
|
|
(mWidth * GetDefHeight(aHD)) / GetDefWidth(aHD) :
|
|
GetDefHeight(aHD));
|
|
}
|
|
|
|
private:
|
|
static int32_t GetDefWidth(bool aHD = false) {
|
|
// It'd be nice if we could use the ternary operator here, but we can't
|
|
// because of bug 1002729.
|
|
if (aHD) {
|
|
return DEFAULT_169_VIDEO_WIDTH;
|
|
}
|
|
|
|
return DEFAULT_43_VIDEO_WIDTH;
|
|
}
|
|
|
|
static int32_t GetDefHeight(bool aHD = false) {
|
|
// It'd be nice if we could use the ternary operator here, but we can't
|
|
// because of bug 1002729.
|
|
if (aHD) {
|
|
return DEFAULT_169_VIDEO_HEIGHT;
|
|
}
|
|
|
|
return DEFAULT_43_VIDEO_HEIGHT;
|
|
}
|
|
};
|
|
|
|
} // namespace mozilla
|
|
|
|
#endif // MediaEnginePrefs_h
|