Group PJMED_ENDPT

group PJMED_ENDPT

The media endpoint acts as placeholder for endpoint capabilities. Each media endpoint will have a codec manager to manage list of codecs installed in the endpoint and a sound device factory.

A reference to media endpoint instance is required when application wants to create a media session (pjmedia_session_create()).

Typedefs

typedef void (*pjmedia_endpt_exit_callback)(pjmedia_endpt *endpt)

Type of callback to register to pjmedia_endpt_atexit().

Enums

enum pjmedia_endpt_flag

This enumeration describes various flags that can be set or retrieved in the media endpoint, by using pjmedia_endpt_set_flag() and pjmedia_endpt_get_flag() respectively.

Values:

enumerator PJMEDIA_ENDPT_HAS_TELEPHONE_EVENT_FLAG

This flag controls whether telephony-event should be offered in SDP. Value is boolean.

Functions

pj_status_t pjmedia_endpt_create(pj_pool_factory *pf, pj_ioqueue_t *ioqueue, unsigned worker_cnt, pjmedia_endpt **p_endpt)

Create an instance of media endpoint.

Parameters
  • pf – Pool factory, which will be used by the media endpoint throughout its lifetime.

  • ioqueue – Optional ioqueue instance to be registered to the endpoint. The ioqueue instance is used to poll all RTP and RTCP sockets. If this argument is NULL, the endpoint will create an internal ioqueue instance.

  • worker_cnt – Specify the number of worker threads to be created to poll the ioqueue.

  • p_endpt – Pointer to receive the endpoint instance.

Returns

PJ_SUCCESS on success.

pj_status_t pjmedia_endpt_destroy(pjmedia_endpt *endpt)

Destroy media endpoint instance.

Parameters

endpt – Media endpoint instance.

Returns

PJ_SUCCESS on success.

pj_status_t pjmedia_endpt_set_flag(pjmedia_endpt *endpt, pjmedia_endpt_flag flag, const void *value)

Change the value of a flag.

PJ_SUCCESS on success.

Parameters
  • endpt – Media endpoint.

  • flag – The flag.

  • value – Pointer to the value to be set.

pj_status_t pjmedia_endpt_get_flag(pjmedia_endpt *endpt, pjmedia_endpt_flag flag, void *value)

Retrieve the value of a flag.

Parameters
  • endpt – Media endpoint.

  • flag – The flag.

  • value – Pointer to store the result.

Returns

PJ_SUCCESS on success.

pj_ioqueue_t *pjmedia_endpt_get_ioqueue(pjmedia_endpt *endpt)

Get the ioqueue instance of the media endpoint.

Parameters

endpt – The media endpoint instance.

Returns

The ioqueue instance of the media endpoint.

unsigned pjmedia_endpt_get_thread_count(pjmedia_endpt *endpt)

Get the number of worker threads on the media endpoint

Parameters

endpt – The media endpoint instance.

Returns

The number of worker threads on the media endpoint

pj_thread_t *pjmedia_endpt_get_thread(pjmedia_endpt *endpt, unsigned index)

Get a reference to one of the worker threads of the media endpoint

Parameters
  • endpt – The media endpoint instance.

  • index – The index of the thread: 0<= index < thread_cnt

Returns

pj_thread_t or NULL

pj_pool_t *pjmedia_endpt_create_pool(pjmedia_endpt *endpt, const char *name, pj_size_t initial, pj_size_t increment)

Request the media endpoint to create pool.

Parameters
  • endpt – The media endpoint instance.

  • name – Name to be assigned to the pool.

  • initial – Initial pool size, in bytes.

  • increment – Increment size, in bytes.

Returns

Memory pool.

pjmedia_codec_mgr *pjmedia_endpt_get_codec_mgr(pjmedia_endpt *endpt)

Get the codec manager instance of the media endpoint.

Parameters

endpt – The media endpoint instance.

Returns

The instance of codec manager belonging to this media endpoint.

pj_status_t pjmedia_endpt_create_sdp(pjmedia_endpt *endpt, pj_pool_t *pool, unsigned stream_cnt, const pjmedia_sock_info sock_info[], pjmedia_sdp_session **p_sdp)

Create a SDP session description that describes the endpoint capability.

Parameters
  • endpt – The media endpoint.

  • pool – Pool to use to create the SDP descriptor.

  • stream_cnt – Number of elements in the sock_info array. This also denotes the maximum number of streams (i.e. the “m=” lines) that will be created in the SDP.

  • sock_info – Array of socket transport information. One transport is needed for each media stream, and each transport consists of an RTP and RTCP socket pair.

  • p_sdp – Pointer to receive SDP session descriptor.

Returns

PJ_SUCCESS on success.

pj_status_t pjmedia_endpt_dump(pjmedia_endpt *endpt)

Dump media endpoint capabilities.

Parameters

endpt – The media endpoint.

Returns

PJ_SUCCESS on success.

pj_status_t pjmedia_endpt_atexit(pjmedia_endpt *endpt, pjmedia_endpt_exit_callback func)

Register cleanup function to be called by media endpoint when pjmedia_endpt_destroy() is called. Note that application should not use or access any endpoint resource (such as pool, ioqueue) from within the callback as such resource may have been released when the callback function is invoked.

Parameters
  • endpt – The media endpoint.

  • func – The function to be registered.

Returns

PJ_SUCCESS on success.