User:Thinker/GenericBuffering: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(→‎Buffering: configuration for output pads)
(→‎Buffering: buffer management)
Line 13: Line 13:
** the service function
** the service function
** the number of servers
** the number of servers
* Buffer management


  union QueueManagementType { QMT_DEFAULT, QMT_RED, QMT_TAIL_DROP };
  union QueueManagementType { QMT_DEFAULT, QMT_RED, QMT_TAIL_DROP };
Line 18: Line 19:
  union MsgSyncType { MST_NONE, MST_ACK, MST_NAK };
  union MsgSyncType { MST_NONE, MST_ACK, MST_NAK };
  union QueueThreadingType { MST_NONE, MST_THREAD_BEGIN, MST_THREAD_END, MST_THREAD_INDEPENDENT };
  union QueueThreadingType { MST_NONE, MST_THREAD_BEGIN, MST_THREAD_END, MST_THREAD_INDEPENDENT };
union BufferManagementType { BMT_REUSE, MST_UPSTREAM, MST_DOWNSTREAM, MST_PROVIDER };
  typedef int (*MsgServiceFunc)(Buffer *inbuffer);
  typedef int (*MsgServiceFunc)(Buffer *inbuffer);
typedef Buffer (*BufferCreatorFunc)(int paylaod_size);
   
   
  struct QueueConfig {
  struct QueueConfig {
Line 28: Line 31:
     QueueThreadingType qthreading;
     QueueThreadingType qthreading;
     MsgServiceFunc servicefunc;
     MsgServiceFunc servicefunc;
    BufferManagementType bman;
    BufferCreatorFunc bcreator;  // valid only for bman == MST_PROVIDER
     int numServers;
     int numServers;
     int numOutPads;  // Output pads
     int numOutPads;  // Output pads

Revision as of 07:04, 25 June 2013

A lot of features in Gecko require some kind of buffering; for ex., Camera, media playing back, WebRTC, Animation, ... etc. But, there is no generic buffering framework in Gecko. Every module implements its-owned buffering. The pro is getting better performance due to fully customized for the task. The cons are hardly for adapting, studying, analyzing, and porting. So, we need a framework for buffering that is easy to customize for performance, adapt to different configurations and applications, easily analysis it, port to various platforms, and a common language/slang among modules.

Buffering

There are several factors should be considered for buffering/queuing.

  • queue size
  • queue management
  • queuing discipline
  • synchronization
    • ack
    • nak
  • threading
  • servers
    • the service function
    • the number of servers
  • Buffer management
union QueueManagementType { QMT_DEFAULT, QMT_RED, QMT_TAIL_DROP };
union QueueDisciplineType { QMT_FIFO, QMT_LIFO, QMT_PRIO };
union MsgSyncType { MST_NONE, MST_ACK, MST_NAK };
union QueueThreadingType { MST_NONE, MST_THREAD_BEGIN, MST_THREAD_END, MST_THREAD_INDEPENDENT };
union BufferManagementType { BMT_REUSE, MST_UPSTREAM, MST_DOWNSTREAM, MST_PROVIDER };
typedef int (*MsgServiceFunc)(Buffer *inbuffer);
typedef Buffer (*BufferCreatorFunc)(int paylaod_size);

struct QueueConfig {
    const char *qname;
    int qsize;
    QueueManagementType qman;
    QueueDisciplineType qdisc;
    MsgSyncType msync;
    QueueThreadingType qthreading;
    MsgServiceFunc servicefunc;
    BufferManagementType bman;
    BufferCreatorFunc bcreator;  // valid only for bman == MST_PROVIDER
    int numServers;
    int numOutPads;  // Output pads
};

Configuration of Queues

Create and connect queues together.