Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 4 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef CODEC_CONFIG_H_ |
michael@0 | 7 | #define CODEC_CONFIG_H_ |
michael@0 | 8 | |
michael@0 | 9 | #include <string> |
michael@0 | 10 | #include "ccsdp_rtcp_fb.h" |
michael@0 | 11 | |
michael@0 | 12 | namespace mozilla { |
michael@0 | 13 | |
michael@0 | 14 | class LoadManager; |
michael@0 | 15 | |
michael@0 | 16 | /** |
michael@0 | 17 | * Minimalistic Audio Codec Config Params |
michael@0 | 18 | */ |
michael@0 | 19 | struct AudioCodecConfig |
michael@0 | 20 | { |
michael@0 | 21 | /* |
michael@0 | 22 | * The data-types for these properties mimic the |
michael@0 | 23 | * corresponding webrtc::CodecInst data-types. |
michael@0 | 24 | */ |
michael@0 | 25 | int mType; |
michael@0 | 26 | std::string mName; |
michael@0 | 27 | int mFreq; |
michael@0 | 28 | int mPacSize; |
michael@0 | 29 | int mChannels; |
michael@0 | 30 | int mRate; |
michael@0 | 31 | LoadManager* mLoadManager; |
michael@0 | 32 | |
michael@0 | 33 | /* Default constructor is not provided since as a consumer, we |
michael@0 | 34 | * can't decide the default configuration for the codec |
michael@0 | 35 | */ |
michael@0 | 36 | explicit AudioCodecConfig(int type, std::string name, |
michael@0 | 37 | int freq,int pacSize, |
michael@0 | 38 | int channels, int rate, |
michael@0 | 39 | LoadManager* load_manager = nullptr) |
michael@0 | 40 | : mType(type), |
michael@0 | 41 | mName(name), |
michael@0 | 42 | mFreq(freq), |
michael@0 | 43 | mPacSize(pacSize), |
michael@0 | 44 | mChannels(channels), |
michael@0 | 45 | mRate(rate), |
michael@0 | 46 | mLoadManager(load_manager) |
michael@0 | 47 | |
michael@0 | 48 | { |
michael@0 | 49 | } |
michael@0 | 50 | }; |
michael@0 | 51 | |
michael@0 | 52 | /* |
michael@0 | 53 | * Minimalisitc video codec configuration |
michael@0 | 54 | * More to be added later depending on the use-case |
michael@0 | 55 | */ |
michael@0 | 56 | |
michael@0 | 57 | struct VideoCodecConfig |
michael@0 | 58 | { |
michael@0 | 59 | /* |
michael@0 | 60 | * The data-types for these properties mimic the |
michael@0 | 61 | * corresponding webrtc::VideoCodec data-types. |
michael@0 | 62 | */ |
michael@0 | 63 | int mType; |
michael@0 | 64 | std::string mName; |
michael@0 | 65 | uint32_t mRtcpFbTypes; |
michael@0 | 66 | unsigned int mMaxFrameSize; |
michael@0 | 67 | unsigned int mMaxFrameRate; |
michael@0 | 68 | LoadManager* mLoadManager; |
michael@0 | 69 | |
michael@0 | 70 | VideoCodecConfig(int type, |
michael@0 | 71 | std::string name, |
michael@0 | 72 | int rtcpFbTypes, |
michael@0 | 73 | LoadManager* load_manager = nullptr) : |
michael@0 | 74 | mType(type), |
michael@0 | 75 | mName(name), |
michael@0 | 76 | mRtcpFbTypes(rtcpFbTypes), |
michael@0 | 77 | mMaxFrameSize(0), |
michael@0 | 78 | mMaxFrameRate(0), |
michael@0 | 79 | mLoadManager(load_manager) |
michael@0 | 80 | { |
michael@0 | 81 | // Replace codec name here because WebRTC.org code has a whitelist of |
michael@0 | 82 | // supported video codec in |webrtc::ViECodecImpl::CodecValid()| and will |
michael@0 | 83 | // reject registration of those not in it. |
michael@0 | 84 | // TODO: bug 995884 to support H.264 in WebRTC.org code. |
michael@0 | 85 | if (mName == "H264_P0") |
michael@0 | 86 | mName = "I420"; |
michael@0 | 87 | } |
michael@0 | 88 | |
michael@0 | 89 | VideoCodecConfig(int type, |
michael@0 | 90 | std::string name, |
michael@0 | 91 | int rtcpFbTypes, |
michael@0 | 92 | unsigned int max_fs, |
michael@0 | 93 | unsigned int max_fr, |
michael@0 | 94 | LoadManager* load_manager = nullptr) : |
michael@0 | 95 | mType(type), |
michael@0 | 96 | mName(name), |
michael@0 | 97 | mRtcpFbTypes(rtcpFbTypes), |
michael@0 | 98 | mMaxFrameSize(max_fs), |
michael@0 | 99 | mMaxFrameRate(max_fr), |
michael@0 | 100 | mLoadManager(load_manager) |
michael@0 | 101 | { |
michael@0 | 102 | // Replace codec name here because WebRTC.org code has a whitelist of |
michael@0 | 103 | // supported video codec in |webrtc::ViECodecImpl::CodecValid()| and will |
michael@0 | 104 | // reject registration of those not in it. |
michael@0 | 105 | // TODO: bug 995884 to support H.264 in WebRTC.org code. |
michael@0 | 106 | if (mName == "H264_P0") |
michael@0 | 107 | mName = "I420"; |
michael@0 | 108 | } |
michael@0 | 109 | |
michael@0 | 110 | |
michael@0 | 111 | bool RtcpFbIsSet(sdp_rtcp_fb_nack_type_e type) const |
michael@0 | 112 | { |
michael@0 | 113 | return mRtcpFbTypes & sdp_rtcp_fb_nack_to_bitmap(type); |
michael@0 | 114 | } |
michael@0 | 115 | |
michael@0 | 116 | bool RtcpFbIsSet(sdp_rtcp_fb_ack_type_e type) const |
michael@0 | 117 | { |
michael@0 | 118 | return mRtcpFbTypes & sdp_rtcp_fb_ack_to_bitmap(type); |
michael@0 | 119 | } |
michael@0 | 120 | |
michael@0 | 121 | bool RtcpFbIsSet(sdp_rtcp_fb_ccm_type_e type) const |
michael@0 | 122 | { |
michael@0 | 123 | return mRtcpFbTypes & sdp_rtcp_fb_ccm_to_bitmap(type); |
michael@0 | 124 | } |
michael@0 | 125 | |
michael@0 | 126 | }; |
michael@0 | 127 | } |
michael@0 | 128 | #endif |