media/webrtc/signaling/src/media-conduit/CodecConfig.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial