Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch 2.13 ifs changes #4083

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ tests/pjsua/logs
*/docs/xml/
*/docs/latex/
*/docs/*.tag
*.bak
47 changes: 40 additions & 7 deletions pjlib/include/pj/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,53 @@
* Assertion and other helper macros for sanity checking.
*/

/**
* @hideinitializer
* Check during debug build that an expression is true. If the expression
* computes to false during run-time, then the program will stop at the
* offending statements.
* For release build, this macro only print assert expression on the log.
*
* @param expr The expression to be evaluated.
*/
#ifndef _DEBUG
#ifndef pj_assert
#include "pj/log.h"
#include <string.h>
#ifdef _WIN32
#define __FILENAME__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
#else
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#endif
#define pj_assert(expr) \
do { \
if (!(expr)) { PJ_LOG(1,(__FILENAME__, "Assert failed: " #expr)); } \
} while (0)
#endif
#else
#ifndef pj_assert
# define pj_assert(expr) assert(expr)
#endif
#endif

/**
* @hideinitializer
* for all buils log the message
* Check during debug build that an expression is true. If the expression
* computes to false during run-time, then the program will stop at the
* offending statements.
* For release build, this macro will not do anything.
*
* @param expr The expression to be evaluated.
* For release build, this macro only print message on the log.
* @param expr The expression to be evaluated.
* @param ... file name,The format string for the log message ("config.c", " PJ_VERSION: %s", PJ_VERSION)
*/
#ifndef pj_assert
# define pj_assert(expr) assert(expr)
#endif

#ifndef PJ_ASSERT_LOG
#include "pj/log.h"
#define PJ_ASSERT_LOG(expr,...) \
do { \
if (!(expr)) { PJ_LOG(1,(__VA_ARGS__)); assert(expr); } \
} while (0)

#endif
/**
* @hideinitializer
* If the expression yields false, assertion will be triggered
Expand Down
18 changes: 15 additions & 3 deletions pjlib/src/pj/os_core_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,10 @@ PJ_DEF(void*) pj_thread_local_get(long index)
//Can't check stack because this function is called
//by PJ_CHECK_STACK() itself!!!
//PJ_CHECK_STACK();
if (index == -1)
{
return 0;
}
#if defined(PJ_WIN32_WINPHONE8) && PJ_WIN32_WINPHONE8
return TlsGetValueRT(index);
#else
Expand Down Expand Up @@ -1093,10 +1097,18 @@ PJ_DEF(pj_status_t) pj_mutex_lock(pj_mutex_t *mutex)
status = PJ_STATUS_FROM_OS(GetLastError());

#endif
if (status == PJ_SUCCESS)
{
LOG_MUTEX((mutex->obj_name,
(status==PJ_SUCCESS ? "Mutex acquired by thread %s" : "FAILED by %s"),
"Mutex acquired by thread %s",
pj_thread_this()->obj_name));

}
else
{
LOG_MUTEX_WARN((mutex->obj_name,
"FAILED by %s",
pj_thread_this()->obj_name));
}
#if PJ_DEBUG
if (status == PJ_SUCCESS) {
mutex->owner = pj_thread_this();
Expand Down Expand Up @@ -1296,7 +1308,7 @@ static pj_status_t pj_sem_wait_for(pj_sem_t *sem, unsigned timeout)
LOG_MUTEX((sem->obj_name, "Semaphore acquired by thread %s",
pj_thread_this()->obj_name));
} else {
LOG_MUTEX((sem->obj_name, "Semaphore: thread %s FAILED to acquire",
LOG_MUTEX_WARN((sem->obj_name, "Semaphore: thread %s FAILED to acquire",
pj_thread_this()->obj_name));
}

Expand Down
9 changes: 7 additions & 2 deletions pjmedia/include/pjmedia/circbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,14 @@ PJ_INLINE(pj_status_t) pjmedia_circ_buf_create(pj_pool_t *pool,
{
pjmedia_circ_buf *cbuf;

*p_cb = NULL;

cbuf = PJ_POOL_ZALLOC_T(pool, pjmedia_circ_buf);
cbuf->buf = (pj_int16_t*) pj_pool_calloc(pool, capacity,
sizeof(pj_int16_t));
if (!cbuf)
return PJ_ENOMEM;
cbuf->buf = (pj_int16_t*) pj_pool_calloc(pool, capacity, sizeof(pj_int16_t));
if (!cbuf->buf)
return PJ_ENOMEM;
cbuf->capacity = capacity;
cbuf->start = cbuf->buf;
cbuf->len = 0;
Expand Down
55 changes: 52 additions & 3 deletions pjmedia/include/pjmedia/conference.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,20 @@ PJ_DECL(pjmedia_port*) pjmedia_conf_get_master_port(pjmedia_conf *conf);
PJ_DECL(pj_status_t) pjmedia_conf_set_port0_name(pjmedia_conf *conf,
const pj_str_t *name);


/**
* compare signature of the port with the signature of the port in the conference bridge
*
* if the conf_slot is not found, return PJ_FALSE
*
* @param conf The conference bridge.
* @param conf_slot conference bridge slot
* @param signature signature of the port
*
* @return PJ_TRUE if the signature of the port is the same as the signature of the port in the conference bridge
*/

PJ_DECL(pj_bool_t) pjmedia_conf_compare_port_signature(pjmedia_conf* conf, unsigned conf_slot, pj_uint32_t signature);
/**
* Add media port to the conference bridge.
*
* By default, the new conference port will have both TX and RX enabled,
Expand Down Expand Up @@ -243,7 +255,33 @@ PJ_DECL(pj_status_t) pjmedia_conf_add_port( pjmedia_conf *conf,
const pj_str_t *name,
unsigned *p_slot );


/**
* Replace existing media port in the conference bridge (that was
* initially added using #pjmedia_conf_add_port()) with a new port
* in the same slot whilst maintaining any connections established
* by invoking #pjmedia_conf_connect_port().
*
* By default, the new conference port will have both TX and RX enabled,
* but it is not connected to any other ports. Application SHOULD call
* #pjmedia_conf_connect_port() to enable audio transmission and receipt
* to/from this port.
*
* Once the media port is connected to other port(s) in the bridge,
* the bridge will continuosly call get_frame() and put_frame() to the
* port, allowing media to flow to/from the port.
*
* @param conf The conference bridge.
* @param pool Pool to allocate buffers for this port.
* @param strm_port Stream port interface.
* @param slot Slot index of the existing port in
* the conference bridge.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjmedia_conf_replace_port( pjmedia_conf *conf,
pj_pool_t *pool,
pjmedia_port *strm_port,
unsigned slot );
#if !DEPRECATED_FOR_TICKET_2234
/**
* <i><b>Warning:</b> This API has been deprecated since 1.3 and will be
Expand Down Expand Up @@ -433,7 +471,18 @@ PJ_DECL(pj_status_t) pjmedia_conf_remove_port( pjmedia_conf *conf,
PJ_DECL(pj_status_t) pjmedia_conf_enum_ports( pjmedia_conf *conf,
unsigned ports[],
unsigned *count );

/**
* Get port info.
*
* @param conf The conference bridge.
* @param slot Port index.
* @param info Pointer to receive the info.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjmedia_conf_get_media_port_info(pjmedia_conf* conf,
unsigned slot,
pjmedia_port_info* info);

/**
* Get port info.
Expand Down
9 changes: 8 additions & 1 deletion pjmedia/include/pjmedia/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,14 @@ typedef enum pjmedia_port_op
/**
* Enable TX and RX to/from this port.
*/
PJMEDIA_PORT_ENABLE
PJMEDIA_PORT_ENABLE,

/**
* Enable TX and RX to/from this port and invoke get_frame() and
* put_frame() even if there are no connections/listeners or non-
* silence audio frames respectively.
*/
PJMEDIA_PORT_ENABLE_ALWAYS

} pjmedia_port_op;

Expand Down
12 changes: 12 additions & 0 deletions pjmedia/include/pjmedia/stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,18 @@ PJ_DECL(pj_status_t) pjmedia_stream_resume(pjmedia_stream *stream,
PJ_DECL(pj_status_t) pjmedia_stream_dial_dtmf(pjmedia_stream *stream,
const pj_str_t *ascii_digit);

/**
* Get the number of DTMF digits currently in the RFC 2833 transmit
* queue for this stream (valid only for audio streams).
*
* @param stream The media stream.
* @param digits Receives the number of queued digits.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjmedia_get_queued_dtmf_digits(pjmedia_stream *stream,
unsigned *digits);


/**
* Check if the stream has incoming DTMF digits in the incoming DTMF
Expand Down
3 changes: 2 additions & 1 deletion pjmedia/src/pjmedia/conf_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,8 @@ static pj_status_t get_frame(pjmedia_port *this_port,

while (pj_cmp_timestamp(&cport->ts_clock, &cport->ts_tx) > 0)
{
if (cport->tx_setting == PJMEDIA_PORT_ENABLE) {
if ((cport->tx_setting == PJMEDIA_PORT_ENABLE) ||
(cport->tx_setting == PJMEDIA_PORT_ENABLE_ALWAYS)) {
pjmedia_frame tmp_f;

tmp_f.timestamp = cport->ts_tx;
Expand Down
Loading