From patchwork Tue Apr 17 01:52:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Holljes X-Patchwork-Id: 8471 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.1.85 with SMTP id c82csp1440329jad; Mon, 16 Apr 2018 18:58:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx49LfUfe59Um/r6dezFB7PWc70QFhASHbXtfMOM66eVhAqwrW7VcRVSbwMQqottnmE/nDTGi X-Received: by 10.223.163.221 with SMTP id m29mr113840wrb.4.1523930322821; Mon, 16 Apr 2018 18:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523930322; cv=none; d=google.com; s=arc-20160816; b=uNCRosjtJsljwzkGRvjtVswfoMoMgJ/iajZMaDNKHkaf6IbJp8N1nxrU4k3oJIJE9+ rLkumRauwfw//PZ6URxATnZqPhjfUiVlIuGrGAz5cZkE/V23+49mlFJypOCCBvI1MvsS lQdtf/qMj8/7D6r2UOV5yxsYsJGmwrIMaDSRmYcBWx3rrzmzx6kvP0bNilV6RDia9/qo 1UqgkaCpt4CJLhztwFY63OYmfdABtjOekgK+pRfh5gtoo+8xW05lK57pflUfZihVpM8b Gtk2WDQ8B8h5UlM0VPOv1gIv4113FcbszFWpcZbSQDQZNDEPsXwhOh3aYqhBDCtzF5QN QsDA== 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=KrAmT3s/e1IUOjV86ybuEBVEwuedXKhuQsHFpmNmCG4=; b=tr5FRKL775uEMl3S3bCvYbYuzTi7O7IQuY62NmIS/Ar2tZqGRcebbgurdScr4iOtB0 knEFs3sAYsQzJqr4xTA1l4IHwypZmCK63ZqKElIpD69LmuNbbpu2NlQnM11ytxECv9+t iV19Q4mkWlBZzdq8TU06F46J1f6FPL/MHdxQLLrW44p/ksXhxoPTDNm7n1UlAMYrAm9V z7YOkEip85LARYW+VpRUrQyoWbf8jne2zq7hSVlg3MLjs2DrCxQnl2CinKediGOAoRuf lytVZ+9qiqMXkk2vbbboJMv2dg/n45EPZ+jrhsR0K4DWz91SGFpgGIM2JVNrUWDEvL7G o9cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com header.s=20161025 header.b=uKcCpIiH; 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 r7si3192902wrc.403.2018.04.16.18.58.42; Mon, 16 Apr 2018 18:58:42 -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=uKcCpIiH; 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 0A39E689E35; Tue, 17 Apr 2018 04:58:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 379C2689834 for ; Tue, 17 Apr 2018 04:58:08 +0300 (EEST) Received: by mail-wr0-f178.google.com with SMTP id d19so30998052wre.1 for ; Mon, 16 Apr 2018 18:58:34 -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=yF49jmnZaYaW7OUT9R4ShbjBJCJ26Q7gjcV+1vA0NfM=; b=uKcCpIiHqpS4lRocY9s3ktD4EcsYbsBy3zVWtyAKbxHeJ674GAyI/bVauS9M5Ur3TR ayXq5NBfwVQevgSVNlMIQSP6pomyvvBHf5MuN85XL/1ecD99d5hLEjfiu6JXh+FRi/Qe nWv2/85qZVlZ/q2v7hysGX5rPL7ARq6rke0N6yLK0MYNTqTv4eknbnsBywFdsHV1HrLU NbJOEs8YjqT3QReL1TNM72UAuwestb1lhS8VEhQs+i04zSzK8URBXZbjUqi+vF81o9zF koEAftgvF0lEF8rw+N5JXDqSBEUVznA81syoro/giiFQUYnmxEVc+7KbwEFNWIT48YAb Z2/Q== 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=yF49jmnZaYaW7OUT9R4ShbjBJCJ26Q7gjcV+1vA0NfM=; b=sQl8G/jAkFCClvcCqKVOBvx8kb6nOJo1g3P/4fstv7/X4YY6K1UMxtmdEFMnxY1rpY DNW/8T2O46gt1LdA1L3SLeLhTrazfIQOLwSlYaetc5TbZh2HC1mKc3xFJqRxx0a2Q77a IGyT1N3UQgt+CDOphwRDspgEGktQGBtNGnYDUxCf8lLQLn4oBkKankG5bO2o6d9T40mI dxa6as4GqRP6HSGnMeFXMjdWUffNpw9jO9otjxY32oewVODwtDMxEyjDNn/Ya+hSKEp2 Eg56XoEqWSIyX5s4u/En1Zcz3waBQRzPvosBbZRVTykrIQm806Uj27E4hb2OJKuiJFDd i72A== X-Gm-Message-State: ALQs6tC17LmyK12KWF8/sqR6j07oO+o2HyoV9r25M/pGqB7u/wAsMUoW cBvcd2aGUP2eK9WGqmRhslS1dQ== X-Received: by 10.223.164.207 with SMTP id h15mr80840wrb.265.1523929980913; Mon, 16 Apr 2018 18:53:00 -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 b47sm11845123wrg.13.2018.04.16.18.52.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Apr 2018 18:53:00 -0700 (PDT) From: Stephan Holljes To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Apr 2018 03:52:33 +0200 Message-Id: <20180417015233.31983-5-klaxa1337@googlemail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180417015233.31983-1-klaxa1337@googlemail.com> References: <20180412133549.19939-1-klaxa1337@googlemail.com> <20180417015233.31983-1-klaxa1337@googlemail.com> Subject: [FFmpeg-devel] [PATCH 4/4] ffserver: Add basic documentation 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 | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Documentation.txt diff --git a/Documentation.txt b/Documentation.txt new file mode 100644 index 0000000..0f7485c --- /dev/null +++ b/Documentation.txt @@ -0,0 +1,64 @@ +About +----- + +In its current for this is a HTTP live-streaming server. A media file can be +streamed to a number of clients with the correct media file being muxed on- +the-fly for each client starting at the current position in the stream. +The stream received by the clients is simply a HTTP response to an HTTP +request. + + +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. + +Usage +----- + +Currently streams can be supplied as a stream through stdin or any ffmpeg- +compatible URI, e.g. files or network locations. Examples: + +cat somefile.mkv | ./ffserver + +./ffserver somefile.mkv + +./ffserver http://somehost/somefile.mkv + +This will start reading the file and open port 8080 for HTTP client connections. +The stream is read in real time from whatever resource it is retrieved. +Currently a maximum of 16 clients is implemented. + +The server responds to any GET request with the mediastream. Any other request +is answered with a HTTP 400 error. +If the maximum number of clients is reached the server responds with a 503 HTTP +error if a new client wants to connect. + +Once the stream ends the server will write all the remaining data to all +connected clients before closing the connections and exiting.