michael@0: michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef CODEC_CONFIG_H_ michael@0: #define CODEC_CONFIG_H_ michael@0: michael@0: #include michael@0: #include "ccsdp_rtcp_fb.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: class LoadManager; michael@0: michael@0: /** michael@0: * Minimalistic Audio Codec Config Params michael@0: */ michael@0: struct AudioCodecConfig michael@0: { michael@0: /* michael@0: * The data-types for these properties mimic the michael@0: * corresponding webrtc::CodecInst data-types. michael@0: */ michael@0: int mType; michael@0: std::string mName; michael@0: int mFreq; michael@0: int mPacSize; michael@0: int mChannels; michael@0: int mRate; michael@0: LoadManager* mLoadManager; michael@0: michael@0: /* Default constructor is not provided since as a consumer, we michael@0: * can't decide the default configuration for the codec michael@0: */ michael@0: explicit AudioCodecConfig(int type, std::string name, michael@0: int freq,int pacSize, michael@0: int channels, int rate, michael@0: LoadManager* load_manager = nullptr) michael@0: : mType(type), michael@0: mName(name), michael@0: mFreq(freq), michael@0: mPacSize(pacSize), michael@0: mChannels(channels), michael@0: mRate(rate), michael@0: mLoadManager(load_manager) michael@0: michael@0: { michael@0: } michael@0: }; michael@0: michael@0: /* michael@0: * Minimalisitc video codec configuration michael@0: * More to be added later depending on the use-case michael@0: */ michael@0: michael@0: struct VideoCodecConfig michael@0: { michael@0: /* michael@0: * The data-types for these properties mimic the michael@0: * corresponding webrtc::VideoCodec data-types. michael@0: */ michael@0: int mType; michael@0: std::string mName; michael@0: uint32_t mRtcpFbTypes; michael@0: unsigned int mMaxFrameSize; michael@0: unsigned int mMaxFrameRate; michael@0: LoadManager* mLoadManager; michael@0: michael@0: VideoCodecConfig(int type, michael@0: std::string name, michael@0: int rtcpFbTypes, michael@0: LoadManager* load_manager = nullptr) : michael@0: mType(type), michael@0: mName(name), michael@0: mRtcpFbTypes(rtcpFbTypes), michael@0: mMaxFrameSize(0), michael@0: mMaxFrameRate(0), michael@0: mLoadManager(load_manager) michael@0: { michael@0: // Replace codec name here because WebRTC.org code has a whitelist of michael@0: // supported video codec in |webrtc::ViECodecImpl::CodecValid()| and will michael@0: // reject registration of those not in it. michael@0: // TODO: bug 995884 to support H.264 in WebRTC.org code. michael@0: if (mName == "H264_P0") michael@0: mName = "I420"; michael@0: } michael@0: michael@0: VideoCodecConfig(int type, michael@0: std::string name, michael@0: int rtcpFbTypes, michael@0: unsigned int max_fs, michael@0: unsigned int max_fr, michael@0: LoadManager* load_manager = nullptr) : michael@0: mType(type), michael@0: mName(name), michael@0: mRtcpFbTypes(rtcpFbTypes), michael@0: mMaxFrameSize(max_fs), michael@0: mMaxFrameRate(max_fr), michael@0: mLoadManager(load_manager) michael@0: { michael@0: // Replace codec name here because WebRTC.org code has a whitelist of michael@0: // supported video codec in |webrtc::ViECodecImpl::CodecValid()| and will michael@0: // reject registration of those not in it. michael@0: // TODO: bug 995884 to support H.264 in WebRTC.org code. michael@0: if (mName == "H264_P0") michael@0: mName = "I420"; michael@0: } michael@0: michael@0: michael@0: bool RtcpFbIsSet(sdp_rtcp_fb_nack_type_e type) const michael@0: { michael@0: return mRtcpFbTypes & sdp_rtcp_fb_nack_to_bitmap(type); michael@0: } michael@0: michael@0: bool RtcpFbIsSet(sdp_rtcp_fb_ack_type_e type) const michael@0: { michael@0: return mRtcpFbTypes & sdp_rtcp_fb_ack_to_bitmap(type); michael@0: } michael@0: michael@0: bool RtcpFbIsSet(sdp_rtcp_fb_ccm_type_e type) const michael@0: { michael@0: return mRtcpFbTypes & sdp_rtcp_fb_ccm_to_bitmap(type); michael@0: } michael@0: michael@0: }; michael@0: } michael@0: #endif