blob: 4dcd9afb8b8faac488808cdbcb349c6709cac948 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*
The oRTP library is an RTP (Realtime Transport Protocol - rfc1889) stack.
Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SCHEDULER_H
#define SCHEDULER_H
#include <rtpsession.h>
#include <sessionset.h>
#include "rtptimer.h"
#include "port_fct.h"
struct _RtpScheduler {
RtpSession *list; /* list of scheduled sessions*/
SessionSet all_sessions; /* tqmask of scheduled sessions */
gint all_max; /* the highest pos in the all tqmask */
SessionSet r_sessions; /* tqmask of sessions that have a recv event */
gint r_max;
SessionSet w_sessions; /* tqmask of sessions that have a send event */
gint w_max;
SessionSet e_sessions; /* tqmask of session that have error event */
gint e_max;
gint max_sessions; /* the number of position in the masks */
/* GMutex *unblock_select_mutex; */
GCond *unblock_select_cond;
GMutex *lock;
GThread *thread;
gint thread_running;
struct _RtpTimer *timer;
guint32 time_; /*number of miliseconds elapsed since the start of the thread */
guint32 timer_inc; /* the timer increment in milisec */
};
typedef struct _RtpScheduler RtpScheduler;
RtpScheduler * rtp_scheduler_new();
void rtp_scheduler_set_timer(RtpScheduler *sched,RtpTimer *timer);
void rtp_scheduler_start(RtpScheduler *sched);
void rtp_scheduler_stop(RtpScheduler *sched);
void rtp_scheduler_destroy(RtpScheduler *sched);
void rtp_scheduler_add_session(RtpScheduler *sched, RtpSession *session);
void rtp_scheduler_remove_session(RtpScheduler *sched, RtpSession *session);
gpointer rtp_scheduler_schedule(gpointer sched);
#define rtp_scheduler_lock(sched) g_mutex_lock((sched)->lock)
#define rtp_scheduler_unlock(sched) g_mutex_unlock((sched)->lock)
/* void rtp_scheduler_add_set(RtpScheduler *sched, SessionSet *set); */
RtpScheduler * ortp_get_scheduler();
#endif
|