Changeset 2240

Show
Ignore:
Timestamp:
02/19/99 19:23:18 (15 years ago)
Author:
ucacoxh
Message:

- Added back functions to get playout delay and amount of audio buffered.

NB initial playout delay estimate looks high at home, but this could
be related to link.

Location:
rat/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • rat/trunk/playout.c

    r2230 r2240  
    447447        return TRUE; 
    448448} 
     449 
     450/* Timestamp info functions **************************************************/ 
     451 
     452__inline int 
     453pb_get_start_ts(pb_t *pb, ts_t *ts) 
     454{ 
     455        assert(pb); 
     456        assert(ts); 
     457 
     458        if (pb->sentinel.next != pb->psentinel) { 
     459                *ts = pb->sentinel.next->playout; 
     460                return TRUE; 
     461        } 
     462        return FALSE; 
     463} 
     464 
     465__inline int 
     466pb_get_end_ts(pb_t *pb, ts_t *ts) 
     467{ 
     468        assert(pb); 
     469        assert(ts); 
     470 
     471        if (pb->sentinel.prev != pb->psentinel) { 
     472                *ts = pb->sentinel.prev->playout; 
     473                return TRUE; 
     474        } 
     475        return FALSE; 
     476} 
     477 
     478__inline int 
     479pb_iterator_get_ts(pb_iterator_t *pbi, ts_t *ts) 
     480{ 
     481        assert(pbi); 
     482        assert(ts); 
     483        if (pbi->node != pbi->buffer->psentinel) { 
     484                *ts = pbi->node->playout; 
     485                return TRUE; 
     486        } 
     487        return FALSE; 
     488} 
  • rat/trunk/playout.h

    r2216 r2240  
    126126             ts_t         now); 
    127127 
    128 /* Return the times of interest for playout buffer */ 
    129 ts_t pb_iterator_get_ts (struct s_pb *pb); 
    130 ts_t pb_get_end_ts      (struct s_pb *pb); 
     128/* Return the times of interest for playout buffer in ts, returns 
     129 * TRUE or FALSE depending on whether request successful 
     130 */ 
     131__inline int pb_get_start_ts     (struct s_pb *pb, ts_t *ts); 
     132__inline int pb_get_end_ts       (struct s_pb *pb, ts_t *ts); 
     133__inline int pb_iterator_get_ts  (struct s_pb_iterator *pbi, ts_t *ts); 
    131134 
    132135#endif /* __UCLMM_PLAYOUT_BUFFER_H__ */ 
  • rat/trunk/source.c

    r2231 r2240  
    616616source_get_audio_buffered (source *src) 
    617617{ 
    618         /* To be written */ 
    619         UNUSED(src); 
    620         return (ts_map32(8000,0)); 
     618        ts_t start, end; 
     619 
     620        /* Total audio buffered is start of media buffer 
     621         * to end of channel buffer. 
     622         */ 
     623 
     624        if (pb_get_start_ts(src->media, &start) && 
     625            pb_get_end_ts(src->channel, &end)) { 
     626                assert(ts_gt(end, start)); 
     627                return ts_sub(end, start); 
     628        } 
     629 
     630        return ts_map32(8000,0); 
    621631} 
    622632 
     
    624634source_get_playout_delay (source *src) 
    625635{ 
    626         /* To be written */ 
    627         UNUSED(src); 
    628         return (ts_map32(8000,0)); 
     636        ts_t start, end; 
     637 
     638        /* Current playout is pretty close to src->media_pos point, 
     639         * delay is diff between this and last packet received. 
     640         */ 
     641 
     642        if (pb_get_start_ts(src->channel,  &start) && 
     643            pb_get_end_ts(src->channel, &end)) { 
     644                assert(ts_gt(end, start)); 
     645                return ts_sub(end, start); 
     646        } 
     647 
     648        return ts_map32(8000,0); 
    629649} 
    630650