Пример #1
0
MPF_DECLARE(mpf_audio_stream_t*) mpf_rtp_stream_create(mpf_termination_t *termination, mpf_rtp_config_t *config, mpf_rtp_settings_t *settings, apr_pool_t *pool)
{
	mpf_rtp_stream_t *rtp_stream = apr_palloc(pool,sizeof(mpf_rtp_stream_t));
	mpf_stream_capabilities_t *capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_DUPLEX,pool);
	mpf_audio_stream_t *audio_stream = mpf_audio_stream_create(rtp_stream,&vtable,capabilities,pool);
	if(!audio_stream) {
		return NULL;
	}

	audio_stream->direction = STREAM_DIRECTION_NONE;
	audio_stream->termination = termination;

	rtp_stream->base = audio_stream;
	rtp_stream->pool = pool;
	rtp_stream->config = config;
	rtp_stream->settings = settings;
	rtp_stream->local_media = NULL;
	rtp_stream->remote_media = NULL;
	rtp_stream->rtp_socket = NULL;
	rtp_stream->rtcp_socket = NULL;
	rtp_stream->rtp_l_sockaddr = NULL;
	rtp_stream->rtp_r_sockaddr = NULL;
	rtp_stream->rtcp_l_sockaddr = NULL;
	rtp_stream->rtcp_r_sockaddr = NULL;
	rtp_stream->rtcp_tx_timer = NULL;
	rtp_stream->rtcp_rx_timer = NULL;
	rtp_stream->state = MPF_MEDIA_DISABLED;
	rtp_receiver_init(&rtp_stream->receiver);
	rtp_transmitter_init(&rtp_stream->transmitter);
	rtp_stream->transmitter.sr_stat.ssrc = (apr_uint32_t)apr_time_now();

	if(settings->rtcp == TRUE) {
		if(settings->rtcp_tx_interval) {
			rtp_stream->rtcp_tx_timer = apt_timer_create(
										termination->timer_queue,
										mpf_rtcp_tx_timer_proc,
										rtp_stream, pool);
		}
		if(settings->rtcp_rx_resolution) {
			rtp_stream->rtcp_rx_timer = apt_timer_create(
										termination->timer_queue,
										mpf_rtcp_rx_timer_proc,
										rtp_stream, pool);
		}
	}

	return audio_stream;
}
Пример #2
0
/** Create timer */
APT_DECLARE(apt_timer_t*) apt_poller_task_timer_create(
									apt_poller_task_t *task, 
									apt_timer_proc_f proc, 
									void *obj, 
									apr_pool_t *pool)
{
	return apt_timer_create(task->timer_queue,proc,obj,pool);
}
Пример #3
0
APT_DECLARE(apt_timer_t*) apt_consumer_task_timer_create(
									apt_consumer_task_t *task, 
									apt_timer_proc_f proc, 
									void *obj, 
									apr_pool_t *pool)
{
#if APR_HAS_QUEUE_TIMEOUT
	return apt_timer_create(task->timer_queue,proc,obj,pool);
#else
	return NULL;
#endif
}