/src/mozilla-central/dom/media/webrtc/MediaEnginePrefs.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
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 |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef MediaEnginePrefs_h |
8 | | #define MediaEnginePrefs_h |
9 | | |
10 | | namespace mozilla { |
11 | | |
12 | | /** |
13 | | * Video source and friends. |
14 | | */ |
15 | | class MediaEnginePrefs { |
16 | | public: |
17 | | static const int DEFAULT_VIDEO_FPS = 30; |
18 | | static const int DEFAULT_43_VIDEO_WIDTH = 640; |
19 | | static const int DEFAULT_43_VIDEO_HEIGHT = 480; |
20 | | static const int DEFAULT_169_VIDEO_WIDTH = 1280; |
21 | | static const int DEFAULT_169_VIDEO_HEIGHT = 720; |
22 | | |
23 | | MediaEnginePrefs() |
24 | | : mWidth(0) |
25 | | , mHeight(0) |
26 | | , mFPS(0) |
27 | | , mFreq(0) |
28 | | , mAecOn(false) |
29 | | , mAgcOn(false) |
30 | | , mNoiseOn(false) |
31 | | , mAec(0) |
32 | | , mAgc(0) |
33 | | , mNoise(0) |
34 | | , mFullDuplex(false) |
35 | | , mExtendedFilter(false) |
36 | | , mDelayAgnostic(false) |
37 | | , mFakeDeviceChangeEventOn(false) |
38 | | , mChannels(0) |
39 | | {} |
40 | | |
41 | | int32_t mWidth; |
42 | | int32_t mHeight; |
43 | | int32_t mFPS; |
44 | | int32_t mFreq; // for test tones (fake:true) |
45 | | bool mAecOn; |
46 | | bool mAgcOn; |
47 | | bool mNoiseOn; |
48 | | int32_t mAec; |
49 | | int32_t mAgc; |
50 | | int32_t mNoise; |
51 | | bool mFullDuplex; |
52 | | bool mExtendedFilter; |
53 | | bool mDelayAgnostic; |
54 | | bool mFakeDeviceChangeEventOn; |
55 | | int32_t mChannels; |
56 | | |
57 | | // mWidth and/or mHeight may be zero (=adaptive default), so use functions. |
58 | | |
59 | 0 | int32_t GetWidth(bool aHD = false) const { |
60 | 0 | return mWidth? mWidth : (mHeight? |
61 | 0 | (mHeight * GetDefWidth(aHD)) / GetDefHeight(aHD) : |
62 | 0 | GetDefWidth(aHD)); |
63 | 0 | } |
64 | | |
65 | 0 | int32_t GetHeight(bool aHD = false) const { |
66 | 0 | return mHeight? mHeight : (mWidth? |
67 | 0 | (mWidth * GetDefHeight(aHD)) / GetDefWidth(aHD) : |
68 | 0 | GetDefHeight(aHD)); |
69 | 0 | } |
70 | | |
71 | | private: |
72 | 0 | static int32_t GetDefWidth(bool aHD = false) { |
73 | 0 | // It'd be nice if we could use the ternary operator here, but we can't |
74 | 0 | // because of bug 1002729. |
75 | 0 | if (aHD) { |
76 | 0 | return DEFAULT_169_VIDEO_WIDTH; |
77 | 0 | } |
78 | 0 | |
79 | 0 | return DEFAULT_43_VIDEO_WIDTH; |
80 | 0 | } |
81 | | |
82 | 0 | static int32_t GetDefHeight(bool aHD = false) { |
83 | 0 | // It'd be nice if we could use the ternary operator here, but we can't |
84 | 0 | // because of bug 1002729. |
85 | 0 | if (aHD) { |
86 | 0 | return DEFAULT_169_VIDEO_HEIGHT; |
87 | 0 | } |
88 | 0 | |
89 | 0 | return DEFAULT_43_VIDEO_HEIGHT; |
90 | 0 | } |
91 | | }; |
92 | | |
93 | | } // namespace mozilla |
94 | | |
95 | | #endif // MediaEnginePrefs_h |