From fc252143ad189809998f42d1741b5a1c6cb1745a Mon Sep 17 00:00:00 2001 From: Anton Schubert Date: Mon, 9 Aug 2021 01:39:10 +0200 Subject: [PATCH] update README, add instructions on how to run from docker --- README.md | 22 +++++++--- docs/API.md | 99 +++++++++++++++++++++++++++++++++++++++++--- docs/Contributing.md | 10 ++--- 3 files changed, 113 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 0ab5a6f..371afa9 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,16 @@ Streaming-Relay for the SRT-protocol Use at your own risk -## Dependencies -Requires libsrt-1.4.2 +## Build with docker +You will need atleast docker-20.10 + +``` +docker build -t srtrelay . +``` + +## Build manually +### Install Dependencies +Requires >=libsrt-1.4.2, golang and a C compiler **Ubuntu** - you will need to [build libsrt yourself](https://github.com/Haivision/srt#build-on-linux) @@ -16,16 +24,18 @@ Requires libsrt-1.4.2 **Gentoo**: - emerge net-libs/srt -## Build +### Build ``` -go build +go build -o srtrelay ``` ## Usage ```bash -# start relay +# start relay (built manually) ./srtrelay + + # start publisher ffmpeg -i test.mp4 -c copy -f mpegts srt://localhost:1337?streamid=publish/test @@ -48,7 +58,7 @@ The configuration file can be placed under *config.toml* in the current working See [docs/API.md](docs/API.md) for more information about the API. ## Contributing -See [docts/Contributing.md](docs/Contributing.md) +See [docs/Contributing.md](docs/Contributing.md) ## Credits Thanks go to diff --git a/docs/API.md b/docs/API.md index 77416c1..0c9e3e9 100644 --- a/docs/API.md +++ b/docs/API.md @@ -2,13 +2,102 @@ See [config.toml.example](../config.toml.example) for configuring the API endpoint. ## Stream status - /streams -Returns a list of active streams with additional statistics. - -Content-Type: application/json - -Example: +- Returns a list of active streams with additional statistics. +- Content-Type: application/json +- Example: ``` GET http://localhost:8080/streams [{"name":"abc","clients":0,"created":"2020-11-24T23:55:27.265206348+01:00"}] +``` + +## Socket statistics - /sockets +- Returns internal srt statistics for each SRT client + - the exact statistics might change depending over time + - this will show stats for both publishers and subscribers +- Content-Type: application/json +- Example: +```json +[ + { + "address": "127.0.0.1:59565", + "stream_id": "publish/q2", + "stats": { + "MsTimeStamp": 26686, + "PktSentTotal": 0, + "PktRecvTotal": 9484, + "PktSndLossTotal": 0, + "PktRcvLossTotal": 0, + "PktRetransTotal": 0, + "PktSentACKTotal": 1680, + "PktRecvACKTotal": 0, + "PktSentNAKTotal": 0, + "PktRecvNAKTotal": 0, + "UsSndDurationTotal": 0, + "PktSndDropTotal": 0, + "PktRcvDropTotal": 0, + "PktRcvUndecryptTotal": 0, + "ByteSentTotal": 0, + "ByteRecvTotal": 11866496, + "ByteRcvLossTotal": 0, + "ByteRetransTotal": 0, + "ByteSndDropTotal": 0, + "ByteRcvDropTotal": 0, + "ByteRcvUndecryptTotal": 0, + "PktSent": 0, + "PktRecv": 9484, + "PktSndLoss": 0, + "PktRcvLoss": 0, + "PktRetrans": 0, + "PktRcvRetrans": 0, + "PktSentACK": 1680, + "PktRecvACK": 0, + "PktSentNAK": 0, + "PktRecvNAK": 0, + "MbpsSendRate": 0, + "MbpsRecvRate": 3.557279995149639, + "UsSndDuration": 0, + "PktReorderDistance": 0, + "PktRcvAvgBelatedTime": 0, + "PktRcvBelated": 0, + "PktSndDrop": 0, + "PktRcvDrop": 0, + "PktRcvUndecrypt": 0, + "ByteSent": 0, + "ByteRecv": 11866496, + "ByteRcvLoss": 0, + "ByteRetrans": 0, + "ByteSndDrop": 0, + "ByteRcvDrop": 0, + "ByteRcvUndecrypt": 0, + "UsPktSndPeriod": 10, + "PktFlowWindow": 8192, + "PktCongestionWindow": 8192, + "PktFlightSize": 0, + "MsRTT": 0.013, + "MbpsBandwidth": 1843.584, + "ByteAvailSndBuf": 12288000, + "ByteAvailRcvBuf": 12160500, + "MbpsMaxBW": 1000, + "ByteMSS": 1500, + "PktSndBuf": 0, + "ByteSndBuf": 0, + "MsSndBuf": 0, + "MsSndTsbPdDelay": 200, + "PktRcvBuf": 74, + "ByteRcvBuf": 89851, + "MsRcvBuf": 188, + "MsRcvTsbPdDelay": 200, + "PktSndFilterExtraTotal": 0, + "PktRcvFilterExtraTotal": 0, + "PktRcvFilterSupplyTotal": 0, + "PktRcvFilterLossTotal": 0, + "PktSndFilterExtra": 0, + "PktRcvFilterExtra": 0, + "PktRcvFilterSupply": 0, + "PktRcvFilterLoss": 0, + "PktReorderTolerance": 0 + } + } +] ``` \ No newline at end of file diff --git a/docs/Contributing.md b/docs/Contributing.md index 4d78ce7..9496070 100644 --- a/docs/Contributing.md +++ b/docs/Contributing.md @@ -1,14 +1,10 @@ # Contributing -Run tests before creating a pull request +Please run tests before creating a pull request ``` go test ./... ``` ## General concepts - - Just a 1:n multiplexer, one publisher (push) to multiple subscribers (pull) + - srtrelay hsould just be a 1:n multiplexer, one publisher (push) to multiple subscribers (pull) - Don't try to reimplement functionality already present elsewhere in the stack (e.g. remuxing/transcoding) - - Allow any data to be relayed, not just MPEG-TS - -## TODOs -### Figure out what's going on with ffmpeg srt support -If an srt stream is read with ffmpeg (atleast for h.264 + MPEG-TS) \ No newline at end of file + - Allow any data to be relayed, not just MPEG-TS \ No newline at end of file