Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | /** @section vcm VCM APIs |
michael@0 | 6 | * |
michael@0 | 7 | * @section Introduction |
michael@0 | 8 | * This module contains command APIs to the media layer |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | /** |
michael@0 | 12 | * @file vcm.h |
michael@0 | 13 | * @brief APIs to interface with the Media layer. |
michael@0 | 14 | * |
michael@0 | 15 | * This file contains API that interface to the media layer on the platform. |
michael@0 | 16 | * The following APIs need to be implemented to have the sip stack interact |
michael@0 | 17 | * and issue commands to the media layer. |
michael@0 | 18 | */ |
michael@0 | 19 | |
michael@0 | 20 | #ifndef _VCM_H_ |
michael@0 | 21 | #define _VCM_H_ |
michael@0 | 22 | |
michael@0 | 23 | #include "cpr_types.h" |
michael@0 | 24 | #include "cc_constants.h" |
michael@0 | 25 | #include "ccsdp.h" |
michael@0 | 26 | |
michael@0 | 27 | |
michael@0 | 28 | /** Evaluates to TRUE for audio media streams where id is the mcap_id of the given stream */ |
michael@0 | 29 | #define CC_IS_AUDIO(id) ((id == CC_AUDIO_1) ? TRUE:FALSE) |
michael@0 | 30 | /** Evaluates to TRUE for video media streams where id is the mcap_id of the given stream */ |
michael@0 | 31 | #define CC_IS_VIDEO(id) ((id == CC_VIDEO_1) ? TRUE:FALSE) |
michael@0 | 32 | /** Evaluates to TRUE for datachannel streams where id is the mcap_id of the given stream */ |
michael@0 | 33 | #define CC_IS_DATACHANNEL(id) ((id == CC_DATACHANNEL_1) ? TRUE:FALSE) |
michael@0 | 34 | |
michael@0 | 35 | |
michael@0 | 36 | /** Definitions for direction requesting Play tone to user */ |
michael@0 | 37 | #define VCM_PLAY_TONE_TO_EAR 1 |
michael@0 | 38 | /** Definitions value for direction requesting Play tone to network stream or far end */ |
michael@0 | 39 | #define VCM_PLAY_TONE_TO_NET 2 |
michael@0 | 40 | /** Definitions value for direction requesting Play tone to both user and network */ |
michael@0 | 41 | #define VCM_PLAY_TONE_TO_ALL 3 |
michael@0 | 42 | |
michael@0 | 43 | /** Definitions for alert_info in vcmToneStartWithSpeakerAsBackup API */ |
michael@0 | 44 | #define VCM_ALERT_INFO_OFF 0 |
michael@0 | 45 | /** Definitions for alert_info in vcmToneStartWithSpeakerAsBackup API */ |
michael@0 | 46 | #define VCM_ALERT_INFO_ON 1 |
michael@0 | 47 | |
michael@0 | 48 | /** Definitions for DSP Codec Resources. */ |
michael@0 | 49 | #define VCM_CODEC_RESOURCE_G711 0x00000001 |
michael@0 | 50 | #define VCM_CODEC_RESOURCE_G729A 0x00000002 |
michael@0 | 51 | #define VCM_CODEC_RESOURCE_G729B 0x00000004 |
michael@0 | 52 | #define VCM_CODEC_RESOURCE_LINEAR 0x00000008 |
michael@0 | 53 | #define VCM_CODEC_RESOURCE_G722 0x00000010 |
michael@0 | 54 | #define VCM_CODEC_RESOURCE_iLBC 0x00000020 |
michael@0 | 55 | #define VCM_CODEC_RESOURCE_iSAC 0x00000040 |
michael@0 | 56 | #define VCM_CODEC_RESOURCE_H264 0x00000080 |
michael@0 | 57 | #define VCM_CODEC_RESOURCE_H263 0x00000002 |
michael@0 | 58 | #define VCM_CODEC_RESOURCE_VP8 0x00000100 |
michael@0 | 59 | #define VCM_CODEC_RESOURCE_I420 0x00000200 |
michael@0 | 60 | #define VCM_CODEC_RESOURCE_OPUS 0x00000400 |
michael@0 | 61 | |
michael@0 | 62 | #define VCM_DSP_DECODEONLY 0 |
michael@0 | 63 | #define VCM_DSP_ENCODEONLY 1 |
michael@0 | 64 | #define VCM_DSP_FULLDUPLEX 2 |
michael@0 | 65 | #define VCM_DSP_IGNORE 3 |
michael@0 | 66 | |
michael@0 | 67 | #define CC_KFACTOR_STAT_LEN (256) |
michael@0 | 68 | |
michael@0 | 69 | /* Should be enough for any reasonable use-case */ |
michael@0 | 70 | #define MAX_SSRCS_PER_MEDIA_LINE 16 |
michael@0 | 71 | #define MAX_PTS_PER_MEDIA_LINE 16 |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * vcm_tones_t |
michael@0 | 75 | * Enum identifying various tones that the media layer should implement |
michael@0 | 76 | */ |
michael@0 | 77 | |
michael@0 | 78 | typedef enum |
michael@0 | 79 | { |
michael@0 | 80 | VCM_INSIDE_DIAL_TONE, |
michael@0 | 81 | VCM_OUTSIDE_DIAL_TONE, |
michael@0 | 82 | VCM_DEFAULT_TONE = 1, |
michael@0 | 83 | VCM_LINE_BUSY_TONE, |
michael@0 | 84 | VCM_ALERTING_TONE, |
michael@0 | 85 | VCM_BUSY_VERIFY_TONE, |
michael@0 | 86 | VCM_STUTTER_TONE, |
michael@0 | 87 | VCM_MSG_WAITING_TONE, |
michael@0 | 88 | VCM_REORDER_TONE, |
michael@0 | 89 | VCM_CALL_WAITING_TONE, |
michael@0 | 90 | VCM_CALL_WAITING_2_TONE, |
michael@0 | 91 | VCM_CALL_WAITING_3_TONE, |
michael@0 | 92 | VCM_CALL_WAITING_4_TONE, |
michael@0 | 93 | VCM_HOLD_TONE, |
michael@0 | 94 | VCM_CONFIRMATION_TONE, |
michael@0 | 95 | VCM_PERMANENT_SIGNAL_TONE, |
michael@0 | 96 | VCM_REMINDER_RING_TONE, |
michael@0 | 97 | VCM_NO_TONE, |
michael@0 | 98 | VCM_ZIP_ZIP, |
michael@0 | 99 | VCM_ZIP, |
michael@0 | 100 | VCM_BEEP_BONK, |
michael@0 | 101 | /*#$#$#$#$#@$#$#$#$#$#$#$#$#$#$#$#$$#$#$#$#$#$#$#$#$ |
michael@0 | 102 | * There is a corresponding table defined in |
michael@0 | 103 | * dialplan.c tone_names[]. Make sure to add tone |
michael@0 | 104 | * name in that table if you add any new entry above |
michael@0 | 105 | */ |
michael@0 | 106 | VCM_RECORDERWARNING_TONE, |
michael@0 | 107 | VCM_RECORDERDETECTED_TONE, |
michael@0 | 108 | VCM_MONITORWARNING_TONE, |
michael@0 | 109 | VCM_SECUREWARNING_TONE, |
michael@0 | 110 | VCM_NONSECUREWARNING_TONE, |
michael@0 | 111 | VCM_MAX_TONE, |
michael@0 | 112 | VCM_MAX_DIALTONE = VCM_BEEP_BONK |
michael@0 | 113 | } vcm_tones_t; |
michael@0 | 114 | |
michael@0 | 115 | |
michael@0 | 116 | /** |
michael@0 | 117 | * vcm_tones_t |
michael@0 | 118 | * Enum identifying various tones that the media layer should implement |
michael@0 | 119 | */ |
michael@0 | 120 | |
michael@0 | 121 | |
michael@0 | 122 | /** |
michael@0 | 123 | * vcm_ring_mode_t |
michael@0 | 124 | * VCM_RING_OFFSET is used to map the list |
michael@0 | 125 | * of ring names to the correct enum type |
michael@0 | 126 | * when parsing the alert-info header. |
michael@0 | 127 | */ |
michael@0 | 128 | typedef enum |
michael@0 | 129 | { |
michael@0 | 130 | VCM_RING_OFF = 0x1, |
michael@0 | 131 | VCM_INSIDE_RING = 0x2, |
michael@0 | 132 | VCM_OUTSIDE_RING = 0x3, |
michael@0 | 133 | VCM_FEATURE_RING = 0x4, |
michael@0 | 134 | VCM_BELLCORE_DR1 = 0x5, |
michael@0 | 135 | VCM_RING_OFFSET = 0x5, |
michael@0 | 136 | VCM_BELLCORE_DR2 = 0x6, |
michael@0 | 137 | VCM_BELLCORE_DR3 = 0x7, |
michael@0 | 138 | VCM_BELLCORE_DR4 = 0x8, |
michael@0 | 139 | VCM_BELLCORE_DR5 = 0x9, |
michael@0 | 140 | VCM_BELLCORE_MAX = VCM_BELLCORE_DR5, |
michael@0 | 141 | VCM_FLASHONLY_RING = 0xA, |
michael@0 | 142 | VCM_STATION_PRECEDENCE_RING = 0xB, |
michael@0 | 143 | VCM_MAX_RING = 0xC |
michael@0 | 144 | } vcm_ring_mode_t; |
michael@0 | 145 | |
michael@0 | 146 | /** |
michael@0 | 147 | * vcm_ring_duration_t |
michael@0 | 148 | * Enums for specifying normal vs single ring |
michael@0 | 149 | */ |
michael@0 | 150 | typedef enum { |
michael@0 | 151 | vcm_station_normal_ring = 0x1, |
michael@0 | 152 | vcm_station_single_ring = 0x2 |
michael@0 | 153 | } vcm_ring_duration_t; |
michael@0 | 154 | |
michael@0 | 155 | /** |
michael@0 | 156 | * Structure to carry key codec information |
michael@0 | 157 | */ |
michael@0 | 158 | typedef struct |
michael@0 | 159 | { |
michael@0 | 160 | rtp_ptype codec_type; |
michael@0 | 161 | |
michael@0 | 162 | /* |
michael@0 | 163 | * NOTE: We keep track of the RTP "PT" field for sending separate from the |
michael@0 | 164 | * one for receiving. This is to support asymmetric payload type values |
michael@0 | 165 | * for a given codec. When we get an offer, we answer with the same payload |
michael@0 | 166 | * type value that the remote offers. If we send an offer and the remote |
michael@0 | 167 | * choses to answer with different value than we offer, we support asymmetric. |
michael@0 | 168 | */ |
michael@0 | 169 | |
michael@0 | 170 | /* RTP "PT" field we use to send this codec ("remote") */ |
michael@0 | 171 | int remote_rtp_pt; |
michael@0 | 172 | |
michael@0 | 173 | /* RTP "PT" field we use to receive this codec ("local") */ |
michael@0 | 174 | int local_rtp_pt; |
michael@0 | 175 | |
michael@0 | 176 | /* Parameters for specific media types */ |
michael@0 | 177 | union |
michael@0 | 178 | { |
michael@0 | 179 | struct |
michael@0 | 180 | { |
michael@0 | 181 | int frequency; |
michael@0 | 182 | int packet_size; /* Number of samples in a packet */ |
michael@0 | 183 | int channels; |
michael@0 | 184 | int bitrate; /* Wire bitrate of RTP packet payloads */ |
michael@0 | 185 | } audio; |
michael@0 | 186 | |
michael@0 | 187 | struct |
michael@0 | 188 | { |
michael@0 | 189 | int width; |
michael@0 | 190 | int height; |
michael@0 | 191 | uint32_t rtcp_fb_types; |
michael@0 | 192 | uint32_t max_fs; /* Max frame size */ |
michael@0 | 193 | uint32_t max_fr; /* Max frame rate */ |
michael@0 | 194 | } video; |
michael@0 | 195 | }; |
michael@0 | 196 | |
michael@0 | 197 | /* Codec-specific parameters */ |
michael@0 | 198 | union |
michael@0 | 199 | { |
michael@0 | 200 | struct { |
michael@0 | 201 | uint16_t mode; |
michael@0 | 202 | } ilbc; |
michael@0 | 203 | |
michael@0 | 204 | /* These are outdated, and need to be updated to match the current |
michael@0 | 205 | specification. */ |
michael@0 | 206 | struct { |
michael@0 | 207 | uint32_t max_average_bitrate; |
michael@0 | 208 | const char *maxcodedaudiobandwidth; |
michael@0 | 209 | boolean usedtx; |
michael@0 | 210 | boolean stereo; |
michael@0 | 211 | boolean useinbandfec; |
michael@0 | 212 | boolean cbr; |
michael@0 | 213 | } opus; |
michael@0 | 214 | }; |
michael@0 | 215 | } vcm_payload_info_t; |
michael@0 | 216 | |
michael@0 | 217 | /** |
michael@0 | 218 | * vcm_vad_t |
michael@0 | 219 | * Enums for Voice Activity Detection |
michael@0 | 220 | */ |
michael@0 | 221 | typedef enum vcm_vad_t_ { |
michael@0 | 222 | VCM_VAD_OFF = 0, |
michael@0 | 223 | VCM_VAD_ON = 1 |
michael@0 | 224 | } vcm_vad_t; |
michael@0 | 225 | |
michael@0 | 226 | /** |
michael@0 | 227 | * vcm_audio_bits_t |
michael@0 | 228 | * Enums for indicating audio path |
michael@0 | 229 | */ |
michael@0 | 230 | typedef enum vcm_audio_bits_ { |
michael@0 | 231 | VCM_AUDIO_NONE, |
michael@0 | 232 | VCM_AUDIO_HANDSET, |
michael@0 | 233 | VCM_AUDIO_HEADSET, |
michael@0 | 234 | VCM_AUDIO_SPEAKER |
michael@0 | 235 | } vcm_audio_bits_t; |
michael@0 | 236 | |
michael@0 | 237 | /** |
michael@0 | 238 | * vcm_crypto_algorithmID |
michael@0 | 239 | * Crypto parameters for SRTP media |
michael@0 | 240 | */ |
michael@0 | 241 | typedef enum { |
michael@0 | 242 | VCM_INVLID_ALGORITM_ID = -1, /* invalid algorithm ID. */ |
michael@0 | 243 | VCM_NO_ENCRYPTION = 0, /* no encryption */ |
michael@0 | 244 | VCM_AES_128_COUNTER /* AES 128 counter mode (32 bits HMAC)*/ |
michael@0 | 245 | } vcm_crypto_algorithmID; |
michael@0 | 246 | |
michael@0 | 247 | /** |
michael@0 | 248 | * vcm_mixing_mode_t |
michael@0 | 249 | * Mixing mode for media |
michael@0 | 250 | */ |
michael@0 | 251 | typedef enum { |
michael@0 | 252 | VCM_NO_MIX, |
michael@0 | 253 | VCM_MIX |
michael@0 | 254 | } vcm_mixing_mode_t; |
michael@0 | 255 | |
michael@0 | 256 | /** |
michael@0 | 257 | * vcm_session_t |
michael@0 | 258 | * Media Session Specification enum |
michael@0 | 259 | */ |
michael@0 | 260 | typedef enum { |
michael@0 | 261 | PRIMARY_SESSION, |
michael@0 | 262 | MIX_SESSION, |
michael@0 | 263 | NO_SESSION |
michael@0 | 264 | } vcm_session_t; |
michael@0 | 265 | |
michael@0 | 266 | |
michael@0 | 267 | /** |
michael@0 | 268 | * vcm_mixing_party_t |
michael@0 | 269 | * Media mix party enum |
michael@0 | 270 | * Indicates the party to be mixed none/local/remote/both/TxBOTH_RxNONE |
michael@0 | 271 | * TxBOTH_RxNONE means that for Tx stream it's both, for Rx stream it's none |
michael@0 | 272 | */ |
michael@0 | 273 | typedef enum { |
michael@0 | 274 | VCM_PARTY_NONE, |
michael@0 | 275 | VCM_PARTY_LOCAL, |
michael@0 | 276 | VCM_PARTY_REMOTE, |
michael@0 | 277 | VCM_PARTY_BOTH, |
michael@0 | 278 | VCM_PARTY_TxBOTH_RxNONE |
michael@0 | 279 | } vcm_mixing_party_t; |
michael@0 | 280 | |
michael@0 | 281 | /** |
michael@0 | 282 | * media_control_to_encoder_t |
michael@0 | 283 | * Enums for far end control for media |
michael@0 | 284 | * Only Fast Picture Update for video is supported |
michael@0 | 285 | */ |
michael@0 | 286 | typedef enum { |
michael@0 | 287 | VCM_MEDIA_CONTROL_PICTURE_FAST_UPDATE |
michael@0 | 288 | } vcm_media_control_to_encoder_t; |
michael@0 | 289 | |
michael@0 | 290 | /** |
michael@0 | 291 | * Maximum key and salt must be adjust to the largest possible |
michael@0 | 292 | * supported key. |
michael@0 | 293 | */ |
michael@0 | 294 | #define VCM_SRTP_MAX_KEY_SIZE 16 /* maximum key in bytes (128 bits) */ |
michael@0 | 295 | /** |
michael@0 | 296 | * Maximum key and salt must be adjust to the largest possible |
michael@0 | 297 | * supported salt. |
michael@0 | 298 | */ |
michael@0 | 299 | #define VCM_SRTP_MAX_SALT_SIZE 14 /* maximum salt in bytes (112 bits)*/ |
michael@0 | 300 | |
michael@0 | 301 | /** Key size in bytes for AES128 algorithm */ |
michael@0 | 302 | #define VCM_AES_128_COUNTER_KEY_SIZE 16 |
michael@0 | 303 | /** Salt size in bytes for AES128 algorithm */ |
michael@0 | 304 | #define VCM_AES_128_COUNTER_SALT_SIZE 14 |
michael@0 | 305 | |
michael@0 | 306 | /** Structure to carry crypto key and salt for SRTP streams */ |
michael@0 | 307 | typedef struct vcm_crypto_key_t_ { |
michael@0 | 308 | cc_uint8_t key_len; /**< key length*/ |
michael@0 | 309 | cc_uint8_t key[VCM_SRTP_MAX_KEY_SIZE]; /**< key*/ |
michael@0 | 310 | cc_uint8_t salt_len; /**< salt length*/ |
michael@0 | 311 | cc_uint8_t salt[VCM_SRTP_MAX_SALT_SIZE]; /**< salt*/ |
michael@0 | 312 | } vcm_crypto_key_t; |
michael@0 | 313 | |
michael@0 | 314 | /** |
michael@0 | 315 | * vcm_videoAttrs_t |
michael@0 | 316 | * An opaque handle to store and pass video attributes |
michael@0 | 317 | */ |
michael@0 | 318 | typedef struct vcm_videoAttrs_t_ { |
michael@0 | 319 | void * opaque; /**< pointer to opaque data from application as received from vcm_negotiate_attrs()*/ |
michael@0 | 320 | } vcm_videoAttrs_t; |
michael@0 | 321 | |
michael@0 | 322 | /** A structure carrying audio media specific attributes */ |
michael@0 | 323 | typedef struct vcm_audioAttrs_t_ { |
michael@0 | 324 | cc_uint16_t packetization_period; /**< ptime value received in SDP */ |
michael@0 | 325 | cc_uint16_t max_packetization_period; /**< ptime value received in SDP */ |
michael@0 | 326 | cc_int32_t avt_payload_type; /**< RTP payload type for AVT */ |
michael@0 | 327 | vcm_vad_t vad; /**< Voice Activity Detection on or off */ |
michael@0 | 328 | vcm_mixing_party_t mixing_party; /**< mixing_party */ |
michael@0 | 329 | vcm_mixing_mode_t mixing_mode; /**< mixing_mode*/ |
michael@0 | 330 | } vcm_audioAttrs_t; |
michael@0 | 331 | |
michael@0 | 332 | |
michael@0 | 333 | /** |
michael@0 | 334 | * vcm_mediaAttrs_t |
michael@0 | 335 | * A structure to contain audio or video media attributes |
michael@0 | 336 | */ |
michael@0 | 337 | typedef struct vcm_attrs_t_ { |
michael@0 | 338 | cc_boolean mute; |
michael@0 | 339 | cc_boolean is_video; |
michael@0 | 340 | cc_boolean rtcp_mux; |
michael@0 | 341 | cc_boolean audio_level; |
michael@0 | 342 | uint8_t audio_level_id; |
michael@0 | 343 | vcm_audioAttrs_t audio; /**< audio line attribs */ |
michael@0 | 344 | vcm_videoAttrs_t video; /**< Video Atrribs */ |
michael@0 | 345 | uint32_t bundle_level; /**< Where bundle transport info lives, if any */ |
michael@0 | 346 | /* Some stuff for assisting in stream correlation for bundle */ |
michael@0 | 347 | /** RTP correlator specified here: |
michael@0 | 348 | * http://tools.ietf.org/html/draft-roach-mmusic-unified-plan */ |
michael@0 | 349 | cc_uint32_t bundle_stream_correlator; |
michael@0 | 350 | cc_uint32_t ssrcs[MAX_SSRCS_PER_MEDIA_LINE]; |
michael@0 | 351 | cc_uint8_t num_ssrcs; |
michael@0 | 352 | /** Payload type ids that appear on this m-line, but no other. Used as a |
michael@0 | 353 | * last-ditch correlator for bundle */ |
michael@0 | 354 | cc_uint8_t unique_payload_types[MAX_PTS_PER_MEDIA_LINE]; |
michael@0 | 355 | cc_uint8_t num_unique_payload_types; |
michael@0 | 356 | } vcm_mediaAttrs_t; |
michael@0 | 357 | |
michael@0 | 358 | //Using C++ for gips. This is required for gips. |
michael@0 | 359 | #ifdef __cplusplus |
michael@0 | 360 | extern "C" { |
michael@0 | 361 | #endif |
michael@0 | 362 | |
michael@0 | 363 | /** |
michael@0 | 364 | * The initialization of the VCM module |
michael@0 | 365 | * |
michael@0 | 366 | */ |
michael@0 | 367 | |
michael@0 | 368 | void vcmInit(); |
michael@0 | 369 | |
michael@0 | 370 | /** |
michael@0 | 371 | * The unloading of the VCM module |
michael@0 | 372 | */ |
michael@0 | 373 | void vcmUnload(); |
michael@0 | 374 | |
michael@0 | 375 | |
michael@0 | 376 | /** |
michael@0 | 377 | * Should we remove this from external API |
michael@0 | 378 | * |
michael@0 | 379 | * @param[in] mcap_id - group identifier to which stream belongs. |
michael@0 | 380 | * @param[in] group_id - group identifier |
michael@0 | 381 | * @param[in] stream_id - stream identifier |
michael@0 | 382 | * @param[in] call_handle - call handle |
michael@0 | 383 | * @param[in] port_requested - requested port. |
michael@0 | 384 | * @param[in] listen_ip - local IP for listening |
michael@0 | 385 | * @param[in] is_multicast - multicast stream? |
michael@0 | 386 | * @param[in,out] port_allocated - allocated(reserved) port |
michael@0 | 387 | * |
michael@0 | 388 | * tbd need to see if we can deprecate this API |
michael@0 | 389 | * |
michael@0 | 390 | * @return 0 success, ERROR failure. |
michael@0 | 391 | * |
michael@0 | 392 | */ |
michael@0 | 393 | |
michael@0 | 394 | short vcmRxOpen(cc_mcapid_t mcap_id, |
michael@0 | 395 | cc_groupid_t group_id, |
michael@0 | 396 | cc_streamid_t stream_id, |
michael@0 | 397 | cc_call_handle_t call_handle, |
michael@0 | 398 | cc_uint16_t port_requested, |
michael@0 | 399 | cpr_ip_addr_t *listen_ip, |
michael@0 | 400 | cc_boolean is_multicast, |
michael@0 | 401 | int *port_allocated); |
michael@0 | 402 | /*! |
michael@0 | 403 | * should we remove from external API |
michael@0 | 404 | * |
michael@0 | 405 | * @param[in] mcap_id - Media Capability ID |
michael@0 | 406 | * @param[in] group_id - group to which stream belongs |
michael@0 | 407 | * @param[in] stream_id - stream identifier |
michael@0 | 408 | * @param[in] call_handle - call handle |
michael@0 | 409 | * |
michael@0 | 410 | * @return zero(0) for success; otherwise, ERROR for failure |
michael@0 | 411 | * |
michael@0 | 412 | */ |
michael@0 | 413 | |
michael@0 | 414 | short vcmTxOpen(cc_mcapid_t mcap_id, |
michael@0 | 415 | cc_groupid_t group_id, |
michael@0 | 416 | cc_streamid_t stream_id, |
michael@0 | 417 | cc_call_handle_t call_handle); |
michael@0 | 418 | |
michael@0 | 419 | /*! |
michael@0 | 420 | * Allocate(Reserve) a receive port. |
michael@0 | 421 | * |
michael@0 | 422 | * @param[in] mcap_id - Media Capability ID |
michael@0 | 423 | * @param[in] group_id - group identifier to which stream belongs. |
michael@0 | 424 | * @param[in] stream_id - stream identifier |
michael@0 | 425 | * @param[in] call_handle - call handle |
michael@0 | 426 | * @param[in] port_requested - port requested (if zero -> give any) |
michael@0 | 427 | * @param[out] port_allocated - port that was actually allocated. |
michael@0 | 428 | * |
michael@0 | 429 | * @return 0 for success; VCM_ERROR for failure |
michael@0 | 430 | * |
michael@0 | 431 | */ |
michael@0 | 432 | |
michael@0 | 433 | void vcmRxAllocPort(cc_mcapid_t mcap_id, |
michael@0 | 434 | cc_groupid_t group_id, |
michael@0 | 435 | cc_streamid_t stream_id, |
michael@0 | 436 | cc_call_handle_t call_handle, |
michael@0 | 437 | cc_uint16_t port_requested, |
michael@0 | 438 | int *port_allocated); |
michael@0 | 439 | |
michael@0 | 440 | |
michael@0 | 441 | short vcmRxAllocICE(cc_mcapid_t mcap_id, |
michael@0 | 442 | cc_groupid_t group_id, |
michael@0 | 443 | cc_streamid_t stream_id, |
michael@0 | 444 | cc_call_handle_t call_handle, |
michael@0 | 445 | const char *peerconnection, |
michael@0 | 446 | uint16_t level, |
michael@0 | 447 | char **default_addr, /* Out */ |
michael@0 | 448 | int *default_port, /* Out */ |
michael@0 | 449 | char ***candidates, /* Out */ |
michael@0 | 450 | int *candidate_ct /* Out */ |
michael@0 | 451 | ); |
michael@0 | 452 | |
michael@0 | 453 | |
michael@0 | 454 | /* Get ICE global parameters (ufrag and pwd) |
michael@0 | 455 | * |
michael@0 | 456 | * @param[in] peerconnection - the peerconnection in use |
michael@0 | 457 | * @param[out] ufragp - where to put the ufrag |
michael@0 | 458 | * @param[out] pwdp - where to put the pwd |
michael@0 | 459 | * |
michael@0 | 460 | * @return 0 for success; VCM_ERROR for failure |
michael@0 | 461 | */ |
michael@0 | 462 | short vcmGetIceParams(const char *peerconnection, char **ufragp, char **pwdp); |
michael@0 | 463 | |
michael@0 | 464 | /* Set remote ICE global parameters. |
michael@0 | 465 | * |
michael@0 | 466 | * @param[in] peerconnection - the peerconnection in use |
michael@0 | 467 | * @param[in] ufrag - the ufrag |
michael@0 | 468 | * @param[in] pwd - the pwd |
michael@0 | 469 | * |
michael@0 | 470 | * @return 0 success, error failure |
michael@0 | 471 | */ |
michael@0 | 472 | short vcmSetIceSessionParams(const char *peerconnection, char *ufrag, char *pwd); |
michael@0 | 473 | |
michael@0 | 474 | /* Set ice candidate for trickle ICE. |
michael@0 | 475 | * |
michael@0 | 476 | * @param[in] peerconnection - the peerconnection in use |
michael@0 | 477 | * @param[in] icecandidate - the icecandidate |
michael@0 | 478 | * @param[in] level - the m line level |
michael@0 | 479 | * |
michael@0 | 480 | * @return 0 success, error failure |
michael@0 | 481 | */ |
michael@0 | 482 | short vcmSetIceCandidate(const char *peerconnection, const char *icecandidate, uint16_t level); |
michael@0 | 483 | |
michael@0 | 484 | /* Set remote ICE media-level parameters. |
michael@0 | 485 | * |
michael@0 | 486 | * @param[in] peerconnection - the peerconnection in use |
michael@0 | 487 | * @param[in] level - the m-line |
michael@0 | 488 | * @param[in] ufrag - the ufrag |
michael@0 | 489 | * @param[in] pwd - the pwd |
michael@0 | 490 | * @param[in] candidates - the candidates |
michael@0 | 491 | * @param[in] candidate_ct - the number of candidates |
michael@0 | 492 | * @return 0 success, error failure |
michael@0 | 493 | */ |
michael@0 | 494 | short vcmSetIceMediaParams(const char *peerconnection, int level, char *ufrag, char *pwd, |
michael@0 | 495 | char **candidates, int candidate_ct); |
michael@0 | 496 | |
michael@0 | 497 | /* Start ICE checks |
michael@0 | 498 | * @param[in] peerconnection - the peerconnection in use |
michael@0 | 499 | * @param[in] isControlling - true if controlling, false if controlled |
michael@0 | 500 | * @return 0 success, error failure |
michael@0 | 501 | */ |
michael@0 | 502 | short vcmStartIceChecks(const char *peerconnection, cc_boolean isControlling); |
michael@0 | 503 | |
michael@0 | 504 | |
michael@0 | 505 | |
michael@0 | 506 | /* |
michael@0 | 507 | * Create a remote stream |
michael@0 | 508 | * |
michael@0 | 509 | * @param[in] mcap_id - group identifier to which stream belongs. |
michael@0 | 510 | * @param[in] peerconnection - the peerconnection in use |
michael@0 | 511 | * @param[out] pc_stream_id - the id of the allocated stream |
michael@0 | 512 | * |
michael@0 | 513 | * TODO(ekr@rtfm.com): Revise along with everything else for the |
michael@0 | 514 | * new stream model. |
michael@0 | 515 | * |
michael@0 | 516 | * Returns: zero(0) for success; otherwise, ERROR for failure |
michael@0 | 517 | */ |
michael@0 | 518 | short vcmCreateRemoteStream( |
michael@0 | 519 | cc_mcapid_t mcap_id, |
michael@0 | 520 | const char *peerconnection, |
michael@0 | 521 | int *pc_stream_id); |
michael@0 | 522 | |
michael@0 | 523 | /* |
michael@0 | 524 | * Add remote stream hint |
michael@0 | 525 | * |
michael@0 | 526 | * We are sending track information up to PeerConnection before |
michael@0 | 527 | * the tracks exist so it knows when the stream is fully constructed. |
michael@0 | 528 | * |
michael@0 | 529 | * @param[in] peerconnection |
michael@0 | 530 | * @param[in] pc_stream_id |
michael@0 | 531 | * @param[in] is_video |
michael@0 | 532 | * |
michael@0 | 533 | * Returns: zero(0) for success; otherwise, ERROR for failure |
michael@0 | 534 | */ |
michael@0 | 535 | short vcmAddRemoteStreamHint( |
michael@0 | 536 | const char *peerconnection, |
michael@0 | 537 | int pc_stream_id, |
michael@0 | 538 | cc_boolean is_video); |
michael@0 | 539 | |
michael@0 | 540 | /*! |
michael@0 | 541 | * Release the allocated port |
michael@0 | 542 | * @param[in] mcap_id - media capability id (0 is audio) |
michael@0 | 543 | * @param[in] group_id - group identifier |
michael@0 | 544 | * @param[in] stream_id - stream identifier |
michael@0 | 545 | * @param[in] call_handle - call handle |
michael@0 | 546 | * @param[in] port - port to be released |
michael@0 | 547 | * |
michael@0 | 548 | * @return void |
michael@0 | 549 | */ |
michael@0 | 550 | void vcmRxReleasePort(cc_mcapid_t mcap_id, |
michael@0 | 551 | cc_groupid_t group_id, |
michael@0 | 552 | cc_streamid_t stream_id, |
michael@0 | 553 | cc_call_handle_t call_handle, |
michael@0 | 554 | int port); |
michael@0 | 555 | |
michael@0 | 556 | /*! |
michael@0 | 557 | * Start receive stream |
michael@0 | 558 | * Note: For video calls, for a given call handle there will be |
michael@0 | 559 | * two media lines and the corresponding group_id/stream_id pair. |
michael@0 | 560 | * One RTP session is requested from media server for each |
michael@0 | 561 | * media line(group/stream) i.e. a video call would result in |
michael@0 | 562 | * two rtp_sessions in our session info list created by two |
michael@0 | 563 | * calls to vcm_rx/tx with mcap_id of AUDIO and VIDEO respectively. |
michael@0 | 564 | * |
michael@0 | 565 | * @param[in] mcap_id - media type id |
michael@0 | 566 | * @param[in] group_id - group identifier associated with the stream |
michael@0 | 567 | * @param[in] stream_id - id of the stream one per each media line |
michael@0 | 568 | * @param[in] call_handle - call handle |
michael@0 | 569 | * @param[in] payload - payload information |
michael@0 | 570 | * @param[in] local_addr - local ip address to use. |
michael@0 | 571 | * @param[in] port - local port (receive) |
michael@0 | 572 | * @param[in] algorithmID - crypto alogrithm ID |
michael@0 | 573 | * @param[in] rx_key - rx key used when algorithm ID is encrypting |
michael@0 | 574 | * @param[in] attrs - media attributes |
michael@0 | 575 | * |
michael@0 | 576 | * @return zero(0) for success; otherwise, -1 for failure |
michael@0 | 577 | * |
michael@0 | 578 | */ |
michael@0 | 579 | |
michael@0 | 580 | int vcmRxStart(cc_mcapid_t mcap_id, |
michael@0 | 581 | cc_groupid_t group_id, |
michael@0 | 582 | cc_streamid_t stream_id, |
michael@0 | 583 | cc_call_handle_t call_handle, |
michael@0 | 584 | const vcm_payload_info_t *payload, |
michael@0 | 585 | cpr_ip_addr_t *local_addr, |
michael@0 | 586 | cc_uint16_t port, |
michael@0 | 587 | vcm_crypto_algorithmID algorithmID, |
michael@0 | 588 | vcm_crypto_key_t *rx_key, |
michael@0 | 589 | vcm_mediaAttrs_t *attrs); |
michael@0 | 590 | |
michael@0 | 591 | |
michael@0 | 592 | /** |
michael@0 | 593 | * start rx stream |
michael@0 | 594 | * Same concept as vcmRxStart but for ICE/PeerConnection-based flows |
michael@0 | 595 | * |
michael@0 | 596 | * @param[in] mcap_id - media cap id |
michael@0 | 597 | * @param[in] group_id - group identifier to which the stream belongs |
michael@0 | 598 | * @param[in] stream_id - stream id of the given media type. |
michael@0 | 599 | * @param[in] level - the m-line index |
michael@0 | 600 | * @param[in] pc_stream_id - the media stream index (from PC.addStream()) |
michael@0 | 601 | * @param[in] pc_track_id - the track within the media stream |
michael@0 | 602 | * @param[in] call_handle - call handle |
michael@0 | 603 | * @param[in] peerconnection - the peerconnection in use |
michael@0 | 604 | * @param[in] num_payloads - number of codecs negotiated |
michael@0 | 605 | * @param[in] payloads - list of negotiated codec details |
michael@0 | 606 | * @param[in] setup_t - whether playing client or server role |
michael@0 | 607 | * @param[in] fingerprint_alg - the DTLS fingerprint algorithm |
michael@0 | 608 | * @param[in] fingerprint - the DTLS fingerprint |
michael@0 | 609 | * @param[in] attrs - media attributes |
michael@0 | 610 | * |
michael@0 | 611 | * Returns: zero(0) for success; otherwise, ERROR for failure |
michael@0 | 612 | * |
michael@0 | 613 | */ |
michael@0 | 614 | |
michael@0 | 615 | int vcmRxStartICE(cc_mcapid_t mcap_id, |
michael@0 | 616 | cc_groupid_t group_id, |
michael@0 | 617 | cc_streamid_t stream_id, |
michael@0 | 618 | int level, |
michael@0 | 619 | int pc_stream_id, |
michael@0 | 620 | int pc_track_id, |
michael@0 | 621 | cc_call_handle_t call_handle, |
michael@0 | 622 | const char *peerconnection, |
michael@0 | 623 | int num_payloads, |
michael@0 | 624 | const vcm_payload_info_t* payloads, |
michael@0 | 625 | sdp_setup_type_e setup_type, |
michael@0 | 626 | const char *fingerprint_alg, |
michael@0 | 627 | const char *fingerprint, |
michael@0 | 628 | vcm_mediaAttrs_t *attrs); |
michael@0 | 629 | |
michael@0 | 630 | /** |
michael@0 | 631 | * start tx stream |
michael@0 | 632 | * Note: For video calls, for a given call handle there will be |
michael@0 | 633 | * two media lines and the corresponding group_id/stream_id pair. |
michael@0 | 634 | * One RTP session is requested from media server for each |
michael@0 | 635 | * media line(group/stream) i.e. a video call would result in |
michael@0 | 636 | * two rtp_sessions in our session info list created by two |
michael@0 | 637 | * calls to vcm_rx/tx with mcap_id of AUDIO and VIDEO respectively. |
michael@0 | 638 | * |
michael@0 | 639 | * @param[in] mcap_id - media cap id |
michael@0 | 640 | * @param[in] group_id - group identifier to which the stream belongs |
michael@0 | 641 | * @param[in] stream_id - stream id of the given media type. |
michael@0 | 642 | * @param[in] call_handle - call handle |
michael@0 | 643 | * @param[in] payload - payload information |
michael@0 | 644 | * @param[in] tos - bit marking |
michael@0 | 645 | * @param[in] local_addr - local address |
michael@0 | 646 | * @param[in] local_port - local port |
michael@0 | 647 | * @param[in] remote_ip_addr - remote ip address |
michael@0 | 648 | * @param[in] remote_port - remote port |
michael@0 | 649 | * @param[in] algorithmID - crypto alogrithm ID |
michael@0 | 650 | * @param[in] tx_key - tx key used when algorithm ID is encrypting. |
michael@0 | 651 | * @param[in] attrs - media attributes |
michael@0 | 652 | * |
michael@0 | 653 | * Returns: zero(0) for success; otherwise, ERROR for failure |
michael@0 | 654 | * |
michael@0 | 655 | */ |
michael@0 | 656 | |
michael@0 | 657 | int vcmTxStart(cc_mcapid_t mcap_id, |
michael@0 | 658 | cc_groupid_t group_id, |
michael@0 | 659 | cc_streamid_t stream_id, |
michael@0 | 660 | cc_call_handle_t call_handle, |
michael@0 | 661 | const vcm_payload_info_t *payload, |
michael@0 | 662 | short tos, |
michael@0 | 663 | cpr_ip_addr_t *local_addr, |
michael@0 | 664 | cc_uint16_t local_port, |
michael@0 | 665 | cpr_ip_addr_t *remote_ip_addr, |
michael@0 | 666 | cc_uint16_t remote_port, |
michael@0 | 667 | vcm_crypto_algorithmID algorithmID, |
michael@0 | 668 | vcm_crypto_key_t *tx_key, |
michael@0 | 669 | vcm_mediaAttrs_t *attrs); |
michael@0 | 670 | |
michael@0 | 671 | |
michael@0 | 672 | /** |
michael@0 | 673 | * start tx stream |
michael@0 | 674 | * Same concept as vcmTxStart but for ICE/PeerConnection-based flowso |
michael@0 | 675 | * |
michael@0 | 676 | * @param[in] mcap_id - media cap id |
michael@0 | 677 | * @param[in] group_id - group identifier to which the stream belongs |
michael@0 | 678 | * @param[in] stream_id - stream id of the given media type. |
michael@0 | 679 | * @param[in] level - the m-line index |
michael@0 | 680 | * @param[in] pc_stream_id - the media stream index (from PC.addStream()) |
michael@0 | 681 | * @param[in] pc_track_id - the track within the media stream |
michael@0 | 682 | * @param[in] call_handle - call handle |
michael@0 | 683 | * @param[in] peerconnection - the peerconnection in use |
michael@0 | 684 | * @param[in] payload - payload information |
michael@0 | 685 | * @param[in] tos - bit marking |
michael@0 | 686 | * @param[in] setup_type - whether playing client or server role |
michael@0 | 687 | * @param[in] fingerprint_alg - the DTLS fingerprint algorithm |
michael@0 | 688 | * @param[in] fingerprint - the DTLS fingerprint |
michael@0 | 689 | * @param[in] attrs - media attributes |
michael@0 | 690 | * |
michael@0 | 691 | * Returns: zero(0) for success; otherwise, ERROR for failure |
michael@0 | 692 | * |
michael@0 | 693 | */ |
michael@0 | 694 | |
michael@0 | 695 | int vcmTxStartICE(cc_mcapid_t mcap_id, |
michael@0 | 696 | cc_groupid_t group_id, |
michael@0 | 697 | cc_streamid_t stream_id, |
michael@0 | 698 | int level, |
michael@0 | 699 | int pc_stream_id, |
michael@0 | 700 | int pc_track_id, |
michael@0 | 701 | cc_call_handle_t call_handle, |
michael@0 | 702 | const char *peerconnection, |
michael@0 | 703 | const vcm_payload_info_t *payload, |
michael@0 | 704 | short tos, |
michael@0 | 705 | sdp_setup_type_e setup_type, |
michael@0 | 706 | const char *fingerprint_alg, |
michael@0 | 707 | const char *fingerprint, |
michael@0 | 708 | vcm_mediaAttrs_t *attrs); |
michael@0 | 709 | |
michael@0 | 710 | |
michael@0 | 711 | short vcmGetDtlsIdentity(const char *peerconnection, |
michael@0 | 712 | char *digest_alg, |
michael@0 | 713 | size_t max_digest_alg_len, |
michael@0 | 714 | char *digest, |
michael@0 | 715 | size_t max_digest_len); |
michael@0 | 716 | |
michael@0 | 717 | |
michael@0 | 718 | short vcmInitializeDataChannel(const char *peerconnection, |
michael@0 | 719 | int track_id, |
michael@0 | 720 | cc_uint16_t streams, |
michael@0 | 721 | int local_datachannel_port, |
michael@0 | 722 | int remote_datachannel_port, |
michael@0 | 723 | const char* protocol); |
michael@0 | 724 | |
michael@0 | 725 | /*! |
michael@0 | 726 | * Close the receive stream. |
michael@0 | 727 | * |
michael@0 | 728 | * @param[in] mcap_id - Media Capability ID |
michael@0 | 729 | * @param[in] group_id - group identifier that belongs to the stream. |
michael@0 | 730 | * @param[in] stream_id - stream id of the given media type. |
michael@0 | 731 | * @param[in] call_handle - call handle |
michael@0 | 732 | * |
michael@0 | 733 | * @return 0 for success; VCM_ERROR for failure |
michael@0 | 734 | * |
michael@0 | 735 | */ |
michael@0 | 736 | |
michael@0 | 737 | short vcmRxClose(cc_mcapid_t mcap_id, |
michael@0 | 738 | cc_groupid_t group_id, |
michael@0 | 739 | cc_streamid_t stream_id, |
michael@0 | 740 | cc_call_handle_t call_handle); |
michael@0 | 741 | |
michael@0 | 742 | /** |
michael@0 | 743 | * Close the transmit stream |
michael@0 | 744 | * |
michael@0 | 745 | * @param[in] mcap_id - Media Capability ID |
michael@0 | 746 | * @param[in] group_id - identifier of the group to which stream belongs |
michael@0 | 747 | * @param[in] stream_id - stream id of the given media type. |
michael@0 | 748 | * @param[in] call_handle - call handle |
michael@0 | 749 | * |
michael@0 | 750 | * @return 0 for success; VCM_ERROR for failure |
michael@0 | 751 | */ |
michael@0 | 752 | |
michael@0 | 753 | short vcmTxClose(cc_mcapid_t mcap_id, |
michael@0 | 754 | cc_groupid_t group_id, |
michael@0 | 755 | cc_streamid_t stream_id, |
michael@0 | 756 | cc_call_handle_t call_handle); |
michael@0 | 757 | |
michael@0 | 758 | /** |
michael@0 | 759 | * To be Deprecated |
michael@0 | 760 | * This may be needed to be implemented if the DSP doesn't automatically enable the side tone |
michael@0 | 761 | * The stack will make a call to this method based on the call state. Provide a stub if this is not needed. |
michael@0 | 762 | * |
michael@0 | 763 | * @param[in] side_tone - cc_boolean to enable/disable side tone |
michael@0 | 764 | * |
michael@0 | 765 | * @return void |
michael@0 | 766 | * |
michael@0 | 767 | */ |
michael@0 | 768 | void vcmEnableSidetone(cc_uint16_t side_tone); |
michael@0 | 769 | |
michael@0 | 770 | /** |
michael@0 | 771 | * Start a tone (continuous) |
michael@0 | 772 | * |
michael@0 | 773 | * Parameters: |
michael@0 | 774 | * @param[in] tone - tone type |
michael@0 | 775 | * @param[in] alert_info - alertinfo header |
michael@0 | 776 | * @param[in] call_handle- call handle |
michael@0 | 777 | * @param[in] group_id - identifier of the group to which stream belongs |
michael@0 | 778 | * @param[in] stream_id - stream identifier. |
michael@0 | 779 | * @param[in] direction - network, speaker, both |
michael@0 | 780 | * |
michael@0 | 781 | * @return void |
michael@0 | 782 | * |
michael@0 | 783 | */ |
michael@0 | 784 | |
michael@0 | 785 | void vcmToneStart(vcm_tones_t tone, |
michael@0 | 786 | short alert_info, |
michael@0 | 787 | cc_call_handle_t call_handle, |
michael@0 | 788 | cc_groupid_t group_id, |
michael@0 | 789 | cc_streamid_t stream_id, |
michael@0 | 790 | cc_uint16_t direction); |
michael@0 | 791 | |
michael@0 | 792 | /** |
michael@0 | 793 | * Plays a short tone. uses the open audio path. |
michael@0 | 794 | * If no audio path is open, plays on speaker. |
michael@0 | 795 | * |
michael@0 | 796 | * @param[in] tone - tone type |
michael@0 | 797 | * @param[in] alert_info - alertinfo header |
michael@0 | 798 | * @param[in] call_handle- call handle |
michael@0 | 799 | * @param[in] group_id - identifier of the group to which stream belongs |
michael@0 | 800 | * @param[in] stream_id - stream identifier. |
michael@0 | 801 | * @param[in] direction - network, speaker, both |
michael@0 | 802 | * |
michael@0 | 803 | * @return void |
michael@0 | 804 | */ |
michael@0 | 805 | |
michael@0 | 806 | void vcmToneStartWithSpeakerAsBackup(vcm_tones_t tone, |
michael@0 | 807 | short alert_info, |
michael@0 | 808 | cc_call_handle_t call_handle, |
michael@0 | 809 | cc_groupid_t group_id, |
michael@0 | 810 | cc_streamid_t stream_id, |
michael@0 | 811 | cc_uint16_t direction); |
michael@0 | 812 | |
michael@0 | 813 | /** |
michael@0 | 814 | * Stop the tone being played. |
michael@0 | 815 | * |
michael@0 | 816 | * Description: Stop the tone being played currently |
michael@0 | 817 | * |
michael@0 | 818 | * |
michael@0 | 819 | * @param[in] tone - tone to be stopeed |
michael@0 | 820 | * @param[in] group_id - associated stream's group |
michael@0 | 821 | * @param[in] stream_id - associated stream id |
michael@0 | 822 | * @param[in] call_handle - the context (call) for this tone. |
michael@0 | 823 | * |
michael@0 | 824 | * @return void |
michael@0 | 825 | * |
michael@0 | 826 | */ |
michael@0 | 827 | |
michael@0 | 828 | void vcmToneStop(vcm_tones_t tone, |
michael@0 | 829 | cc_groupid_t group_id, |
michael@0 | 830 | cc_streamid_t stream_id, |
michael@0 | 831 | cc_call_handle_t call_handle); |
michael@0 | 832 | |
michael@0 | 833 | /** |
michael@0 | 834 | * start/stop ringing |
michael@0 | 835 | * |
michael@0 | 836 | * @param[in] ringMode - VCM ring mode (ON/OFF) |
michael@0 | 837 | * @param[in] once - type of ring - continuous or one shot. |
michael@0 | 838 | * @param[in] alert_info - header specified ring mode. |
michael@0 | 839 | * @param[in] line - the line on which to start/stop ringing |
michael@0 | 840 | * |
michael@0 | 841 | * @return void |
michael@0 | 842 | */ |
michael@0 | 843 | |
michael@0 | 844 | void vcmControlRinger(vcm_ring_mode_t ringMode, |
michael@0 | 845 | short once, |
michael@0 | 846 | cc_boolean alert_info, |
michael@0 | 847 | int line, |
michael@0 | 848 | cc_callid_t call_id); |
michael@0 | 849 | |
michael@0 | 850 | |
michael@0 | 851 | /** |
michael@0 | 852 | * Get current list of audio codec that could be used |
michael@0 | 853 | * @param request_type - |
michael@0 | 854 | * The request_type should be VCM_DECODEONLY/ENCODEONLY/FULLDUPLEX/IGNORE |
michael@0 | 855 | * |
michael@0 | 856 | * @return A bit mask should be returned that specifies the list of the audio |
michael@0 | 857 | * codecs. The bit mask should conform to the defines in this file. |
michael@0 | 858 | * #define VCM_RESOURCE_G711 0x00000001 |
michael@0 | 859 | * #define VCM_RESOURCE_G729A 0x00000002 |
michael@0 | 860 | * .... |
michael@0 | 861 | */ |
michael@0 | 862 | |
michael@0 | 863 | int vcmGetAudioCodecList(int request_type); |
michael@0 | 864 | |
michael@0 | 865 | /** |
michael@0 | 866 | * Get current list of video codec that could be used |
michael@0 | 867 | * @param request_type - |
michael@0 | 868 | * The request_type should be VCM_DECODEONLY/ENCODEONLY/FULLDUPLEX/IGNORE |
michael@0 | 869 | * |
michael@0 | 870 | * @return A bit mask should be returned that specifies the list of the audio |
michael@0 | 871 | * codecs. The bit mask should conform to the defines in this file. |
michael@0 | 872 | * #define VCM_RESOURCE_G711 0x00000001 |
michael@0 | 873 | * #define VCM_RESOURCE_G729A 0x00000002 |
michael@0 | 874 | * .... |
michael@0 | 875 | */ |
michael@0 | 876 | |
michael@0 | 877 | int vcmGetVideoCodecList(int request_type); |
michael@0 | 878 | |
michael@0 | 879 | /** |
michael@0 | 880 | * Get max supported H.264 video packetization mode. |
michael@0 | 881 | * @return maximum supported video packetization mode for H.264. Value returned |
michael@0 | 882 | * must be 0 or 1. Value 2 is not supported yet. |
michael@0 | 883 | */ |
michael@0 | 884 | int vcmGetVideoMaxSupportedPacketizationMode(); |
michael@0 | 885 | |
michael@0 | 886 | /** |
michael@0 | 887 | * Get the rx/tx stream statistics associated with the call. |
michael@0 | 888 | * The rx/tx stats are defined as comma seperated string as follows. |
michael@0 | 889 | * Rx_stats: |
michael@0 | 890 | * snprintf(rx_stats, CC_KFACTOR_STAT_LEN, |
michael@0 | 891 | * "Dur=%d,Pkt=%d,Oct=%d,LatePkt=%d,LostPkt=%d,AvgJit=%d,VQMetrics=\"%s\"", |
michael@0 | 892 | * duration, numberOfPackageReceived, numberOfByteReceived, numberOfLatePackage, numberOfPackageLost, averageJitter, qualityMatrics); |
michael@0 | 893 | * Tx_stats: |
michael@0 | 894 | * snprintf(tx_stats, CC_KFACTOR_STAT_LEN, "Dur=%d,Pkt=%d,Oct=%d", |
michael@0 | 895 | * duration, numberOfPackageSent, numberOfByteSend); |
michael@0 | 896 | * |
michael@0 | 897 | *Example: |
michael@0 | 898 | * |
michael@0 | 899 | * vcm_rtp_get_stats : rx_stats:Dur=1,Pkt=90,Oct=15480,LatePkt=0,LostPkt=0,AvgJit=0,VQMetrics="MLQK=0.0;MLQKav=0.0;MLQKmn=0.0;MLQKmx=0.0;MLQKvr=0.95;CCR=0.0;ICR=0.0;ICRmx=0.0;CS=0;SCS=0" |
michael@0 | 900 | * vcm_rtp_get_stats : tx_stats:Dur=1,Pkt=92,Oct=14720 |
michael@0 | 901 | * Where the duration can be calculated, the numberOfLatePackage set to 0. |
michael@0 | 902 | * |
michael@0 | 903 | * @param[in] mcap_id - media type (audio/video) |
michael@0 | 904 | * @param[in] group_id - group id of the stream |
michael@0 | 905 | * @param[in] stream_id - stram id of the stream |
michael@0 | 906 | * @param[in] call_handle - call handle |
michael@0 | 907 | * @param[out] rx_stats - ptr to the rx field in the stats struct, see above. |
michael@0 | 908 | * @param[out] tx_stats - ptr to the tx field in the stats struct, see above. |
michael@0 | 909 | * |
michael@0 | 910 | */ |
michael@0 | 911 | |
michael@0 | 912 | int vcmGetRtpStats(cc_mcapid_t mcap_id, |
michael@0 | 913 | cc_groupid_t group_id, |
michael@0 | 914 | cc_streamid_t stream_id, |
michael@0 | 915 | cc_call_handle_t call_handle, |
michael@0 | 916 | char *rx_stats, |
michael@0 | 917 | char *tx_stats); |
michael@0 | 918 | |
michael@0 | 919 | /** |
michael@0 | 920 | * |
michael@0 | 921 | * The wlan interface puts into unique situation where call control |
michael@0 | 922 | * has to allocate the worst case bandwith before creating a |
michael@0 | 923 | * inbound or outbound call. The function call will interface through |
michael@0 | 924 | * media API into wlan to get the call bandwidth. The function |
michael@0 | 925 | * return is asynchronous and will block till the return media |
michael@0 | 926 | * callback signals to continue the execution. |
michael@0 | 927 | * |
michael@0 | 928 | * @note If not using WLAN interface simply return true |
michael@0 | 929 | * |
michael@0 | 930 | * @return true if the bandwidth can be allocated else false. |
michael@0 | 931 | */ |
michael@0 | 932 | |
michael@0 | 933 | cc_boolean vcmAllocateBandwidth(cc_call_handle_t call_handle, int sessions); |
michael@0 | 934 | |
michael@0 | 935 | /** |
michael@0 | 936 | * |
michael@0 | 937 | * Free the bandwidth allocated for this call |
michael@0 | 938 | * using the vcmAllocateBandwidth API |
michael@0 | 939 | * |
michael@0 | 940 | * @note If not using WLAN provide a stub |
michael@0 | 941 | */ |
michael@0 | 942 | |
michael@0 | 943 | void vcmRemoveBandwidth(cc_call_handle_t call_handle); |
michael@0 | 944 | |
michael@0 | 945 | /** |
michael@0 | 946 | * @brief vcmActivateWlan |
michael@0 | 947 | * |
michael@0 | 948 | * Free the bandwidth allocated for this call |
michael@0 | 949 | * using the vcmAllocateBandwidth API |
michael@0 | 950 | * |
michael@0 | 951 | * @note If not using WLAN provide a stub |
michael@0 | 952 | */ |
michael@0 | 953 | |
michael@0 | 954 | void vcmActivateWlan(cc_boolean is_active); |
michael@0 | 955 | |
michael@0 | 956 | /** |
michael@0 | 957 | * free the media pointer allocated in vcm_negotiate_attrs method |
michael@0 | 958 | * |
michael@0 | 959 | * @param ptr - pointer to be freed |
michael@0 | 960 | * |
michael@0 | 961 | * @return void |
michael@0 | 962 | */ |
michael@0 | 963 | void vcmFreeMediaPtr(void *ptr); |
michael@0 | 964 | |
michael@0 | 965 | /** |
michael@0 | 966 | * MEDIA control received from far end on signaling path |
michael@0 | 967 | * |
michael@0 | 968 | * @param call_handle - call handle of the call |
michael@0 | 969 | * @param to_encoder - the control request received |
michael@0 | 970 | * Only FAST_PICTURE_UPDATE is supported |
michael@0 | 971 | * |
michael@0 | 972 | * @return void |
michael@0 | 973 | * |
michael@0 | 974 | */ |
michael@0 | 975 | |
michael@0 | 976 | void vcmMediaControl(cc_call_handle_t call_handle, vcm_media_control_to_encoder_t to_encoder); |
michael@0 | 977 | |
michael@0 | 978 | /** |
michael@0 | 979 | * specifies DSCP marking for RTCP streams |
michael@0 | 980 | * |
michael@0 | 981 | * @param group_id - group id of the stream |
michael@0 | 982 | * @param dscp - the DSCP value to be used |
michael@0 | 983 | * |
michael@0 | 984 | * @return void |
michael@0 | 985 | */ |
michael@0 | 986 | |
michael@0 | 987 | void vcmSetRtcpDscp(cc_groupid_t group_id, int dscp); |
michael@0 | 988 | |
michael@0 | 989 | /** |
michael@0 | 990 | * Verify if the SDP attributes for the requested video codec are acceptable |
michael@0 | 991 | * |
michael@0 | 992 | * This method is called for video codecs only. This method should parse the |
michael@0 | 993 | * Video SDP attributes using the SDP helper API and verify if received |
michael@0 | 994 | * attributes are acceptable. If the attributes are acceptable any attribute |
michael@0 | 995 | * values if needed by vcmTxStart method should be bundled in the desired |
michael@0 | 996 | * structure and its pointer should be returned in rccappptr. This opaque |
michael@0 | 997 | * pointer shall be provided again when vcmTxStart is invoked. |
michael@0 | 998 | * |
michael@0 | 999 | * @param [in] media_type - codec for which we are negotiating |
michael@0 | 1000 | * @param [in] sdp_p - opaque SDP pointer to be used via SDP helper APIs |
michael@0 | 1001 | * @param [in] level - Parameter to be used with SDP helper APIs |
michael@0 | 1002 | * @param [out] rcapptr - variable to return the allocated attrib structure |
michael@0 | 1003 | * |
michael@0 | 1004 | * @return cc_boolean - true if attributes are accepted false otherwise |
michael@0 | 1005 | */ |
michael@0 | 1006 | |
michael@0 | 1007 | cc_boolean vcmCheckAttribs(cc_uint32_t media_type, void *sdp_p, int level, void **rcapptr); |
michael@0 | 1008 | |
michael@0 | 1009 | /** |
michael@0 | 1010 | * Add Video attributes in the offer/answer SDP |
michael@0 | 1011 | * |
michael@0 | 1012 | * This method is called for video codecs only. This method should populate the |
michael@0 | 1013 | * Video SDP attributes using the SDP helper API |
michael@0 | 1014 | * |
michael@0 | 1015 | * @param [in] sdp_p - opaque SDP pointer to be used via SDP helper APIs |
michael@0 | 1016 | * @param [in] level - Parameter to be used with SDP helper APIs |
michael@0 | 1017 | * @param [in] media_type - codec for which the SDP attributes are to be populated |
michael@0 | 1018 | * @param [in] payload_number - RTP payload type used for the SDP |
michael@0 | 1019 | * @param [in] isOffer - cc_boolean indicating we are encoding an offer or an aswer |
michael@0 | 1020 | * |
michael@0 | 1021 | * @return void |
michael@0 | 1022 | */ |
michael@0 | 1023 | |
michael@0 | 1024 | |
michael@0 | 1025 | void vcmPopulateAttribs(void *sdp_p, int level, cc_uint32_t media_type, |
michael@0 | 1026 | cc_uint16_t payload_number, cc_boolean isOffer); |
michael@0 | 1027 | |
michael@0 | 1028 | |
michael@0 | 1029 | /** |
michael@0 | 1030 | * Send a DTMF digit |
michael@0 | 1031 | * |
michael@0 | 1032 | * This method is called for sending a DTMF tone for the specified duration |
michael@0 | 1033 | * |
michael@0 | 1034 | * @param [in] digit - the DTMF digit that needs to be played out. |
michael@0 | 1035 | * @param [in] duration - duration of the tone |
michael@0 | 1036 | * @param [in] direction - direction in which the tone needs to be played. |
michael@0 | 1037 | * |
michael@0 | 1038 | * @return void |
michael@0 | 1039 | */ |
michael@0 | 1040 | int vcmDtmfBurst(int digit, int duration, int direction); |
michael@0 | 1041 | |
michael@0 | 1042 | /** |
michael@0 | 1043 | * vcmGetILBCMode |
michael@0 | 1044 | * |
michael@0 | 1045 | * This method should return the mode that needs to be used in |
michael@0 | 1046 | * SDP |
michael@0 | 1047 | * @return int |
michael@0 | 1048 | */ |
michael@0 | 1049 | int vcmGetILBCMode(); |
michael@0 | 1050 | |
michael@0 | 1051 | /** |
michael@0 | 1052 | * vcmOnSdpParseError |
michael@0 | 1053 | * |
michael@0 | 1054 | * This method is called for each parsing error of SDP. It does not necessarily |
michael@0 | 1055 | * mean the SDP read was fatal and can be called many times for the same SDP. |
michael@0 | 1056 | * |
michael@0 | 1057 | */ |
michael@0 | 1058 | int vcmOnSdpParseError(const char *peercconnection, const char *message); |
michael@0 | 1059 | |
michael@0 | 1060 | /** |
michael@0 | 1061 | * vcmDisableRtcpComponent |
michael@0 | 1062 | * |
michael@0 | 1063 | * If we are doing rtcp-mux we need to disable component number 2 in the ICE |
michael@0 | 1064 | * layer. Otherwise we will wait for it to connect when it is unused |
michael@0 | 1065 | */ |
michael@0 | 1066 | int vcmDisableRtcpComponent(const char *peerconnection, int level); |
michael@0 | 1067 | |
michael@0 | 1068 | short vcmGetVideoMaxFs(uint16_t codec, int32_t *max_fs); |
michael@0 | 1069 | |
michael@0 | 1070 | short vcmGetVideoMaxFr(uint16_t codec, int32_t *max_fs); |
michael@0 | 1071 | |
michael@0 | 1072 | //Using C++ for gips. This is the end of extern "C" above. |
michael@0 | 1073 | #ifdef __cplusplus |
michael@0 | 1074 | } |
michael@0 | 1075 | #endif |
michael@0 | 1076 | |
michael@0 | 1077 | |
michael@0 | 1078 | |
michael@0 | 1079 | |
michael@0 | 1080 | #endif /* _VCM_H_ */ |