diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2010-06-21 09:10:44 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2010-06-21 09:10:44 +0000 |
commit | 6fa4d964245209d05d9c1cce6e8f12ab993a03a1 (patch) | |
tree | 5604869cfbc621daf72ec2b60e958c693447af10 | |
parent | 1ebdfe9fb3ec2c155ec09d31f82748ecfdf9c86e (diff) |
Misc (re #1068): added new API pjmedia_master_port_wait() to poll master port clock when it is created with PJMEDIA_CLOCK_NO_ASYNC flag.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3214 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjmedia/include/pjmedia/master_port.h | 20 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/master_port.c | 10 |
2 files changed, 30 insertions, 0 deletions
diff --git a/pjmedia/include/pjmedia/master_port.h b/pjmedia/include/pjmedia/master_port.h index dd1b1de1..6ebad7af 100644 --- a/pjmedia/include/pjmedia/master_port.h +++ b/pjmedia/include/pjmedia/master_port.h @@ -106,6 +106,26 @@ PJ_DECL(pj_status_t) pjmedia_master_port_stop(pjmedia_master_port *m); /** + * Poll the master port clock and execute the callback when the clock tick has + * elapsed. This operation is only valid if the master port is created with + * #PJMEDIA_CLOCK_NO_ASYNC flag. + * + * @param m The master port. + * @param wait If non-zero, then the function will block until + * a clock tick elapsed and callback has been called. + * @param ts Optional argument to receive the current + * timestamp. + * + * @return Non-zero if clock tick has elapsed, or FALSE if + * the function returns before a clock tick has + * elapsed. + */ +PJ_DECL(pj_bool_t) pjmedia_master_port_wait(pjmedia_master_port *m, + pj_bool_t wait, + pj_timestamp *ts); + + +/** * Change the upstream port. Note that application is responsible to destroy * current upstream port (the one that is going to be replaced with the * new port). diff --git a/pjmedia/src/pjmedia/master_port.c b/pjmedia/src/pjmedia/master_port.c index 5ca2a7ee..800b0915 100644 --- a/pjmedia/src/pjmedia/master_port.c +++ b/pjmedia/src/pjmedia/master_port.c @@ -147,6 +147,16 @@ PJ_DEF(pj_status_t) pjmedia_master_port_stop(pjmedia_master_port *m) } +/* Poll the master port clock */ +PJ_DEF(pj_bool_t) pjmedia_master_port_wait( pjmedia_master_port *m, + pj_bool_t wait, + pj_timestamp *ts) +{ + PJ_ASSERT_RETURN(m && m->clock, PJ_FALSE); + + return pjmedia_clock_wait(m->clock, wait, ts); +} + /* * Callback to be called for each clock ticks. */ |