oRTP 0.25.0

- Main Page
- Data Structures
- Files

- File List
- Globals

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