Changeset 3824:32199d63f4d4 in roaraudio


Ignore:
Timestamp:
05/11/10 17:34:34 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added latency messurement, need some work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/emul_rsound.c

    r3820 r3824  
    3636 int client; 
    3737 union { 
    38   int32_t i[2]; 
    39   char c[8]; 
     38  int32_t i[4]; 
     39  char c[16]; 
    4040 } buf; 
    4141 
     
    6969  buf.i[0] = ROAR_HOST2NET32(0); 
    7070  buf.i[1] = ROAR_HOST2NET32(512); 
    71  
    72   ROAR_NETWORK_WRITE(oldfh, buf.c, 8); 
     71  buf.i[2] = ROAR_HOST2NET32(0); 
     72  buf.i[3] = ROAR_HOST2NET32(0); 
     73 
     74  ROAR_NETWORK_WRITE(oldfh, buf.c, sizeof(buf.c)); 
    7375 
    7476  return client; 
     
    197199 
    198200int emul_rsound_check_client(int client, struct roar_vio_calls * vio) { 
    199  struct roar_vio_calls rvio; 
    200  struct emul_rsound_msg msg; 
     201 struct roar_vio_calls     rvio; 
     202 struct emul_rsound_msg     msg; 
     203 struct roar_client        *  c; 
     204 struct roar_stream_server * ss; 
     205 int                   streamid; 
     206 int                          i; 
     207 ssize_t                    ptr; 
    201208 
    202209 if ( vio == NULL ) { 
     
    210217 if ( !strncmp(msg.datasp, "INFO", 4) ) { 
    211218  // TODO: add support for INFO 
    212   return clients_delete(client); 
     219  if ( clients_get(client, &c) == -1 ) 
     220   return clients_delete(client); 
     221 
     222  streamid = -1; 
     223  for (i = 0; i < ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT; i++) 
     224   if ( c->streams[i] > streamid ) 
     225    streamid = c->streams[i]; 
     226 
     227  if ( streamid == -1 ) 
     228   return clients_delete(client); 
     229 
     230  if ( streams_get(streamid, &ss) == -1 ) 
     231   return clients_delete(client); 
     232 
     233  ptr = roar_info2samplesize(&(ROAR_STREAM(ss)->info)); 
     234 
     235  if ( ptr == -1 ) 
     236   return clients_delete(client); 
     237 
     238  ptr *= ROAR_STREAM(ss)->pos; 
     239  ptr /= 8; // bits -> bytes 
     240 
     241  i = snprintf(msg.data+msg.datalen, EMUL_RSOUND_MSG_DATA_LEN - msg.datalen, " %lld", (long long int)ptr); 
     242 
     243  msg.datalen += i; 
     244 
     245  return emul_rsound_vsend_msg(&msg, vio); 
    213246 } else if ( !strncmp(msg.datasp, "NULL", 4) ) { 
    214247  // NULL is simular to NOOP 
Note: See TracChangeset for help on using the changeset viewer.