
Numbers are given for 100Hz stub server
and a tsp_stdout_client asking for the first double symbol.

CALL
TSP_session_create_data_sender_by_channel(channel_id_t channel_id)
  sets
    /* ringbuf size is in fact the number of element
     * you want to store in the to-be-created ringbuf
     */ 
    ringbuf_size = TSP_STREAM_SENDER_RINGBUF_SIZE * base_frequency;
                 = 10 * 100 = 1000;
    (
      tsp_const_def.h says:

      #ifdef VXWORKS
      #define TSP_STREAM_SENDER_RINGBUF_SIZE 2
      #else
      #define TSP_STREAM_SENDER_RINGBUF_SIZE 10
      #endif
    )

    /* Max group size is the size (in bytes) of the 
     * largest TSP group for this session
     * for single frequency request there is only a single
     * group whose size is the sum of the requested symbols size.
     * 
     *  if you ask for 2 double then you get 16 (2x8)
     */
    max_group_size = TSP_group_algo_get_biggest_group_size(session->session_data->groups);
                   = 8 (1 double symbol)

    then CALL
    TSP_data_sender_create(ringbuf_size, max_group_size);
       which sets
       sender->buffer_size = TSP_DATA_STREAM_MAX_BUFFER_SIZE(group_max_byte_size);
                           = 1024+8 = 1032

       TSP_DATA_STREAM_MAX_BUFFER_SIZE (defined in tsp_const_def.h)
       is the min of
             TSP_DATA_STREAM_MAX_BUFFER_MAXSIZE (see tsp_const_def.h)
             and
             group_max_byte_size+TSP_DATA_STREAM_MAX_HEADER_SIZE
             (which is 1024)

       fifo_size = formal arg ringbuf_size

    then CALL    
    TSP_stream_sender_create(fifo_size, sender->buffer_size);
     then
       sock->fifo_size = fifo_size; (= 1000)
       sock->buffer_size = buffer_size; (= 1032)
 

    then CALL (in the fifo_size>0 case i.e. active GLU)
    TSP_stream_sender_init_bufferized(sock)
        which in turns allocate the RINGBUF:
        RINGBUF_PTR_INIT(TSP_stream_sender_ringbuf_t,
		   sock->out_ringbuf,
		   TSP_stream_sender_item_t, 
		   sock->buffer_size,
		   RINGBUF_SZ(sock->fifo_size) );
 
     the malloc size is

           sizeof(TypeName) + (sizeof(ItemType) * mul_offset  * sz)
 
       with TypeName = TSP_stream_sender_ringbuf_t whose sizeof is 32
            ItemType = TSP_stream_sender_item_t whose sizeof is 8            
            mul_offset =  RINGBUF_MULTSUP((sizeof(ItemType) + nbSpareBytes),sizeof(ItemType)) / sizeof(ItemType);
               and nbSpareBytes = formal arg sock->buffer_size = 1032
            sz = RINGBUF_SZ(sock->fifo_size) = 1004


         /**
 * For number \a x, get the nearest superior or equal number, 
 * multiple of base 
 */
#define RINGBUF_MULTSUP(x, base)     (( (base) - ( (x) % (base) )) % (base) + (x) )

        so mul_offset is RINGBUF_MULTSUP(1040,8) / 8 = 1040/8 = 130
 
      in the end malloc of 32+ (8*130*1004) something like 1019 Kbytes!!
      

Then the ringbuf is read (RINGBUF_PTR_GETBYADDR) by TSP_streamer_sender_thread_sender
which send the data on the socket to the consumer.

Some other PUT first by calling TSP_stream_sender_get_ringbuf

CALL return in TSP_stream_sender_create
sender->out_fifo = TSP_stream_sender_get_ringbuf(sender->stream_sender);

someone CALLs
TSP_data_sender_get_out_item
     ret_item = RINGBUF_PTR_PUTBYADDR(data_sender->out_fifo);
     ...
     return ret_item;

in fact this is:
       TSP_data_sender_send which sends a TSP group
       ret_item stores TIMESTAMP   (4 bytes)
                       GROUP_INDEX (4 bytes)

       then the group data itself of max size = max_group_size

all in all it seems OK but the TSP_DATA_STREAM_MAX_HEADER_SIZE

introduced in tsp_const_def.h by tntdev when Added dynamic ringbuf
between RCS rev 1.16 and 1.15
TSP_DATA_STREAM_MAX_HEADER_SIZE should be no more than 2*sizeof(int)
which is the place needed for putting fixed-size TSP group header.


        