1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/signaling/src/sipcc/stub/vcm_stub.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,539 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +/** @mainpage VCM APIs. 1.9 + * 1.10 + * @section Introduction 1.11 + * This module contains command APIs to the media layer 1.12 + */ 1.13 + 1.14 +/** 1.15 + * @file vcm.h 1.16 + * @brief APIs to interface with the Media layer. 1.17 + * 1.18 + * This file contains API that interface to the media layer on the platform. 1.19 + * The following APIs need to be implemented to have the sip stack interact 1.20 + * and issue commands to the media layer. 1.21 + */ 1.22 + 1.23 +#include "cpr_types.h" 1.24 +#include "vcm.h" 1.25 +#include "rtp_defs.h" 1.26 +#include "ccsdp.h" 1.27 + 1.28 + 1.29 +/** 1.30 + * The initialization of the VCM module 1.31 + * 1.32 + */ 1.33 +void vcmInit() 1.34 +{ 1.35 + return ; 1.36 +} 1.37 + 1.38 +/** 1.39 + * Should we remove this from external API 1.40 + * 1.41 + * @param[in] mcap_id - group identifier to which stream belongs. 1.42 + * @param[in] group_id - group identifier 1.43 + * @param[in] cc_stream_id - stream identifier 1.44 + * @param[in] call_handle - call handle 1.45 + * @param[in] port_requested - requested port. 1.46 + * @param[in] listen_ip - local IP for listening 1.47 + * @param[in] is_multicast - multicast stream? 1.48 + * @param[in,out] port_allocated - allocated(reserved) port 1.49 + * 1.50 + * tbd need to see if we can deprecate this API 1.51 + * 1.52 + * @return 0 success, ERROR failure. 1.53 + * 1.54 + */ 1.55 + 1.56 +short vcmRxOpen(cc_mcapid_t mcap_id, cc_groupid_t group_id, cc_streamid_t stream_id, cc_call_handle_t call_handle, 1.57 + uint16_t port_requested, cpr_ip_addr_t *listen_ip, 1.58 + boolean is_multicast, int *port_allocated) 1.59 +{ 1.60 + return 0; 1.61 +} 1.62 +/*! 1.63 + * should we remove from external API 1.64 + * 1.65 + * @param[in] mcap_id - Media Capability ID 1.66 + * @param[in] group_id - group to which stream belongs 1.67 + * @param[in] cc_stream_id - stream identifier 1.68 + * @param[in] call_handle - call handle 1.69 + * 1.70 + * @return zero(0) for success otherwise, ERROR for failure 1.71 + * 1.72 + */ 1.73 + 1.74 +short vcmTxOpen(cc_mcapid_t mcap_id, cc_groupid_t group_id, cc_streamid_t stream_id, cc_call_handle_t call_handle) 1.75 +{ 1.76 + return 0; 1.77 +} 1.78 + 1.79 +/*! 1.80 + * Allocate(Reserve) a receive port. 1.81 + * 1.82 + * @param[in] mcap_id - Media Capability ID 1.83 + * @param[in] group_id - group identifier to which stream belongs. 1.84 + * @param[in] cc_stream_id - stream identifier 1.85 + * @param[in] call_handle - call handle 1.86 + * @param[in] port_requested - port requested (if zero -> give any) 1.87 + * @param[out] port_allocated - port that was actually allocated. 1.88 + * 1.89 + * @return void 1.90 + * 1.91 + */ 1.92 + 1.93 +void vcmRxAllocPort(cc_mcapid_t mcap_id, cc_groupid_t group_id, cc_streamid_t stream_id, cc_call_handle_t call_handle, 1.94 + uint16_t port_requested, int *port_allocated) 1.95 +{ 1.96 + return; 1.97 +} 1.98 + 1.99 +/*! 1.100 + * Release the allocated port 1.101 + * @param[in] mcap_id - media capability id (0 is audio) 1.102 + * @param[in] group_id - group identifier 1.103 + * @param[in] cc_stream_id - stream identifier 1.104 + * @param[in] call_handle - call handle 1.105 + * @param[in] port - port to be released 1.106 + * 1.107 + * @return void 1.108 + */ 1.109 + 1.110 +void vcmRxReleasePort(cc_mcapid_t mcap_id, cc_groupid_t group_id,cc_streamid_t stream_id, cc_call_handle_t call_handle, int port) 1.111 +{ 1.112 + return; 1.113 +} 1.114 + 1.115 +/*! 1.116 + * Start receive stream 1.117 + * Note: For video calls, for a given call_id there will be 1.118 + * two media lines and the corresponding group_id/cc_stream_id pair. 1.119 + * One RTP session is requested from media server for each 1.120 + * media line(group/stream) i.e. a video call would result in 1.121 + * two rtp_sessions in our session info list created by two 1.122 + * calls to vcm_rx/tx with mcap_id of AUDIO and VIDEO respectively. 1.123 + * 1.124 + * @param[in] mcap_id - media type id 1.125 + * @param[in] group_id - group identifier associated with the stream 1.126 + * @param[in] cc_stream_id - id of the stream one per each media line 1.127 + * @param[in] call_handle - call handle 1.128 + * @param[in] payload - payload type 1.129 + * @param[in] local_addr - local ip address to use. 1.130 + * @param[in] port - local port (receive) 1.131 + * @param[in] algorithmID - crypto alogrithm ID 1.132 + * @param[in] rx_key - rx key used when algorithm ID is encrypting 1.133 + * @param[in] attrs - media attributes 1.134 + * 1.135 + * @return zero(0) for success otherwise, -1 for failure 1.136 + * 1.137 + */ 1.138 + 1.139 +int vcmRxStart(cc_mcapid_t mcap_id, cc_groupid_t group_id, cc_streamid_t 1.140 + stream_id, cc_call_handle_t call_handle, 1.141 + const vcm_payload_info_t *payload, cpr_ip_addr_t *local_addr, 1.142 + uint16_t port, vcm_crypto_algorithmID algorithmID, 1.143 + vcm_crypto_key_t *rx_key, vcm_mediaAttrs_t *attrs) 1.144 +{ 1.145 + return 0; 1.146 +} 1.147 + 1.148 +/** 1.149 + * start tx stream 1.150 + * Note: For video calls, for a given call_id there will be 1.151 + * two media lines and the corresponding group_id/cc_stream_id pair. 1.152 + * One RTP session is requested from media server for each 1.153 + * media line(group/stream) i.e. a video call would result in 1.154 + * two rtp_sessions in our session info list created by two 1.155 + * calls to vcm_rx/tx with mcap_id of AUDIO and VIDEO respectively. 1.156 + * 1.157 + * @param[in] mcap_id - media cap id 1.158 + * @param[in] group_id - group identifier to which the stream belongs 1.159 + * @param[in] cc_stream_id - stream id of the given media type. 1.160 + * @param[in] call_handle - call handle 1.161 + * @param[in] payload - payload type 1.162 + * @param[in] tos - bit marking 1.163 + * @param[in] local_addr - local address 1.164 + * @param[in] local_port - local port 1.165 + * @param[in] remote_ip_addr - remote ip address 1.166 + * @param[in] remote_port - remote port 1.167 + * @param[in] algorithmID - crypto alogrithm ID 1.168 + * @param[in] tx_key - tx key used when algorithm ID is encrypting. 1.169 + * @param[in] attrs - media attributes 1.170 + * 1.171 + * Returns: zero(0) for success otherwise, ERROR for failure 1.172 + * 1.173 + */ 1.174 + 1.175 +int vcmTxStart(cc_mcapid_t mcap_id, cc_groupid_t group_id, 1.176 + cc_streamid_t stream_id, cc_call_handle_t call_handle, 1.177 + const vcm_payload_info_t *payload, short tos, 1.178 + cpr_ip_addr_t *local_addr, uint16_t local_port, 1.179 + cpr_ip_addr_t *remote_ip_addr, uint16_t remote_port, 1.180 + vcm_crypto_algorithmID algorithmID, vcm_crypto_key_t *tx_key, 1.181 + vcm_mediaAttrs_t *attrs) 1.182 +{ 1.183 + return 0; 1.184 +} 1.185 + 1.186 +/*! 1.187 + * Close the receive stream. 1.188 + * 1.189 + * @param[in] mcap_id - Media Capability ID 1.190 + * @param[in] group_id - group identifier that belongs to the stream. 1.191 + * @param[in] cc_stream_id - stream id of the given media type. 1.192 + * @param[in] call_handle - call handle 1.193 + * 1.194 + * @return None 1.195 + * 1.196 + */ 1.197 + 1.198 +void vcmRxClose(cc_mcapid_t mcap_id, cc_groupid_t group_id,cc_streamid_t stream_id, cc_call_handle_t call_handle) 1.199 +{ 1.200 + return; 1.201 +} 1.202 + 1.203 +/** 1.204 + * Close the transmit stream 1.205 + * 1.206 + * @param[in] mcap_id - Media Capability ID 1.207 + * @param[in] group_id - identifier of the group to which stream belongs 1.208 + * @param[in] cc_stream_id - stream id of the given media type. 1.209 + * @param[in] call_handle - call handle 1.210 + * 1.211 + * @return void 1.212 + */ 1.213 + 1.214 +void vcmTxClose(cc_mcapid_t mcap_id, cc_groupid_t group_id, cc_streamid_t stream_id, cc_call_handle_t call_handleS) 1.215 +{ 1.216 + return; 1.217 +} 1.218 + 1.219 +/** 1.220 + * To be Deprecated 1.221 + * This may be needed to be implemented if the DSP doesn't automatically enable the side tone 1.222 + * The stack will make a call to this method based on the call state. Provide a stub if this is not needed. 1.223 + * 1.224 + * @param[in] side_tone - boolean to enable/disable side tone 1.225 + * 1.226 + * @return void 1.227 + * 1.228 + */ 1.229 +void vcmEnableSidetone(uint16_t side_tone) 1.230 +{ 1.231 + return; 1.232 +} 1.233 + 1.234 +/** 1.235 + * Start a tone (continuous) 1.236 + * 1.237 + * Parameters: 1.238 + * @param[in] tone - tone type 1.239 + * @param[in] alert_info - alertinfo header 1.240 + * @param[in] call_handle - call handle 1.241 + * @param[in] group_id - identifier of the group to which stream belongs 1.242 + * @param[in] cc_stream_id - stream identifier. 1.243 + * @param[in] direction - network, speaker, both 1.244 + * 1.245 + * @return void 1.246 + * 1.247 + */ 1.248 + 1.249 +void vcmToneStart(vcm_tones_t tone, short alert_info, cc_call_handle_t call_handle, cc_groupid_t group_id, 1.250 + cc_streamid_t stream_id, uint16_t direction) 1.251 +{ 1.252 + return; 1.253 +} 1.254 + 1.255 +/** 1.256 + * Plays a short tone. uses the open audio path. 1.257 + * If no audio path is open, plays on speaker. 1.258 + * 1.259 + * @param[in] tone - tone type 1.260 + * @param[in] alert_info - alertinfo header 1.261 + * @param[in] call_handle - call handle 1.262 + * @param[in] group_id - identifier of the group to which stream belongs 1.263 + * @param[in] cc_stream_id - stream identifier. 1.264 + * @param[in] direction - network, speaker, both 1.265 + * 1.266 + * @return void 1.267 + */ 1.268 + 1.269 +void vcmToneStartWithSpeakerAsBackup(vcm_tones_t tone, short alert_info, cc_call_handle_t call_handle, cc_groupid_t group_id, 1.270 + cc_streamid_t stream_id, uint16_t direction) 1.271 +{ 1.272 + return; 1.273 +} 1.274 + 1.275 +/** 1.276 + * Stop the tone being played. 1.277 + * 1.278 + * Description: Stop the tone being played currently 1.279 + * 1.280 + * 1.281 + * @param[in] tone - tone to be stopeed 1.282 + * @param[in] group_id - associated stream's group 1.283 + * @param[in] cc_stream_id - associated stream id 1.284 + * @param[in] call_handle - the context (call) for this tone. 1.285 + * 1.286 + * @return void 1.287 + * 1.288 + */ 1.289 + 1.290 +void vcmToneStop(vcm_tones_t tone, cc_groupid_t group_id, cc_streamid_t cc_stream_id, cc_call_handle_t call_handle) 1.291 +{ 1.292 + return; 1.293 +} 1.294 + 1.295 +/** 1.296 + * start/stop ringing 1.297 + * 1.298 + * @param[in] ringMode - VCM ring mode (ON/OFF) 1.299 + * @param[in] once - type of ring - continuous or one shot. 1.300 + * @param[in] alert_info - header specified ring mode. 1.301 + * @param[in] line - the line on which to start/stop ringing 1.302 + * 1.303 + * @return void 1.304 + */ 1.305 + 1.306 +void vcmControlRinger(vcm_ring_mode_t ringMode, short once, 1.307 + boolean alert_info, int line, cc_callid_t call_id) 1.308 +{ 1.309 + return; 1.310 +} 1.311 + 1.312 + 1.313 +/** 1.314 + * Enable / disable speaker 1.315 + * 1.316 + * @param[in] state - true -> enable speaker, false -> disable speaker 1.317 + * 1.318 + * @return void 1.319 + */ 1.320 + 1.321 +void vcmSetSpeakerMode(boolean state) 1.322 +{ 1.323 + return; 1.324 +} 1.325 + 1.326 +/** 1.327 + * Get current list of audio codec that could be used 1.328 + * @param request_type - sendonly/recvonly/sendrecv 1.329 + */ 1.330 + 1.331 +int vcmGetAudioCodecList(int request_type) 1.332 +{ 1.333 + return 0; 1.334 +} 1.335 +/** 1.336 + * Get current list of video codec that could be used 1.337 + * @param request_type - sendonly/recvonly/sendrecv 1.338 + */ 1.339 + 1.340 +int vcmGetVideoCodecList(int request_type) 1.341 +{ 1.342 + return 0; 1.343 +} 1.344 + 1.345 +/** 1.346 + * Get max supported video packetization mode for H.264 video 1.347 + */ 1.348 +/* 1.349 +int vcmGetVideoMaxSupportedPacketizationMode() 1.350 +{ 1.351 + return 0; 1.352 +} 1.353 +*/ 1.354 +/** 1.355 + * Get the rx/tx stream statistics associated with the call. 1.356 + * 1.357 + * @param[in] mcap_id - media type (audio/video) 1.358 + * @param[in] group_id - group id of the stream 1.359 + * @param[in] cc_stream_id - stram id of the stream 1.360 + * @param[in] call_handle - call handle 1.361 + * @param[out] rx_stats - ptr to the rx field in the stats struct 1.362 + * @param[out] tx_stats - ptr to the tx field in the stats struct 1.363 + * 1.364 + */ 1.365 + 1.366 +/* 1.367 +int vcmGetRtpStats(cc_mcapid_t mcap_id, cc_groupid_t group_id, 1.368 + cc_streamid_t stream_id, cc_call_handle_t call_handle, 1.369 + char *rx_stats, char *tx_stats) 1.370 +{ 1.371 + return 0; 1.372 +} 1.373 +*/ 1.374 + 1.375 +/** 1.376 + * 1.377 + * The wlan interface puts into unique situation where call control 1.378 + * has to allocate the worst case bandwith before creating a 1.379 + * inbound or outbound call. The function call will interface through 1.380 + * media API into wlan to get the call bandwidth. The function 1.381 + * return is asynchronous and will block till the return media 1.382 + * callback signals to continue the execution. 1.383 + * 1.384 + * @note If not using WLAN interface simply return true 1.385 + * 1.386 + * @return true if the bandwidth can be allocated else false. 1.387 + */ 1.388 + 1.389 +/* 1.390 +boolean vcmAllocateBandwidth(cc_call_handle_t call_handle, int sessions) 1.391 +{ 1.392 + return TRUE; 1.393 +} 1.394 +*/ 1.395 + 1.396 +/** 1.397 + * 1.398 + * Free the bandwidth allocated for this call 1.399 + * using the vcmAllocateBandwidth API 1.400 + * 1.401 + * @note If not using WLAN provide a stub 1.402 + */ 1.403 + 1.404 +/* 1.405 +void vcmRemoveBandwidth(cc_call_handle_t call_handle) 1.406 +{ 1.407 + return; 1.408 +} 1.409 +*/ 1.410 + 1.411 +/** 1.412 + * @brief vcmActivateWlan 1.413 + * 1.414 + * Free the bandwidth allocated for this call 1.415 + * using the vcmAllocateBandwidth API 1.416 + * 1.417 + * @note If not using WLAN provide a stub 1.418 + */ 1.419 + 1.420 +/* 1.421 +void vcmActivateWlan(boolean is_active) 1.422 +{ 1.423 + return; 1.424 +} 1.425 +*/ 1.426 + 1.427 +/** 1.428 + * free the media pointer allocated in vcm_negotiate_attrs method 1.429 + * 1.430 + * @param ptr - pointer to be freed 1.431 + * 1.432 + * @return void 1.433 + */ 1.434 +void vcmFreeMediaPtr(void *ptr) 1.435 +{ 1.436 + return; 1.437 +} 1.438 + 1.439 +/** 1.440 + * MEDIA control received from far end on signaling path 1.441 + * 1.442 + * @param call_handle - call handle of the call 1.443 + * @param to_encoder - the control request received 1.444 + * Only FAST_PICTURE_UPDATE is supported 1.445 + * 1.446 + * @return void 1.447 + * 1.448 + */ 1.449 + 1.450 +/* 1.451 +void vcmMediaControl(cc_call_handle_t call_handle, vcm_media_control_to_encoder_t to_encoder) 1.452 +{ 1.453 + return; 1.454 +} 1.455 +*/ 1.456 + 1.457 +/** 1.458 + * specifies DSCP marking for RTCP streams 1.459 + * 1.460 + * @param group_id - call_id of the call 1.461 + * @param dscp - the DSCP value to be used 1.462 + * 1.463 + * @return void 1.464 + */ 1.465 + 1.466 +/* 1.467 +void vcmSetRtcpDscp(cc_groupid_t group_id, int dscp) 1.468 +{ 1.469 + return; 1.470 +} 1.471 +*/ 1.472 + 1.473 +/** 1.474 + * Verify if the SDP attributes for the requested video codec are acceptable 1.475 + * 1.476 + * This method is called for video codecs only. This method should parse the 1.477 + * Video SDP attributes using the SDP helper API and verify if received 1.478 + * attributes are acceptable. If the attributes are acceptable any attribute 1.479 + * values if needed by vcmTxStart method should be bundled in the desired 1.480 + * structure and its pointer should be returned in rccappptr. This opaque 1.481 + * pointer shall be provided again when vcmTxStart is invoked. 1.482 + * 1.483 + * @param [in] media_type - codec for which we are negotiating 1.484 + * @param [in] sdp_p - opaque SDP pointer to be used via SDP helper APIs 1.485 + * @param [in] level - Parameter to be used with SDP helper APIs 1.486 + * @param [out] rcapptr - variable to return the allocated attrib structure 1.487 + * 1.488 + * @return boolean - true if attributes are accepted false otherwise 1.489 + */ 1.490 + 1.491 +boolean vcmCheckAttribs(uint32_t media_type, void *sdp_p, int level, void **rcapptr) 1.492 +{ 1.493 + return TRUE; 1.494 +} 1.495 + 1.496 +/** 1.497 + * Add Video attributes in the offer/answer SDP 1.498 + * 1.499 + * This method is called for video codecs only. This method should populate the 1.500 + * Video SDP attributes using the SDP helper API 1.501 + * 1.502 + * @param [in] sdp_p - opaque SDP pointer to be used via SDP helper APIs 1.503 + * @param [in] level - Parameter to be used with SDP helper APIs 1.504 + * @param [in] media_type - codec for which the SDP attributes are to be populated 1.505 + * @param [in] payload_number - RTP payload type used for the SDP 1.506 + * @param [in] isOffer - boolean indicating we are encoding an offer or an aswer 1.507 + * 1.508 + * @return void 1.509 + */ 1.510 + 1.511 + 1.512 +void vcmPopulateAttribs(void *sdp_p, int level, uint32_t media_type, 1.513 + uint16_t payload_number, boolean isOffer) 1.514 +{ 1.515 + return; 1.516 +} 1.517 + 1.518 +/** 1.519 + * Send a DTMF digit 1.520 + * 1.521 + * This method is called for sending a DTMF tone for the specified duration 1.522 + * 1.523 + * @param [in] digit - the DTMF digit that needs to be played out. 1.524 + * @param [in] duration - duration of the tone 1.525 + * @param [in] direction - direction in which the tone needs to be played. 1.526 + * 1.527 + * @return void 1.528 + */ 1.529 + 1.530 +/* 1.531 +int vcmDtmfBurst(int digit, int duration, int direction) 1.532 +{ 1.533 + return 0; 1.534 +} 1.535 +*/ 1.536 + 1.537 +/* 1.538 +int vcmGetILBCMode() 1.539 +{ 1.540 + return SIPSDP_ILBC_MODE20; 1.541 +} 1.542 +*/