summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authortorben <torben@0c269be4-1314-0410-8aa9-9f06e86f4224>2011-05-29 00:47:47 +0000
committertorben <torben@0c269be4-1314-0410-8aa9-9f06e86f4224>2011-05-29 00:47:47 +0000
commit639a9363da2fb58f8b0c047cee5cce0786540721 (patch)
tree16a18d85ad195109504d25a376fcc87dced29607 /drivers
parent7e90e0c9019c64046dd63df23f53bb0d42af6d99 (diff)
downloadjack1-639a9363da2fb58f8b0c047cee5cce0786540721.tar.gz
[netjack] fix occurences of jack_get_time which were hiding below driver
git-svn-id: svn+ssh://jackaudio.org/trunk/jack@4445 0c269be4-1314-0410-8aa9-9f06e86f4224
Diffstat (limited to 'drivers')
-rw-r--r--drivers/netjack/net_driver.c2
-rw-r--r--drivers/netjack/netjack.c12
-rw-r--r--drivers/netjack/netjack.h2
-rw-r--r--drivers/netjack/netjack_packet.c12
-rw-r--r--drivers/netjack/netjack_packet.h4
5 files changed, 16 insertions, 16 deletions
diff --git a/drivers/netjack/net_driver.c b/drivers/netjack/net_driver.c
index a20e9aa..04848e0 100644
--- a/drivers/netjack/net_driver.c
+++ b/drivers/netjack/net_driver.c
@@ -60,7 +60,7 @@ net_driver_wait (net_driver_t *driver, int extra_fd, int *status, float *delayed
netjack_driver_state_t *netj = &( driver->netj );
int delay;
- delay = netjack_wait( netj );
+ delay = netjack_wait( netj, driver->engine->get_microseconds );
if( delay ) {
//driver->engine->delay( driver->engine, (float)delay );
jack_error( "netxruns amount: %dms", delay/1000 );
diff --git a/drivers/netjack/netjack.c b/drivers/netjack/netjack.c
index 8c9f5ef..cdb2264 100644
--- a/drivers/netjack/netjack.c
+++ b/drivers/netjack/netjack.c
@@ -88,7 +88,7 @@ net_driver_sync_cb(jack_transport_state_t state, jack_position_t *pos, void *dat
return retval;
}
-int netjack_wait( netjack_driver_state_t *netj )
+int netjack_wait( netjack_driver_state_t *netj, jack_time_t (*get_microseconds)(void) )
{
int we_have_the_expected_frame = 0;
jack_nframes_t next_frame_avail;
@@ -96,7 +96,7 @@ int netjack_wait( netjack_driver_state_t *netj )
jacknet_packet_header *pkthdr;
if( !netj->next_deadline_valid ) {
- netj->next_deadline = jack_get_time() + netj->period_usecs;
+ netj->next_deadline = get_microseconds() + netj->period_usecs;
netj->next_deadline_valid = 1;
}
@@ -106,7 +106,7 @@ int netjack_wait( netjack_driver_state_t *netj )
netj->expected_framecnt += 1;
} else {
// starting up.... lets look into the packetcache, and fetch the highest packet.
- packet_cache_drain_socket( netj->packcache, netj->sockfd );
+ packet_cache_drain_socket( netj->packcache, netj->sockfd, get_microseconds );
if( packet_cache_get_highest_available_framecnt( netj->packcache, &next_frame_avail ) ) {
netj->expected_framecnt = next_frame_avail;
netj->expected_framecnt_valid = 1;
@@ -130,11 +130,11 @@ int netjack_wait( netjack_driver_state_t *netj )
break;
}
}
- if( ! netjack_poll_deadline( netj->sockfd, netj->next_deadline ) ) {
+ if( ! netjack_poll_deadline( netj->sockfd, netj->next_deadline, get_microseconds ) ) {
break;
}
- packet_cache_drain_socket( netj->packcache, netj->sockfd );
+ packet_cache_drain_socket( netj->packcache, netj->sockfd, get_microseconds );
}
// check if we know who to send our packets too.
@@ -156,7 +156,7 @@ int netjack_wait( netjack_driver_state_t *netj )
if( we_have_the_expected_frame ) {
- jack_time_t now = jack_get_time();
+ jack_time_t now = get_microseconds();
if( now < netj->next_deadline )
netj->time_to_deadline = netj->next_deadline - now;
else
diff --git a/drivers/netjack/netjack.h b/drivers/netjack/netjack.h
index f162de7..67238f2 100644
--- a/drivers/netjack/netjack.h
+++ b/drivers/netjack/netjack.h
@@ -118,7 +118,7 @@ struct _netjack_driver_state {
#endif
};
-int netjack_wait( netjack_driver_state_t *netj );
+int netjack_wait( netjack_driver_state_t *netj, jack_time_t (*get_microseconds)(void) );
void netjack_send_silence( netjack_driver_state_t *netj, int syncstate );
void netjack_read( netjack_driver_state_t *netj, jack_nframes_t nframes ) ;
void netjack_write( netjack_driver_state_t *netj, jack_nframes_t nframes, int syncstate );
diff --git a/drivers/netjack/netjack_packet.c b/drivers/netjack/netjack_packet.c
index 3650beb..fe2dc9d 100644
--- a/drivers/netjack/netjack_packet.c
+++ b/drivers/netjack/netjack_packet.c
@@ -363,7 +363,7 @@ cache_packet_is_complete (cache_packet *pack)
// new poll using nanoseconds resolution and
// not waiting forever.
int
-netjack_poll_deadline (int sockfd, jack_time_t deadline)
+netjack_poll_deadline (int sockfd, jack_time_t deadline, jack_time_t (*get_microseconds)(void))
{
struct pollfd fds;
int poll_err = 0;
@@ -374,7 +374,7 @@ netjack_poll_deadline (int sockfd, jack_time_t deadline)
#endif
- jack_time_t now = jack_get_time();
+ jack_time_t now = get_microseconds();
if( now >= deadline )
return 0;
@@ -490,7 +490,7 @@ netjack_poll (int sockfd, int timeout)
return 0;
}
int
-netjack_poll_deadline (int sockfd, jack_time_t deadline)
+netjack_poll_deadline (int sockfd, jack_time_t deadline, jack_time_t (*get_microseconds)(void))
{
fd_set fds;
FD_ZERO( &fds );
@@ -498,7 +498,7 @@ netjack_poll_deadline (int sockfd, jack_time_t deadline)
struct timeval timeout;
while( 1 ) {
- jack_time_t now = jack_get_time();
+ jack_time_t now = get_microseconds();
if( now >= deadline )
return 0;
@@ -520,7 +520,7 @@ netjack_poll_deadline (int sockfd, jack_time_t deadline)
// replacing netjack_recv functions.
void
-packet_cache_drain_socket( packet_cache *pcache, int sockfd )
+packet_cache_drain_socket( packet_cache *pcache, int sockfd, jack_time_t (*get_microseconds)(void) )
{
char *rx_packet = alloca (pcache->mtu);
jacknet_packet_header *pkthdr = (jacknet_packet_header *) rx_packet;
@@ -564,7 +564,7 @@ packet_cache_drain_socket( packet_cache *pcache, int sockfd )
cpack = packet_cache_get_packet (pcache, framecnt);
cache_packet_add_fragment (cpack, rx_packet, rcv_len);
- cpack->recv_timestamp = jack_get_time();
+ cpack->recv_timestamp = get_microseconds();
}
}
diff --git a/drivers/netjack/netjack_packet.h b/drivers/netjack/netjack_packet.h
index c60f7be..f0ceabc 100644
--- a/drivers/netjack/netjack_packet.h
+++ b/drivers/netjack/netjack_packet.h
@@ -121,7 +121,7 @@ void cache_packet_set_framecnt(cache_packet *pack, jack_nframes_t framecnt);
void cache_packet_add_fragment(cache_packet *pack, char *packet_buf, int rcv_len);
int cache_packet_is_complete(cache_packet *pack);
-void packet_cache_drain_socket( packet_cache *pcache, int sockfd );
+void packet_cache_drain_socket( packet_cache *pcache, int sockfd, jack_time_t (*get_microseconds)(void) );
void packet_cache_reset_master_address( packet_cache *pcache );
float packet_cache_get_fill( packet_cache *pcache, jack_nframes_t expected_framecnt );
int packet_cache_retreive_packet_pointer( packet_cache *pcache, jack_nframes_t framecnt, char **packet_buf, int pkt_size, jack_time_t *timestamp );
@@ -131,7 +131,7 @@ int packet_cache_get_highest_available_framecnt( packet_cache *pcache, jack_nfra
int packet_cache_find_latency( packet_cache *pcache, jack_nframes_t expected_framecnt, jack_nframes_t *framecnt );
// Function Prototypes
-int netjack_poll_deadline (int sockfd, jack_time_t deadline);
+int netjack_poll_deadline (int sockfd, jack_time_t deadline, jack_time_t (*get_microseconds)(void));
void netjack_sendto(int sockfd, char *packet_buf, int pkt_size, int flags, struct sockaddr *addr, int addr_size, int mtu);