Miscellaneous fixes (#2969)

* Suppressed various compilation warnings
* Fixed CodeQL warning
* Fixed build warning on Android and Linux
* Fix build warning on Visual Studio
* Update target Android SDK version to 29 (for pjsua2 & app), to avoid gradle error: 'Google Play requires that apps target API level 29 or higher'.
* Add support for Camera2 API to ipjsua android app.
* Fix assertion on Win32 app (MSVC2005) because ICE transport info size is 160 bytes while the allocated buffer is just 144 bytes.
* Enable python unit test on windows for github actions.
* Avoid assertion in pjsua test caused by double calling of pjsua_conf_remove_port()
This commit is contained in:
sauwming 2022-02-24 15:46:01 +08:00 committed by GitHub
parent 062204bd5d
commit 6f197385c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 133 additions and 91 deletions

View File

@ -500,11 +500,25 @@ jobs:
set LIB=%LIB%;%OPENSSL_DIR%\lib
msbuild pjproject-vs14.sln /p:PlatformToolset=v143 /p:Configuration=Release /p:Platform=win32 /p:UseEnv=true
shell: cmd
- name: build test tools cmp_wav
run: |
set /P OPENSSL_DIR=<openssl_dir.txt
cd tests/pjsua/tools
set INCLUDE=%INCLUDE%;%OPENSSL_DIR%\include
set LIB=%LIB%;%OPENSSL_DIR%\lib
call "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat"
msbuild cmp_wav.vcxproj /p:PlatformToolset=v143 /p:Configuration=Release /p:Platform=win32 /p:UseEnv=true
shell: cmd
- name: set up Python 2.7 for pjsua test
uses: actions/setup-python@v2
with:
python-version: 2.7
- name: unit tests
run: |
$env:OPENSSL_DIR = Get-Content .\openssl_dir.txt
$env:PATH+=";$env:OPENSSL_DIR\bin"
cd pjsip/bin; ./pjsip-test-i386-Win32-vc14-Release.exe
cd tests/pjsua; python runall.py
cd ../../pjsip/bin; ./pjsip-test-i386-Win32-vc14-Release.exe
shell: powershell
build-windows-gnu-tls:
@ -618,13 +632,29 @@ jobs:
set LIB=%LIB%;%OPENSSL_DIR%\lib;%LIBVPX_DIR%\lib\x86;%LIBSDL_DIR%\lib\x86
msbuild pjproject-vs14.sln /p:PlatformToolset=v143 /p:Configuration=Release /p:Platform=win32 /p:UseEnv=true
shell: cmd
- name: build test tools cmp_wav
run: |
set /P OPENSSL_DIR=<openssl_dir.txt
set /P LIBVPX_DIR=<libvpx_dir.txt
set /P LIBSDL_DIR=<libsdl_dir.txt
cd tests/pjsua/tools
set INCLUDE=%INCLUDE%;%OPENSSL_DIR%\include;%LIBVPX_DIR%\include;%LIBSDL_DIR%\include\SDL
set LIB=%LIB%;%OPENSSL_DIR%\lib;%LIBVPX_DIR%\lib\x86;%LIBSDL_DIR%\lib\x86
call "%PROGRAMFILES%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat"
msbuild cmp_wav.vcxproj /p:PlatformToolset=v143 /p:Configuration=Release /p:Platform=win32 /p:UseEnv=true
shell: cmd
- name: set up Python 2.7 for pjsua test
uses: actions/setup-python@v2
with:
python-version: 2.7
- name: unit tests
run: |
$env:OPENSSL_DIR = Get-Content .\openssl_dir.txt
$env:LIBVPX_DIR = Get-Content .\libvpx_dir.txt
$env:LIBSDL_DIR = Get-Content .\libsdl_dir.txt
$env:PATH+=";$env:OPENSSL_DIR\bin;$env:LIBVPX_DIR\bin\x86;$env:LIBSDL_DIR\bin\x86;"
cd pjlib/bin; ./pjlib-test-i386-Win32-vc14-Release.exe
cd tests/pjsua; python runall.py
cd ../../pjlib/bin; ./pjlib-test-i386-Win32-vc14-Release.exe
cd ../../pjlib-util/bin; ./pjlib-util-test-i386-Win32-vc14-Release.exe
cd ../../pjmedia/bin/; ./pjmedia-test-i386-Win32-vc14-Release.exe
shell: powershell

View File

@ -185,6 +185,7 @@ static pj_status_t circ_write(circ_buf_t *cb,
*/
#ifndef SSL_SOCK_IMP_USE_OWN_NETWORK
/* Check IP address version. */
static int get_ip_addr_ver(const pj_str_t *host)
{

View File

@ -403,7 +403,7 @@ static pj_status_t grow_heap(pj_timer_heap_t *ht)
memcpy(new_timer_dups, ht->timer_dups,
ht->max_size * sizeof(pj_timer_entry_dup));
for (i = 0; i < ht->cur_size; i++) {
int idx = ht->heap[i] - ht->timer_dups;
int idx = (int)(ht->heap[i] - ht->timer_dups);
// Point to the address in the new array
pj_assert(idx >= 0 && idx < (int)ht->max_size);
new_heap[i] = &new_timer_dups[idx];

View File

@ -1216,7 +1216,7 @@
* Maximum size in bytes of storage buffer of a transport specific info.
*/
#ifndef PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXSIZE
# define PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXSIZE (36*sizeof(long))
# define PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXSIZE (50*sizeof(long))
#endif

View File

@ -1071,7 +1071,6 @@ static pj_status_t and_media_codec_encode(pjmedia_codec *codec,
pj_size_t tx = 0;
pj_int16_t *pcm_in = (pj_int16_t*)input->buf;
pj_uint8_t *bits_out = (pj_uint8_t*) output->buf;
pj_uint8_t pt;
/* Invoke external VAD if codec has no internal VAD */
if (codec_data->vad && codec_data->vad_enabled) {
@ -1101,7 +1100,6 @@ static pj_status_t and_media_codec_encode(pjmedia_codec *codec,
}
nsamples = input->size >> 1;
samples_per_frame = and_media_data->samples_per_frame;
pt = and_media_data->pt;
nframes = nsamples / samples_per_frame;
PJ_ASSERT_RETURN(nsamples % samples_per_frame == 0,
@ -1230,7 +1228,6 @@ static pj_status_t and_media_codec_decode(pjmedia_codec *codec,
unsigned samples_per_frame;
unsigned i;
pj_uint8_t pt;
pj_ssize_t buf_idx = -1;
pj_uint8_t *input_buf;
pj_size_t input_size;
@ -1241,7 +1238,6 @@ static pj_status_t and_media_codec_decode(pjmedia_codec *codec,
pjmedia_frame input_;
pj_bzero(&input_, sizeof(pjmedia_frame));
pt = and_media_data->pt;
samples_per_frame = and_media_data->samples_per_frame;
PJ_ASSERT_RETURN(output_buf_len >= samples_per_frame << 1,

View File

@ -1513,10 +1513,8 @@ static pj_status_t open_h264(and_media_codec_data *and_media_data)
for (i = h264_fmtp.sprop_param_sets_len - code_size;
i >= code_size; i--)
{
pj_bool_t found = PJ_TRUE;
for (j = 0; j < code_size; j++) {
if (h264_fmtp.sprop_param_sets[i + j] != start_code[j]) {
found = PJ_FALSE;
break;
}
}

View File

@ -902,7 +902,7 @@ static int write_yuv(pj_uint8_t *buf,
if (i < iHeight)
return -1;
return dst - buf;
return (int)(dst - buf);
}
static pj_status_t oh264_got_decoded_frame(pjmedia_vid_codec *codec,
@ -1014,7 +1014,7 @@ static pj_status_t oh264_codec_decode(pjmedia_vid_codec *codec,
pj_memcpy( oh264_data->dec_buf + whole_len,
(pj_uint8_t*)packets[i].buf,
packets[i].size);
whole_len += packets[i].size;
whole_len += (unsigned)packets[i].size;
}
} else {

View File

@ -89,8 +89,8 @@ PJ_DEF(pj_status_t) pjmedia_vpx_packetize(const pjmedia_vpx_packetizer *pktz,
{
unsigned payload_desc_size = 1;
unsigned max_size = pktz->cfg.mtu - payload_desc_size;
unsigned remaining_size = bits_len - *bits_pos;
unsigned out_size = *payload_len;
unsigned remaining_size = (unsigned)bits_len - *bits_pos;
unsigned out_size = (unsigned)*payload_len;
pj_uint8_t *bits = *payload;
*payload_len = PJ_MIN(remaining_size, max_size);

View File

@ -900,7 +900,7 @@ on_error2:
fport->eof = PJ_TRUE;
size_to_read -= size_read;
if (size_to_read == frame->size) {
if (size_to_read == (pj_ssize_t)frame->size) {
/* Frame is empty */
frame->type = PJMEDIA_FRAME_TYPE_NONE;
frame->size = 0;

View File

@ -689,7 +689,7 @@ static pj_status_t libyuv_conv_convert2(
pjmedia_video_apply_fmt_param *ap = &src_fmt_info->apply_param;
unsigned j;
for (j = 0; j < src_fmt_info->vid_fmt_info->plane_cnt; ++j) {
int y = src_pos->y * ap->plane_bytes[j] / ap->strides[j] /
int y = src_pos->y * (int)ap->plane_bytes[j] / ap->strides[j] /
ap->size.h;
ap->planes[j] += y * ap->strides[j] + src_pos->x *
ap->strides[j] / ap->size.w;
@ -701,7 +701,7 @@ static pj_status_t libyuv_conv_convert2(
unsigned j;
for (j = 0; j < dst_fmt_info->vid_fmt_info->plane_cnt; ++j)
{
int y = dst_pos->y * ap->plane_bytes[j] / ap->strides[j] /
int y = dst_pos->y * (int)ap->plane_bytes[j] / ap->strides[j] /
ap->size.h;
ap->planes[j] += y * ap->strides[j] + dst_pos->x *
ap->strides[j] / ap->size.w;

View File

@ -334,6 +334,7 @@ pjmedia_event_unsubscribe(pjmedia_event_mgr *mgr,
esub *sub;
unsigned i = 0, j = 0;
PJ_UNUSED_ARG(j);
PJ_ASSERT_RETURN(cb, PJ_EINVAL);
if (!mgr) mgr = pjmedia_event_mgr_instance();

View File

@ -474,7 +474,7 @@ PJ_DEF(pj_status_t) pjmedia_video_format_fill_black(const pjmedia_format *fmt,
vafp.plane_bytes[1]);
} else if (fmt_id == PJMEDIA_FORMAT_YUY2) {
pj_uint8_t *ptr = (pj_uint8_t *)buf;
unsigned i;
pj_size_t i;
for (i = vafp.framebytes / 2; i > 0; i--) {
*(ptr++) = 0x10; *(ptr++) = 0x80;

View File

@ -634,7 +634,7 @@ PJ_DEF(pj_status_t) pjmedia_jbuf_set_ptime( pjmedia_jbuf *jb,
jb->jb_frame_ptime = ptime;
jb->jb_min_shrink_gap = PJMEDIA_JBUF_DISC_MIN_GAP / ptime;
jb->jb_max_burst = PJ_MAX(MAX_BURST_MSEC / ptime,
jb->jb_max_burst = (int)PJ_MAX(MAX_BURST_MSEC / ptime,
jb->jb_max_count*3/4);
return PJ_SUCCESS;
@ -1193,7 +1193,7 @@ PJ_DEF(pj_status_t) pjmedia_jbuf_get_state( const pjmedia_jbuf *jb,
state->frame_size = (unsigned)jb->jb_frame_size;
state->min_prefetch = jb->jb_min_prefetch;
state->max_prefetch = jb->jb_max_prefetch;
state->max_count = jb->jb_max_count;
state->max_count = (unsigned)jb->jb_max_count;
state->burst = jb->jb_eff_level;
state->prefetch = jb->jb_prefetch;

View File

@ -774,7 +774,7 @@ static void parse_rtcp_bye(pjmedia_rtcp_session *sess,
*/
reason.slen = PJ_MIN(sizeof(sess->stat.peer_sdes_buf_),
*((pj_uint8_t*)pkt+8));
reason.slen = PJ_MIN(reason.slen, size-9);
reason.slen = PJ_MIN(reason.slen, (pj_ssize_t)(size-9));
pj_memcpy(sess->stat.peer_sdes_buf_, ((pj_uint8_t*)pkt+9),
reason.slen);

View File

@ -172,7 +172,7 @@ PJ_DEF(pj_status_t) pjmedia_rtcp_fb_build_rpsi(
PJ_ASSERT_RETURN(session && buf && length && rpsi, PJ_EINVAL);
bitlen = rpsi->rpsi_bit_len + 16;
bitlen = (unsigned)rpsi->rpsi_bit_len + 16;
padlen = (32 - (bitlen % 32)) % 32;
len = (3 + (bitlen+padlen)/32) * 4;
if (len > *length)

View File

@ -190,7 +190,7 @@ PJ_DEF(pj_status_t) pjmedia_rtp_decode_rtp2(
/* Decode RTP extension. */
if ((*hdr)->x) {
if (offset + sizeof (pjmedia_rtp_ext_hdr) > pkt_len)
if (offset + sizeof (pjmedia_rtp_ext_hdr) > (unsigned)pkt_len)
return PJMEDIA_RTP_EINLEN;
dec_hdr->ext_hdr = (pjmedia_rtp_ext_hdr*)(((pj_uint8_t*)pkt) + offset);
dec_hdr->ext = (pj_uint32_t*)(dec_hdr->ext_hdr + 1);

View File

@ -706,7 +706,7 @@ static pj_ssize_t print_attr(const pjmedia_sdp_attr *attr,
return p-buf;
}
static int print_media_desc( pjmedia_sdp_media *m, char *buf, int len)
static int print_media_desc(const pjmedia_sdp_media *m, char *buf, pj_size_t len)
{
char *p = buf;
char *end = buf+len;
@ -714,7 +714,7 @@ static int print_media_desc( pjmedia_sdp_media *m, char *buf, int len)
int printed;
/* check length for the "m=" line. */
if (len < m->desc.media.slen+m->desc.transport.slen+12+24) {
if (len < (pj_size_t)m->desc.media.slen+m->desc.transport.slen+12+24) {
return -1;
}
*p++ = 'm'; /* m= */

View File

@ -780,7 +780,8 @@ static pj_status_t get_frame( pjmedia_port *port, pjmedia_frame *frame)
stream->dec_buf_count);
}
} else if (use_dec_buf) {
stream->dec_buf_count = frame_out.size / sizeof(pj_int16_t);
stream->dec_buf_count = (unsigned)frame_out.size /
sizeof(pj_int16_t);
}
if (stream->jb_last_frm != frame_type) {

View File

@ -1315,11 +1315,11 @@ static pj_status_t dtls_encode_sdp( pjmedia_transport *tp,
}
if (pj_sockaddr_has_addr(&ds->rem_addr) &&
pj_sockaddr_has_addr(&rem_rtp) &&
pj_sockaddr_cmp(&ds->rem_addr, &rem_rtp) ||
(!use_rtcp_mux &&
pj_sockaddr_has_addr(&ds->rem_rtcp) &&
pj_sockaddr_has_addr(&rem_rtcp) &&
pj_sockaddr_cmp(&ds->rem_rtcp, &rem_rtcp)))
(pj_sockaddr_cmp(&ds->rem_addr, &rem_rtp) ||
(!use_rtcp_mux &&
pj_sockaddr_has_addr(&ds->rem_rtcp) &&
pj_sockaddr_has_addr(&rem_rtcp) &&
pj_sockaddr_cmp(&ds->rem_rtcp, &rem_rtcp))))
{
rem_addr_changed = PJ_TRUE;
}

View File

@ -1343,6 +1343,9 @@ static pj_status_t transport_simulate_lost(pjmedia_transport *tp,
static pj_status_t transport_restart(pj_bool_t is_rtp,
struct transport_udp *udp)
{
PJ_UNUSED_ARG(udp);
PJ_UNUSED_ARG(is_rtp);
return PJ_ENOTSUP;
/* This code is disabled for the following reason (see also #2881):

View File

@ -946,7 +946,7 @@ static void on_rx_rtp( pjmedia_tp_cb_param *param)
* So we need to compare the last decoded frame's timestamp with
* the current timestamp.
*/
else if (ts_diff > stream->dec_max_delay) {
else if (ts_diff > (long)stream->dec_max_delay) {
can_decode = PJ_TRUE;
}

View File

@ -346,7 +346,7 @@ PJ_DEF(pj_status_t) pjmedia_wav_player_port_create( pj_pool_t *pool,
* try to play whatever data is there instead of immediately returning
* error.
*/
wave_hdr.data_hdr.len = fport->fsize - fport->start_data;
wave_hdr.data_hdr.len = (pj_uint32_t)fport->fsize - fport->start_data;
// pj_file_close(fport->fd);
// return PJMEDIA_EWAVEUNSUPP;
}

View File

@ -1769,7 +1769,7 @@ static pj_status_t use_buffer( pj_ice_strans *ice_st,
pj_status_t status;
/* Allocate send buffer, if necessary. */
status = alloc_send_buf(ice_st, data_len);
status = alloc_send_buf(ice_st, (unsigned)data_len);
if (status != PJ_SUCCESS)
return status;

View File

@ -1506,7 +1506,7 @@ static pj_bool_t dataconn_on_data_read(pj_activesock_t *asock,
if (conn->state == DATACONN_STATE_READY) {
/* Application data */
if (turn_sock->cb.on_rx_data) {
(*turn_sock->cb.on_rx_data)(turn_sock, data, *remainder,
(*turn_sock->cb.on_rx_data)(turn_sock, data, (unsigned)*remainder,
&conn->peer_addr,
conn->peer_addr_len);
}

View File

@ -1,13 +1,13 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 15
compileSdkVersion 26
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "org.pjsip.pjsua"
minSdkVersion 15
targetSdkVersion 15
minSdkVersion 23
targetSdkVersion 26
ndk {
moduleName "libpjsua"

View File

@ -23,6 +23,8 @@ import java.lang.ref.WeakReference;
import android.app.Activity;
import android.content.pm.ApplicationInfo;
import android.hardware.camera2.CameraManager;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
@ -30,6 +32,7 @@ import android.view.SurfaceView;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;
import org.pjsip.PjCameraInfo2;
class CONST {
public static final String LIB_FILENAME = "pjsua";
@ -160,6 +163,8 @@ public class MainActivity extends Activity implements SurfaceHolder.Callback {
protected void onCreate(Bundle savedInstanceState) {
LOG.DEBUG(ui_handler, "=== Activity::onCreate() ===");
super.onCreate(savedInstanceState);
CameraManager cm = (CameraManager)getSystemService(Context.CAMERA_SERVICE);
PjCameraInfo2.SetCameraManager(cm);
init_view();

View File

@ -2045,11 +2045,15 @@ static pj_status_t app_destroy(void)
/* Close avi devs and ports */
for (i=0; i<app_config.avi_cnt; ++i) {
if (app_config.avi[i].slot != PJSUA_INVALID_ID)
if (app_config.avi[i].slot != PJSUA_INVALID_ID) {
pjsua_conf_remove_port(app_config.avi[i].slot);
app_config.avi[i].slot = PJSUA_INVALID_ID;
}
#if PJMEDIA_HAS_VIDEO && PJMEDIA_VIDEO_DEV_HAS_AVI
if (app_config.avi[i].dev_id != PJMEDIA_VID_INVALID_DEV)
if (app_config.avi[i].dev_id != PJMEDIA_VID_INVALID_DEV) {
pjmedia_avi_dev_free(app_config.avi[i].dev_id);
app_config.avi[i].dev_id = PJMEDIA_VID_INVALID_DEV;
}
#endif
}
@ -2087,7 +2091,10 @@ static pj_status_t app_destroy(void)
/* Close tone generators */
for (i=0; i<app_config.tone_count; ++i) {
pjsua_conf_remove_port(app_config.tone_slots[i]);
if (app_config.tone_slots[i] != PJSUA_INVALID_ID) {
pjsua_conf_remove_port(app_config.tone_slots[i]);
app_config.tone_slots[i] = PJSUA_INVALID_ID;
}
}
pj_pool_safe_release(&app_config.pool);

View File

@ -85,7 +85,7 @@ pj_status_t gui_start(gui_menu *menu)
puts("M E N U :");
puts("---------");
for (i=0; i<menu->submenu_cnt; ++i) {
char menu_id[4];
char menu_id[11];
pj_ansi_sprintf(menu_id, "%u", i);
print_menu("", menu_id, menu->submenus[i]);
}

View File

@ -623,8 +623,8 @@ static void process_incoming_call(pjsip_rx_data *rdata)
pjsip_response_addr res_addr;
pjsip_get_response_addr(tdata->pool, rdata, &res_addr);
pj_status_t status = pjsip_endpt_send_response(app.sip_endpt, &res_addr, tdata,
NULL, NULL);
status = pjsip_endpt_send_response(app.sip_endpt, &res_addr, tdata,
NULL, NULL);
if (status != PJ_SUCCESS) pjsip_tx_data_dec_ref(tdata);
} else {
@ -733,7 +733,7 @@ static pj_bool_t on_rx_request( pjsip_rx_data *rdata )
static void timer_disconnect_call( pj_timer_heap_t *timer_heap,
struct pj_timer_entry *entry)
{
struct call *call = entry->user_data;
struct call *call = (struct call *)(entry->user_data);
PJ_UNUSED_ARG(timer_heap);
@ -746,7 +746,7 @@ static void timer_disconnect_call( pj_timer_heap_t *timer_heap,
static void call_on_state_changed( pjsip_inv_session *inv,
pjsip_event *e)
{
struct call *call = inv->mod_data[mod_siprtp.id];
struct call *call = (struct call *)inv->mod_data[mod_siprtp.id];
PJ_UNUSED_ARG(e);
@ -1021,7 +1021,7 @@ static pj_status_t create_sdp( pj_pool_t *pool,
pjmedia_transport_get_info(audio->transport, &tpinfo);
/* Create and initialize basic SDP session */
sdp = pj_pool_zalloc (pool, sizeof(pjmedia_sdp_session));
sdp = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_session);
pj_gettimeofday(&tv);
sdp->origin.user = pj_str("pjsip-siprtp");
@ -1034,7 +1034,7 @@ static pj_status_t create_sdp( pj_pool_t *pool,
/* Since we only support one media stream at present, put the
* SDP connection line in the session level.
*/
sdp->conn = pj_pool_zalloc (pool, sizeof(pjmedia_sdp_conn));
sdp->conn = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_conn);
sdp->conn->net_type = pj_str("IN");
sdp->conn->addr_type = pj_str("IP4");
sdp->conn->addr = app.local_addr;
@ -1047,7 +1047,7 @@ static pj_status_t create_sdp( pj_pool_t *pool,
/* Create media stream 0: */
sdp->media_count = 1;
m = pj_pool_zalloc (pool, sizeof(pjmedia_sdp_media));
m = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_media);
sdp->media[0] = m;
/* Standard media info: */
@ -1076,7 +1076,7 @@ static pj_status_t create_sdp( pj_pool_t *pool,
}
/* Add sendrecv attribute. */
attr = pj_pool_zalloc(pool, sizeof(pjmedia_sdp_attr));
attr = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_attr);
attr->name = pj_str("sendrecv");
m->attr[m->attr_count++] = attr;
@ -1086,12 +1086,12 @@ static pj_status_t create_sdp( pj_pool_t *pool,
*/
m->desc.fmt[m->desc.fmt_count++] = pj_str("121");
/* Add rtpmap. */
attr = pj_pool_zalloc(pool, sizeof(pjmedia_sdp_attr));
attr = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_attr);
attr->name = pj_str("rtpmap");
attr->value = pj_str("121 telephone-event/8000");
m->attr[m->attr_count++] = attr;
/* Add fmtp */
attr = pj_pool_zalloc(pool, sizeof(pjmedia_sdp_attr));
attr = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_attr);
attr->name = pj_str("fmtp");
attr->value = pj_str("121 0-15");
m->attr[m->attr_count++] = attr;
@ -1190,7 +1190,7 @@ static void on_rx_rtp(void *user_data, void *pkt, pj_ssize_t size)
const void *payload;
unsigned payload_len;
strm = user_data;
strm = (struct media_stream *)user_data;
/* Discard packet if media is inactive */
if (!strm->active)
@ -1229,7 +1229,7 @@ static void on_rx_rtcp(void *user_data, void *pkt, pj_ssize_t size)
{
struct media_stream *strm;
strm = user_data;
strm = (struct media_stream *)user_data;
/* Discard packet if media is inactive */
if (!strm->active)
@ -1254,7 +1254,7 @@ static void on_rx_rtcp(void *user_data, void *pkt, pj_ssize_t size)
static int media_thread(void *arg)
{
enum { RTCP_INTERVAL = 5000, RTCP_RAND = 2000 };
struct media_stream *strm = arg;
struct media_stream *strm = (struct media_stream *)arg;
char packet[1500];
unsigned msec_interval;
pj_timestamp freq, next_rtp, next_rtcp;
@ -1403,7 +1403,7 @@ static void call_on_media_update( pjsip_inv_session *inv,
struct codec *codec_desc = NULL;
unsigned i;
call = inv->mod_data[mod_siprtp.id];
call = (struct call *)inv->mod_data[mod_siprtp.id];
audio = &call->media[0];
/* If this is a mid-call media update, then destroy existing media */

View File

@ -128,6 +128,7 @@ static pj_status_t init_codecs(pj_pool_factory *pf)
/* To suppress warning about unused var when all codecs are disabled */
PJ_UNUSED_ARG(status);
PJ_UNUSED_ARG(pf);
#if defined(PJMEDIA_HAS_OPENH264_CODEC) && PJMEDIA_HAS_OPENH264_CODEC != 0
status = pjmedia_codec_openh264_vid_init(NULL, pf);

View File

@ -1,12 +1,12 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
compileSdkVersion 29
defaultConfig {
applicationId "org.pjsip.pjsua2.app"
minSdkVersion 23
targetSdkVersion 26
targetSdkVersion 29
}
buildTypes {

View File

@ -3,11 +3,11 @@ plugins {
}
android {
compileSdkVersion 26
compileSdkVersion 29
defaultConfig {
minSdkVersion 23
targetSdkVersion 26
targetSdkVersion 29
ndk {

View File

@ -558,7 +558,7 @@ static void update_digest_session( pjsip_cached_auth *cached_auth,
PJSIP_AUTH_CNONCE_USE_DIGITS_ONLY!=0
if (pj_strchr(&cached_auth->cnonce, '-')) {
/* remove hyphen character. */
int w, r, len = pj_strlen(&cached_auth->cnonce);
pj_size_t w, r, len = pj_strlen(&cached_auth->cnonce);
char *s = cached_auth->cnonce.ptr;
w = r = 0;

View File

@ -434,7 +434,7 @@ pjsip_multipart_find_part_by_header_str(pj_pool_t *pool,
pj_str_t found_hdr_value;
pj_size_t expected_hdr_slen;
pj_size_t buf_size;
int hdr_name_len;
pj_ssize_t hdr_name_len;
#define REASONABLE_PADDING 32
#define SEPARATOR_LEN 2
/* Must specify mandatory params */
@ -478,7 +478,7 @@ pjsip_multipart_find_part_by_header_str(pj_pool_t *pool,
* If the buffer was too small (slen = -1) or the result wasn't
* the same length as the search header, it can't be a match.
*/
if (found_hdr_str.slen != expected_hdr_slen) {
if (found_hdr_str.slen != (pj_ssize_t)expected_hdr_slen) {
continue;
}
/*
@ -504,7 +504,6 @@ pjsip_multipart_find_part_by_header(pj_pool_t *pool,
void *search_for,
const pjsip_multipart_part *start)
{
struct multipart_data *m_data;
pjsip_hdr *search_hdr = search_for;
pj_str_t search_buf;
@ -587,7 +586,6 @@ pjsip_multipart_find_part_by_cid_str(pj_pool_t *pool,
struct multipart_data *m_data;
pjsip_multipart_part *part;
pjsip_generic_string_hdr *found_hdr;
pj_str_t found_hdr_value;
static pj_str_t hdr_name = { "Content-ID", 10};
pj_str_t hdr_value;

View File

@ -1843,7 +1843,7 @@ PJ_DEF(unsigned) pjsip_tpmgr_get_transport_count(pjsip_tpmgr *mgr)
itr = pj_hash_first(mgr->table, &itr_val);
while (itr) {
transport *tp_entry = (transport *)pj_hash_this(mgr->table, itr);
nr_of_transports += pj_list_size(tp_entry);
nr_of_transports += (int)pj_list_size(tp_entry);
itr = pj_hash_next(mgr->table, itr);
}
@ -2075,8 +2075,8 @@ PJ_DEF(pj_ssize_t) pjsip_tpmgr_receive_packet( pjsip_tpmgr *mgr,
pj_exception_id_name(err->except_code),
(int)err->hname.slen, err->hname.ptr,
err->line, err->col);
if (len >= (int)sizeof(buf)-tmp.slen) {
len = (int)sizeof(buf)-tmp.slen;
if (len >= (int)sizeof(buf)-(int)tmp.slen) {
len = (int)sizeof(buf)-(int)tmp.slen;
}
if (len > 0) {
tmp.slen += len;

View File

@ -827,7 +827,7 @@ PJ_DEF(pj_status_t) pjsua_call_make_call(pjsua_acc_id acc_id,
pj_pool_t *tmp_pool = NULL;
pjsip_dialog *dlg = NULL;
pjsua_acc *acc;
pjsua_call *call;
pjsua_call *call = NULL;
int call_id = -1;
pj_str_t contact;
pj_status_t status;
@ -1011,7 +1011,7 @@ PJ_DEF(pj_status_t) pjsua_call_make_call(pjsua_acc_id acc_id,
on_error:
if (dlg) {
if (dlg && call) {
/* This may destroy the dialog */
pjsip_dlg_dec_lock(dlg);
call->async_call.dlg = NULL;
@ -1700,8 +1700,8 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata)
pjsip_response_addr res_addr;
pjsip_get_response_addr(response->pool, rdata, &res_addr);
pj_status_t status = pjsip_endpt_send_response(pjsua_var.endpt, &res_addr, response,
NULL, NULL);
status = pjsip_endpt_send_response(pjsua_var.endpt, &res_addr, response,
NULL, NULL);
if (status != PJ_SUCCESS) pjsip_tx_data_dec_ref(response);
} else {

View File

@ -968,7 +968,7 @@ PJ_DEF(pj_status_t) pjsua_call_dump( pjsua_call_id call_id,
print_call(indent, call_id, tmp, sizeof(tmp));
len = (int)pj_ansi_strlen(tmp);
if (len + 3 > maxlen) len = maxlen - 3;
if (len + 3 > (int)maxlen) len = maxlen - 3;
pj_ansi_strncpy(buffer, tmp, len);
p += len;

View File

@ -1650,10 +1650,7 @@ pj_status_t call_media_on_event(pjmedia_event *event,
/* Stream decoder changed format, update all conf listeners
* by reconnecting.
*/
pjsua_conf_port_id dec_pid = call_med->strm.v.strm_dec_slot;
pjmedia_port *strm_dec;
pjsua_vid_conf_port_info pi;
unsigned i;
status = pjmedia_vid_stream_get_port(call_med->strm.v.stream,
PJMEDIA_DIR_DECODING,

View File

@ -1404,7 +1404,6 @@ void pjsua_vid_stop_stream(pjsua_call_media *call_med)
if (eve->call_id == (int)call_med->call->index &&
eve->med_idx == call_med->idx)
{
unsigned num_locks;
pjsip_dialog *dlg = call_med->call->inv ?
call_med->call->inv->dlg : NULL;

View File

@ -76,7 +76,7 @@ pjmedia_rtcp_fb_setting RtcpFbConfig::toPj() const
pj_bzero(&setting, sizeof(setting));
setting.dont_use_avpf = this->dontUseAvpf;
setting.cap_count = this->caps.size();
setting.cap_count = (unsigned)this->caps.size();
for (unsigned i = 0; i < setting.cap_count; ++i) {
setting.caps[i] = this->caps[i].toPj();
}
@ -166,12 +166,12 @@ pjsua_srtp_opt SrtpOpt::toPj() const
pj_bzero(&opt, sizeof(opt));
opt.crypto_count = this->cryptos.size();
opt.crypto_count = (unsigned)this->cryptos.size();
for (unsigned i = 0; i < opt.crypto_count; ++i) {
opt.crypto[i] = this->cryptos[i].toPj();
}
opt.keying_count = this->keyings.size();
opt.keying_count = (unsigned)this->keyings.size();
for (unsigned i = 0; i < opt.keying_count; ++i) {
opt.keying[i] = (pjmedia_srtp_keying_method)this->keyings[i];
}

View File

@ -1341,7 +1341,10 @@ pjsua_vid_preview_param VideoPreviewOpParam::toPj() const
VideoPreview::VideoPreview(int dev_id)
: devId(dev_id), winId(PJSUA_INVALID_ID)
{
#if !PJSUA_HAS_VIDEO
/* Suppress warning of unused field when video is disabled */
PJ_UNUSED_ARG(winId);
#endif
}
bool VideoPreview::hasNative()

View File

@ -125,7 +125,6 @@ static void init_media_type(pjsip_media_type *mt,
static int verify_hdr(pj_pool_t *pool, pjsip_msg_body *multipart_body,
void *hdr, char *part_body)
{
pjsip_media_type mt;
pjsip_multipart_part *part;
pj_str_t the_body;
@ -148,7 +147,6 @@ static int verify_hdr(pj_pool_t *pool, pjsip_msg_body *multipart_body,
static int verify_cid_str(pj_pool_t *pool, pjsip_msg_body *multipart_body,
pj_str_t cid_url, char *part_body)
{
pjsip_media_type mt;
pjsip_multipart_part *part;
pj_str_t the_body;
@ -170,7 +168,6 @@ static int verify_cid_str(pj_pool_t *pool, pjsip_msg_body *multipart_body,
static int verify_cid_uri(pj_pool_t *pool, pjsip_msg_body *multipart_body,
pjsip_other_uri *cid_uri, char *part_body)
{
pjsip_media_type mt;
pjsip_multipart_part *part;
pj_str_t the_body;

View File

@ -99,7 +99,7 @@ static pj_status_t select_tests(char *testlist)
char *token;
char *saveptr;
int maxtok = PJ_ARRAY_SIZE(test_list);
int i, j;
int j;
if (!testlist) {
return PJ_SUCCESS;

View File

@ -71,7 +71,13 @@ if G_EXE == "":
"pjsua-i386-Win32-vc8-Debug-Static.exe",
"pjsua-i386-Win32-vc8-Release.exe",
"pjsua-i386-Win32-vc8-Release-Dynamic.exe",
"pjsua-i386-Win32-vc8-Release-Static.exe"
"pjsua-i386-Win32-vc8-Release-Static.exe",
"pjsua-i386-Win32-vc14-Debug.exe",
"pjsua-i386-Win32-vc14-Debug-Dynamic.exe",
"pjsua-i386-Win32-vc14-Debug-Static.exe",
"pjsua-i386-Win32-vc14-Release.exe",
"pjsua-i386-Win32-vc14-Release-Dynamic.exe",
"pjsua-i386-Win32-vc14-Release-Static.exe"
]
e_ts = 0
for e in EXECUTABLES:

View File

@ -25,8 +25,7 @@
<ProjectGuid>{9102D366-6707-4789-938B-A373675F5B4C}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>cmp_wav</RootNamespace>
<OutDir>.\</OutDir>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<OutDir>.\</OutDir>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -115,7 +114,7 @@
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Iphlpapi.lib;dsound.lib;dxguid.lib;netapi32.lib;mswsock.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;ole32.lib;user32.lib;gdi32.lib;advapi32.lib;libpjproject-i386-Win32-vc14-Debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>Iphlpapi.lib;dsound.lib;dxguid.lib;netapi32.lib;mswsock.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;ole32.lib;user32.lib;gdi32.lib;advapi32.lib;libpjproject-x86_64-x64-vc14-Debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
<OutputFile>$(TargetName)$(TargetExt)</OutputFile>
@ -137,7 +136,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Iphlpapi.lib;dsound.lib;dxguid.lib;netapi32.lib;mswsock.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;ole32.lib;user32.lib;gdi32.lib;advapi32.lib;libpjproject-i386-Win32-vc14-Debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>Iphlpapi.lib;dsound.lib;dxguid.lib;netapi32.lib;mswsock.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;ole32.lib;user32.lib;gdi32.lib;advapi32.lib;libpjproject-i386-Win32-vc14-Release.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
<OutputFile>$(TargetName)$(TargetExt)</OutputFile>
@ -159,7 +158,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Iphlpapi.lib;dsound.lib;dxguid.lib;netapi32.lib;mswsock.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;ole32.lib;user32.lib;gdi32.lib;advapi32.lib;libpjproject-i386-Win32-vc14-Debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>Iphlpapi.lib;dsound.lib;dxguid.lib;netapi32.lib;mswsock.lib;ws2_32.lib;odbc32.lib;odbccp32.lib;ole32.lib;user32.lib;gdi32.lib;advapi32.lib;libpjproject-x86_64-x64-vc14-Release.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
<OutputFile>$(TargetName)$(TargetExt)</OutputFile>