diff mbox

[FFmpeg-devel,4/4] ffserver: Add basic documentation of the architecture

Message ID 20180412133549.19939-5-klaxa1337@googlemail.com
State Superseded
Headers show

Commit Message

Stephan Holljes April 12, 2018, 1:35 p.m. UTC
---
 Documentation.txt | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 Documentation.txt
diff mbox

Patch

diff --git a/Documentation.txt b/Documentation.txt
new file mode 100644
index 0000000..de7b522
--- /dev/null
+++ b/Documentation.txt
@@ -0,0 +1,30 @@ 
+Documentation
+-------------
+
+The current implementation has three different types of work that is done in
+different threads. These types are: reading a stream, accepting HTTP
+connections and writing media data to clients.
+
+The design tries to follow a Publisher-Subscriber-Pattern. The PublisherContext
+struct contains buffers of read media data and the list of clients. Clients
+themselves contain a buffer of media data that still has to be sent to them.
+
+The reading thread takes care of segmenting the stream into independent chunks
+of data and pushing it to the PublisherContext, which publishes the new Segment
+to connected clients. This publishing only adds this Segment to the client's
+buffer.
+
+The writing thread does the actual writing of data over the network. It checks
+each client's state and if there is data available that can be written to that
+client it is sent.
+
+The accept thread accepts new clients over HTTP and if not all client slots are
+in use, writes the stream-header and adds the client to the PublisherContext.
+
+A Segment is only stored in memory once and is refcounted. Buffers in the
+PublisherContext and clients contain pointers to Segments.
+
+Buffers are implemented using AVFifoBuffer.
+
+Client states are protected by pthread-mutex-locks, making it possible to run
+multiple write threads.