diff -r 000000000000 -r 6474c204b198 media/webrtc/signaling/src/media-conduit/CodecConfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/media/webrtc/signaling/src/media-conduit/CodecConfig.h Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,128 @@ + +/* 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 CODEC_CONFIG_H_ +#define CODEC_CONFIG_H_ + +#include +#include "ccsdp_rtcp_fb.h" + +namespace mozilla { + +class LoadManager; + +/** + * Minimalistic Audio Codec Config Params + */ +struct AudioCodecConfig +{ + /* + * The data-types for these properties mimic the + * corresponding webrtc::CodecInst data-types. + */ + int mType; + std::string mName; + int mFreq; + int mPacSize; + int mChannels; + int mRate; + LoadManager* mLoadManager; + + /* Default constructor is not provided since as a consumer, we + * can't decide the default configuration for the codec + */ + explicit AudioCodecConfig(int type, std::string name, + int freq,int pacSize, + int channels, int rate, + LoadManager* load_manager = nullptr) + : mType(type), + mName(name), + mFreq(freq), + mPacSize(pacSize), + mChannels(channels), + mRate(rate), + mLoadManager(load_manager) + + { + } +}; + +/* + * Minimalisitc video codec configuration + * More to be added later depending on the use-case + */ + +struct VideoCodecConfig +{ + /* + * The data-types for these properties mimic the + * corresponding webrtc::VideoCodec data-types. + */ + int mType; + std::string mName; + uint32_t mRtcpFbTypes; + unsigned int mMaxFrameSize; + unsigned int mMaxFrameRate; + LoadManager* mLoadManager; + + VideoCodecConfig(int type, + std::string name, + int rtcpFbTypes, + LoadManager* load_manager = nullptr) : + mType(type), + mName(name), + mRtcpFbTypes(rtcpFbTypes), + mMaxFrameSize(0), + mMaxFrameRate(0), + mLoadManager(load_manager) + { + // Replace codec name here because WebRTC.org code has a whitelist of + // supported video codec in |webrtc::ViECodecImpl::CodecValid()| and will + // reject registration of those not in it. + // TODO: bug 995884 to support H.264 in WebRTC.org code. + if (mName == "H264_P0") + mName = "I420"; + } + + VideoCodecConfig(int type, + std::string name, + int rtcpFbTypes, + unsigned int max_fs, + unsigned int max_fr, + LoadManager* load_manager = nullptr) : + mType(type), + mName(name), + mRtcpFbTypes(rtcpFbTypes), + mMaxFrameSize(max_fs), + mMaxFrameRate(max_fr), + mLoadManager(load_manager) + { + // Replace codec name here because WebRTC.org code has a whitelist of + // supported video codec in |webrtc::ViECodecImpl::CodecValid()| and will + // reject registration of those not in it. + // TODO: bug 995884 to support H.264 in WebRTC.org code. + if (mName == "H264_P0") + mName = "I420"; + } + + + bool RtcpFbIsSet(sdp_rtcp_fb_nack_type_e type) const + { + return mRtcpFbTypes & sdp_rtcp_fb_nack_to_bitmap(type); + } + + bool RtcpFbIsSet(sdp_rtcp_fb_ack_type_e type) const + { + return mRtcpFbTypes & sdp_rtcp_fb_ack_to_bitmap(type); + } + + bool RtcpFbIsSet(sdp_rtcp_fb_ccm_type_e type) const + { + return mRtcpFbTypes & sdp_rtcp_fb_ccm_to_bitmap(type); + } + +}; +} +#endif