From patchwork Thu Apr 12 13:35:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Holljes X-Patchwork-Id: 8422 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.70 with SMTP id c67csp1908672jad; Thu, 12 Apr 2018 06:41:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+hXz34bP4Ecou3bZGDdYKQ3u7IOm1jNa/KslVtgyCGQmj4Z7pxzPzwYMS1xBDOmfVR/irO X-Received: by 10.28.156.195 with SMTP id f186mr714071wme.87.1523540518130; Thu, 12 Apr 2018 06:41:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523540518; cv=none; d=google.com; s=arc-20160816; b=b1UzTXNcuf0pC64pWiOnMLnTPoooBmGXosrggvB4fjM7Ll+F25lJKwp7RnZMmMVnTn SU+vike5PbT/X86k+JjVVrsR1BESIxsMFPzY9uX/oxXQAZ+nCH1QkPAsaSsvpfUOKmQ0 5WH4ovRMalyjX+X+f2O2FiqEDJ6zXpTAdCWkgQPKZXrzq9V5++3FepwGge/apKYZaDRp 2cnk4eqO+d73Uny88k1+xFoiHvdT72d1NcrEqqFMoVcv/RI/oWsAkqmjI1MtzissS1VH M5ImDKNnyOuQlqzSchDqlAZPoeCPlMp1nNndgQzS4e92VpEpDRT1E3LbKXfTG0U0cN/I O/PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=zPyUZXYYMw1FQK8O7d7mRo/My6blaBr0BxRKpZJi588=; b=F4mVMPhPfHl7F1GLYSzKBUFaL92l1IVMkkT0QBqYrtUbI1gFVPIjATUfgVqWvSQ+VW efTofx8SvTJVtdxp+5lcxgRkYVODyGvZEky3NHnLBrzLff7K1iWwOeQqJl673L9B4MOm 3S9qe4QwDYcmiU0EfC9PrssVMzEM5BZCq1ryiyMonteuoOPiJWBrOACNZQxusKw2fThe T4tO7OkcVD3Hx1FOkxur9K10egH9CRp5/GKVhnLZbdqpZQZ6qf1QrQ2mpZ1c22uitQaa LUvMVrGaAdfYzSR7ZX2mTb6+/bASlQv8hECpGpHhXKamFE8OHvSra0ECIkD4N35HJYEg XuoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com header.s=20161025 header.b=KB6+i72N; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t203si2636976wme.192.2018.04.12.06.41.57; Thu, 12 Apr 2018 06:41:58 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com header.s=20161025 header.b=KB6+i72N; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 48164689C78; Thu, 12 Apr 2018 16:41:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AE4E1689A03 for ; Thu, 12 Apr 2018 16:41:25 +0300 (EEST) Received: by mail-wr0-f196.google.com with SMTP id v60so1268417wrc.7 for ; Thu, 12 Apr 2018 06:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3sbePzIo7Ay1hCXWe2Qn4xv9TGXUGyuF1TV2EIeIRaY=; b=KB6+i72NYzo+8wtoNh54xlVq/oIcTcDB+hTp96h0y0UZVOIqUUZwClvY9giNJNj00+ jtdRGLRJYuce6IZgptqqMEzSJ4UXUqrc/WCt3f5rUVFifss/WKcDsdNfsaPLlaIkEmF8 8PA6tTwutm4SUFNJsk1bLWy+Tsb5BrGbQzfGXOoAYTMWjGtJZMRulFyAH6OmsSSK8oH1 V53csfi+EoEoGssUVstcFS9Oyyz0JPvuQxkaFxvQViJHIPJMajXjN0sbKWVwgiOgiWWX rqrXdEY9u3H+uTMD13Z4h9hFEMB4lt8x4OI3oRCdz4w5DLLJsEJfSMBNBUpWIdn2k/9m BMrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3sbePzIo7Ay1hCXWe2Qn4xv9TGXUGyuF1TV2EIeIRaY=; b=CW1zINbXeEuKfefn1plLlXX6W0lOw3sTr4WLME+psteV1PeThw8oe8h/mCNaO8K/1E 2YGzWb1vTPdjV1h/1EO5qUI7zAuUeMjg6L3sWkgPBGNX7ynlLhwlan5b6vtDk1To0uxX IdNe74PZo2YtS/oV/VTS7a/t/uVfr1Jz41tYbdyJJdJgW5SQS9tPdAhfQ+qw5WmiYO1d VOZ4fX+0mAz47luBF6RVKibfZxIIXQacMonqPGEl2y6DKH/2sY3OpyJi/LVFKDMAyEmT jD+tzpWayl0C9U+V/iJ1hwWrxlX/R8RgyLOxUhcVBrdW7FBbEWn7oO/D+t1JvPCWMNWg NPwA== X-Gm-Message-State: ALQs6tD8y8SXVsh/oxg9RQWxxTKq/5QqwdpKIRO5o8dwMvnZK/KExGGX tBNSfA+BJCXnc46wMRHXapM6oA== X-Received: by 10.223.166.161 with SMTP id t30mr861241wrc.1.1523540177021; Thu, 12 Apr 2018 06:36:17 -0700 (PDT) Received: from localhost.localdomain (HSI-KBW-046-005-002-245.hsi8.kabel-badenwuerttemberg.de. [46.5.2.245]) by smtp.gmail.com with ESMTPSA id y101sm4588731wmh.10.2018.04.12.06.36.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Apr 2018 06:36:16 -0700 (PDT) From: Stephan Holljes To: ffmpeg-devel@ffmpeg.org Date: Thu, 12 Apr 2018 15:35:49 +0200 Message-Id: <20180412133549.19939-5-klaxa1337@googlemail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180412133549.19939-1-klaxa1337@googlemail.com> References: <20180412133549.19939-1-klaxa1337@googlemail.com> Subject: [FFmpeg-devel] [PATCH 4/4] ffserver: Add basic documentation of the architecture X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Stephan Holljes MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- Documentation.txt | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Documentation.txt 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.