Enforce METROPOLIS support
This commit is contained in:
parent
b71b84034d
commit
3ac62adb50
|
@ -44,6 +44,7 @@ typedef struct tdav_session_bfcp_s
|
|||
|
||||
struct tbfcp_session_s* p_bfcp_s;
|
||||
struct tbfcp_pkt_s* p_pkt_FloorRequest;
|
||||
struct tbfcp_pkt_s* p_pkt_FloorRelease;
|
||||
struct tbfcp_pkt_s* p_pkt_Hello;
|
||||
|
||||
tsk_bool_t b_use_ipv6;
|
||||
|
@ -436,14 +437,14 @@ static int _tdav_session_bfcp_notif(const struct tbfcp_session_event_xs *e)
|
|||
#define _RAISE_ERR_AND_GOTO_BAIL(_code, _reason) \
|
||||
if (TMEDIA_SESSION(p_bfcp)->bfcp_cb.fun) { \
|
||||
tmedia_session_bfcp_evt_xt e; \
|
||||
e.err.code = _code; e.reason = _reason; \
|
||||
e.type = tmedia_session_bfcp_evt_type_err; e.err.code = _code; e.reason = _reason; \
|
||||
TMEDIA_SESSION(p_bfcp)->bfcp_cb.fun(TMEDIA_SESSION(p_bfcp)->bfcp_cb.usrdata, TMEDIA_SESSION(p_bfcp), &e); \
|
||||
} \
|
||||
ret = _code; goto bail;
|
||||
#define _RAISE_FLREQ(_status, _reason) \
|
||||
if (TMEDIA_SESSION(p_bfcp)->bfcp_cb.fun) { \
|
||||
tmedia_session_bfcp_evt_xt e; \
|
||||
e.flreq.status = _status; e.reason = _reason; \
|
||||
e.type = tmedia_session_bfcp_evt_type_flreq_status; e.flreq.status = _status; e.reason = _reason; \
|
||||
TMEDIA_SESSION(p_bfcp)->bfcp_cb.fun(TMEDIA_SESSION(p_bfcp)->bfcp_cb.usrdata, TMEDIA_SESSION(p_bfcp), &e); \
|
||||
} \
|
||||
|
||||
|
@ -517,6 +518,7 @@ static int _tdav_session_bfcp_notif(const struct tbfcp_session_event_xs *e)
|
|||
}
|
||||
|
||||
if (pc_attr_RequestStatus) {
|
||||
// https://tools.ietf.org/html/rfc4582#section-5.2.5
|
||||
uint16_t u_status = pc_attr_RequestStatus->OctetString16[0] + (pc_attr_RequestStatus->OctetString16[1] << 8);
|
||||
_RAISE_FLREQ(u_status, kInfoTextFloorReqStatus);
|
||||
}
|
||||
|
@ -583,6 +585,7 @@ static tsk_object_t* _tdav_session_bfcp_dtor(tsk_object_t * p_self)
|
|||
|
||||
TSK_OBJECT_SAFE_FREE(p_session->p_bfcp_s);
|
||||
TSK_OBJECT_SAFE_FREE(p_session->p_pkt_FloorRequest);
|
||||
TSK_OBJECT_SAFE_FREE(p_session->p_pkt_FloorRelease);
|
||||
TSK_OBJECT_SAFE_FREE(p_session->p_pkt_Hello);
|
||||
|
||||
TSK_FREE(p_session->p_local_ip);
|
||||
|
|
|
@ -134,7 +134,15 @@ static int tdav_codec_h264_set(tmedia_codec_t* self, const tmedia_param_t* param
|
|||
return 0;
|
||||
}
|
||||
else if(tsk_striequals(param->key, "bw_kbps")){
|
||||
h264->encoder.max_bw_kpbs = *((int32_t*)param->value);
|
||||
int32_t max_bw_userdefine = tmedia_defaults_get_bandwidth_video_upload_max();
|
||||
int32_t max_bw_new = *((int32_t*)param->value);
|
||||
if (max_bw_userdefine > 0) {
|
||||
// do not use more than what the user defined in it's configuration
|
||||
h264->encoder.max_bw_kpbs = TSK_MIN(max_bw_new, max_bw_userdefine);
|
||||
}
|
||||
else {
|
||||
h264->encoder.max_bw_kpbs = max_bw_new;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if(tsk_striequals(param->key, "bypass-encoding")){
|
||||
|
|
|
@ -127,20 +127,20 @@ static int tdav_codec_vp8_set(tmedia_codec_t* self, const tmedia_param_t* param)
|
|||
{
|
||||
tdav_codec_vp8_t* vp8 = (tdav_codec_vp8_t*)self;
|
||||
vpx_codec_err_t vpx_ret = VPX_CODEC_OK;
|
||||
tsk_bool_t reconf = tsk_false;
|
||||
|
||||
if(!vp8->encoder.initialized){
|
||||
if (!vp8->encoder.initialized) {
|
||||
TSK_DEBUG_ERROR("Codec not initialized");
|
||||
return -1;
|
||||
}
|
||||
if(param->value_type == tmedia_pvt_int32){
|
||||
if(tsk_striequals(param->key, "action")){
|
||||
if (param->value_type == tmedia_pvt_int32) {
|
||||
if (tsk_striequals(param->key, "action")) {
|
||||
tmedia_codec_action_t action = (tmedia_codec_action_t)TSK_TO_INT32((uint8_t*)param->value);
|
||||
tsk_bool_t reconf = tsk_false;
|
||||
switch(action){
|
||||
switch (action) {
|
||||
case tmedia_codec_action_encode_idr:
|
||||
{
|
||||
vp8->encoder.force_idr = tsk_true;
|
||||
break;
|
||||
return 0;
|
||||
}
|
||||
case tmedia_codec_action_bw_down:
|
||||
{
|
||||
|
@ -157,47 +157,49 @@ static int tdav_codec_vp8_set(tmedia_codec_t* self, const tmedia_param_t* param)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(reconf){
|
||||
if((vpx_ret = vpx_codec_enc_config_set(&vp8->encoder.context, &vp8->encoder.cfg)) != VPX_CODEC_OK){
|
||||
TSK_DEBUG_ERROR("vpx_codec_enc_config_set failed with error =%s", vpx_codec_err_to_string(vpx_ret));
|
||||
}
|
||||
}
|
||||
return (vpx_ret == VPX_CODEC_OK) ? 0 : -2;
|
||||
}
|
||||
else if(tsk_striequals(param->key, "bandwidth-max-upload")){
|
||||
else if(tsk_striequals(param->key, "bw_kbps")) { // both up and down (from the SDP)
|
||||
int32_t max_bw_userdefine = tmedia_defaults_get_bandwidth_video_upload_max();
|
||||
int32_t max_bw_new = *((int32_t*)param->value);
|
||||
if (max_bw_userdefine > 0) {
|
||||
// do not use more than what the user defined in it's configuration
|
||||
TMEDIA_CODEC(vp8)->bandwidth_max_upload = TSK_MIN(max_bw_new, max_bw_userdefine);
|
||||
}
|
||||
else {
|
||||
TMEDIA_CODEC(vp8)->bandwidth_max_upload= max_bw_new;
|
||||
}
|
||||
reconf = tsk_true;
|
||||
}
|
||||
else if (tsk_striequals(param->key, "bandwidth-max-upload")) {
|
||||
int32_t bw_max_upload = *((int32_t*)param->value);
|
||||
TSK_DEBUG_INFO("VP8 codec: bandwidth-max-upload=%d", bw_max_upload);
|
||||
TMEDIA_CODEC(vp8)->bandwidth_max_upload = bw_max_upload;
|
||||
return 0;
|
||||
reconf = tsk_true;
|
||||
}
|
||||
else if(tsk_striequals(param->key, "rotation")){
|
||||
else if (tsk_striequals(param->key, "rotation")) {
|
||||
// IMPORTANT: changing resolution requires at least libvpx v1.1.0 "Eider"
|
||||
int32_t rotation = *((int32_t*)param->value);
|
||||
if(vp8->encoder.rotation != rotation){
|
||||
vp8->encoder.rotation = rotation;
|
||||
if(vp8->encoder.initialized){
|
||||
#if 1
|
||||
if (vp8->encoder.initialized){
|
||||
vp8->encoder.cfg.g_w = (rotation == 90 || rotation == 270) ? TMEDIA_CODEC_VIDEO(vp8)->out.height : TMEDIA_CODEC_VIDEO(vp8)->out.width;
|
||||
vp8->encoder.cfg.g_h = (rotation == 90 || rotation == 270) ? TMEDIA_CODEC_VIDEO(vp8)->out.width : TMEDIA_CODEC_VIDEO(vp8)->out.height;
|
||||
if((vpx_ret = vpx_codec_enc_config_set(&vp8->encoder.context, &vp8->encoder.cfg)) != VPX_CODEC_OK){
|
||||
TSK_DEBUG_ERROR("vpx_codec_enc_config_set failed with error =%s", vpx_codec_err_to_string(vpx_ret));
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
int ret;
|
||||
if((ret = tdav_codec_vp8_close_encoder(vp8))){
|
||||
return ret;
|
||||
}
|
||||
if((ret = tdav_codec_vp8_open_encoder(vp8))){
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
reconf = tsk_true;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (reconf) {
|
||||
if ((vpx_ret = vpx_codec_enc_config_set(&vp8->encoder.context, &vp8->encoder.cfg)) != VPX_CODEC_OK) {
|
||||
TSK_DEBUG_ERROR("vpx_codec_enc_config_set failed with error =%s", vpx_codec_err_to_string(vpx_ret));
|
||||
}
|
||||
return (vpx_ret == VPX_CODEC_OK) ? 0 : -2;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,44 +96,44 @@ tsk_size_t tsk_base64_encode(const uint8_t* input, tsk_size_t input_size, char *
|
|||
tsk_size_t output_size = 0;
|
||||
|
||||
/* Caller provided his own buffer? */
|
||||
if(!*output){
|
||||
*output = (char*)tsk_calloc(1, (TSK_BASE64_ENCODE_LEN(input_size)+1));
|
||||
if (!*output) {
|
||||
*output = (char*)tsk_calloc((TSK_BASE64_ENCODE_LEN(input_size) + 1), sizeof(char));
|
||||
}
|
||||
|
||||
/* Too short? */
|
||||
if(input_size < TSK_BASE64_ENCODE_BLOCK_SIZE){
|
||||
if (input_size < TSK_BASE64_ENCODE_BLOCK_SIZE) {
|
||||
goto quantum;
|
||||
}
|
||||
|
||||
do{
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ input[i]>> 2 ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ (input[i]<<4 | input[i+1]>>4) & 0x3F ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ (input[i+1]<<2 | input[i+2]>>6) & 0x3F ];
|
||||
do {
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ (input[i]>> 2) & 0x3F ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ ((input[i]<<4) | (input[i+1]>>4)) & 0x3F ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ ((input[i+1]<<2) | (input[i+2]>>6)) & 0x3F ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ input[i+2] & 0x3F ];
|
||||
|
||||
i += TSK_BASE64_ENCODE_BLOCK_SIZE;
|
||||
}
|
||||
while(( i+ TSK_BASE64_ENCODE_BLOCK_SIZE) <= input_size);
|
||||
while (( i + TSK_BASE64_ENCODE_BLOCK_SIZE) <= input_size);
|
||||
|
||||
quantum:
|
||||
|
||||
if((input_size - i) == 1){
|
||||
if ((input_size - i) == 1) {
|
||||
/* The final quantum of encoding input is exactly 8 bits; here, the
|
||||
final unit of encoded output will be two characters followed by
|
||||
two "=" padding characters.
|
||||
*/
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ input[i]>> 2 ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ input[i]<<4 & 0x3F ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ (input[i]>> 2) & 0x3F ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ (input[i]<<4) & 0x3F ];
|
||||
*(*output + output_size++) = TSK_BASE64_PAD, *(*output + output_size++) = TSK_BASE64_PAD;
|
||||
}
|
||||
else if((input_size-i) == 2){
|
||||
else if ((input_size - i) == 2) {
|
||||
/* The final quantum of encoding input is exactly 16 bits; here, the
|
||||
final unit of encoded output will be three characters followed by
|
||||
one "=" padding character.
|
||||
*/
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ input[i]>> 2 ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ (input[i]<<4 | input[i+1]>>4) & 0x3F ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ (input[i+1]<<2 | input[i+2]>>6) & 0x3F ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ (input[i]>> 2) & 0x3F ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ ((input[i]<<4) | (input[i+1]>>4)) & 0x3F ];
|
||||
*(*output + output_size++) = TSK_BASE64_ENCODE_ALPHABET [ ((input[i+1]<<2) | (input[i+2]>>6)) & 0x3F ];
|
||||
*(*output + output_size++) = TSK_BASE64_PAD;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue