• Stars
    star
    699
  • Rank 62,149 (Top 2 %)
  • Language
    C++
  • License
    Other
  • Created over 10 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Lightweight thread library for C/C++ coroutine (similar to goroutine), for high performance network servers.

state-threads

Fork from http://sourceforge.net/projects/state-threads, patched for SRS.

See: https://github.com/ossrs/state-threads/blob/srs/README

For original ST without any changes, checkout the ST master branch.

LICENSE

state-threads is licenced under MPL or GPLv2.

Linux: Usage

Get code:

git clone -b srs https://github.com/ossrs/state-threads.git

For Linux:

make linux-debug

For Linux aarch64, which fail with Unknown CPU architecture:

make linux-debug EXTRA_CFLAGS="-D__aarch64__"

Note: For more CPU architectures, please see #22

Linux with valgrind:

make linux-debug EXTRA_CFLAGS="-DMD_VALGRIND"

Remark: User must install valgrind, for instance, in centos6 sudo yum install -y valgrind valgrind-devel.

Linux with valgrind and epoll:

make linux-debug EXTRA_CFLAGS="-DMD_HAVE_EPOLL -DMD_VALGRIND"

Mac: Usage

Get code:

git clone -b srs https://github.com/ossrs/state-threads.git

For OSX:

make darwin-debug

For OSX, user must specifies the valgrind header files:

make darwin-debug EXTRA_CFLAGS="-DMD_HAVE_KQUEUE -DMD_VALGRIND -I/usr/local/include"

Remark: M1 is unsupported by ST, please use docker to run, please read SRS#2747.

Windows: Usage

Get code:

git clone -b srs https://github.com/ossrs/state-threads.git

For Cygwin(Windows):

make cygwin64-debug

Remark: Windows native build is unsupported right now.

Branch SRS

The branch srs was patched and refined:

  • ARM: Patch st.arm.patch, for ARM.
  • OSX: Patch st.osx.kqueue.patch, for osx.
  • Linux: Patch st.disable.examples.patch, for ubuntu.
  • System: Refine TAB of code.
  • ARM: Merge from michaeltalyansky and xzh3836598, support ARM.
  • Valgrind: Merge from toffaletti, support valgrind for ST.
  • OSX: Patch st.osx10.14.build.patch, for osx 10.14 build.
  • ARM: Support macro MD_ST_NO_ASM to disable ASM, #8.
  • AARCH64: Merge patch srs#1282 to support aarch64, #9.
  • OSX: Support OSX for Apple Darwin, macOS, #11.
  • System: Refine performance for sleep or epoll_wait(0), #17.
  • System: Support utest by gtest and coverage by gcov/gocvr.
  • System: Only support for Linux and Darwin. #19, srs#2188.
  • System: Improve the performance of timer. 9fe8cfe5b, 7879c2b, 387cddb
  • Windows: Support Windows 64bits. #20.
  • MIPS: Support Linux/MIPS for OpenWRT, #21.
  • LOONGARCH: Support loongarch for loongson CPU, #24.
  • System: Support Multiple Threads for Linux and Darwin. #19, srs#2188.
  • RISCV: Support RISCV for RISCV CPU, #24.
  • MIPS: Support Linux/MIPS64 for loongson 3A4000/3B3000, #21.
  • AppleM1: Support Apple Silicon M1(aarch64), #30.
  • IDE: Support CLion for debugging and learning.
  • Define and use a new jmpbuf, because the structure is different.
  • Check capability for backtrack.
  • Support set specifics for any thread.
  • Support st_destroy to free resources for asan.
  • System: Support sendmmsg for UDP, #12.

GDB Tools

Valgrind

How to debug with gdb under valgrind, read valgrind manual.

About startup parameters, read valgrind cli.

Important cli options:

  1. --undef-value-errors=<yes|no> [default: yes], Controls whether Memcheck reports uses of undefined value errors. Set this to no if you don't want to see undefined value errors. It also has the side effect of speeding up Memcheck somewhat.
  2. --leak-check=<no|summary|yes|full> [default: summary], When enabled, search for memory leaks when the client program finishes. If set to summary, it says how many leaks occurred. If set to full or yes, each individual leak will be shown in detail and/or counted as an error, as specified by the options --show-leak-kinds and --errors-for-leak-kinds.
  3. --track-origins=<yes|no> [default: no], Controls whether Memcheck tracks the origin of uninitialised values. By default, it does not, which means that although it can tell you that an uninitialised value is being used in a dangerous way, it cannot tell you where the uninitialised value came from. This often makes it difficult to track down the root problem.
  4. --show-reachable=<yes|no> , --show-possibly-lost=<yes|no>, to show the using memory.

Linux: UTest

Note: We use Google test in utest/gtest-fit.

To make ST with utest and run it:

make linux-debug-utest && ./obj/st_utest

Note that the gcc(4.8) of CentOS is too old, please use docker(ossrs/srs:dev-gcc7) to run:

docker run --rm -it -v $(pwd):/state-threads -w /state-threads \
    registry.cn-hangzhou.aliyuncs.com/ossrs/srs:dev-gcc7 \
    bash -c 'make linux-debug-utest && ./obj/st_utest'

Mac: UTest

Note: We use Google test in utest/gtest-fit.

To make ST with utest and run it:

make darwin-debug-utest && ./obj/st_utest

Linux: Coverage

Note: We use Google test in utest/gtest-fit.

To make ST with utest and run it:

make linux-debug-gcov && ./obj/st_utest

Note that the gcc(4.8) of CentOS is too old, please use docker(ossrs/srs:dev-gcc7) to run:

docker run --rm -it -v $(pwd):/state-threads -w /state-threads \
    registry.cn-hangzhou.aliyuncs.com/ossrs/srs:dev-gcc7 \
    bash -c 'make linux-debug-gcov && ./obj/st_utest'

Then, install gcovr for coverage:

yum install -y python2-pip &&
pip install lxml && pip install gcovr

Finally, run test and get the report:

bash auto/coverage.sh

Mac: Coverage

Note: We use Google test in utest/gtest-fit.

To make ST with utest and run it:

make darwin-debug-gcov && ./obj/st_utest

Then, install gcovr for coverage:

pip install gcovr

Finally, run test and get the report:

bash auto/coverage.sh

Docs & Analysis

CLion

Use CLion to open directory state-threads.

Then, open ide/st_clion/CMakeLists.txt and click Load CMake project.

Finally, select a configuration to run or debug.

Winlin 2016

More Repositories

1

srs

SRS is a simple, high-efficiency, real-time video server supporting RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181.
C++
23,947
star
2

go-oryx

A HTTP/HTTPS API proxy for SRS.
Go
640
star
3

srs-bench

SB(SRS Bench) is a set of benchmark and regression test tools, for SRS and other media servers, supports HTTP-FLV, RTMP, HLS, WebRTC and GB28181.
Go
371
star
4

srs-stack

SRS Stack is an all-in-one, out-of-the-box, and open-source video solution for creating online video services, including live streaming and WebRTC, on the cloud or through self-hosting.
JavaScript
319
star
5

srs-sea

The SEA(Stream Encoder for Android) publish live stream to SRS over HTTP-FLV.
312
star
6

flutter_live

Live streaming player, iOS+Android, RTMP/HTTP-FLV/HLS/WebRTC, by Flutter+SRS.
JavaScript
303
star
7

srs-librtmp

The client library srs-librtmp of SRS(https://github.com/ossrs/srs)
247
star
8

librtmp

Fork from http://git.ffmpeg.org/rtmpdump integrated with srs.
C
142
star
9

go-oryx-lib

The public multiple media library for https://github.com/ossrs/go-oryx.
Go
105
star
10

srs-console

SRS console at http://ossrs.net/console
88
star
11

srs-gb28181

GB28181 server based on SRS
81
star
12

dev-docker

The docker for development environment for SRS.
Dockerfile
77
star
13

srs-unity

WebRTC Samples with SRS SFU server for Unity.
C#
54
star
14

signaling

A demo WebRTC signaling for https://github.com/ossrs/srs
JavaScript
44
star
15

srs-ble

The BLE is a better BULL LIVE ENCODER than OBS for PC(Windows/MAC).
31
star
16

srs-dolphin

Multiple cores ability for https://github.com/ossrs/srs
26
star
17

ai-talk

AI-Talk allows you to talk with OpenAI GPT.
Go
25
star
18

srs-sip

The SIP demo application for SRS GB28181.
Java
20
star
19

go-sharp

The go-sharp(go-srs-http-advanced-reverse-proxy) is the proxy for SRS HTTP FLV.
19
star
20

Typecho-Plugin-SrsPlayer

SRS Player is a video streaming player, supports HLS/HTTP-FLV/WebRTC etc.
JavaScript
19
star
21

srs-k2

Apply https://github.com/k2-fsa/sherpa-ncnn in live streaming and WebRTC
Go
18
star
22

ai-translation

AI translation for English study based on FFmpeg, Whisper, Fairseq, OBS, SRS, and GPT.
Python
17
star
23

srs-k8s-template

Template repository for deploying SRS to any K8s service by GitHub Actions
14
star
24

srs-windows

Adapt SRS for Windows
C++
12
star
25

WordPress-Plugin-SrsPlayer

SRS Player is a video streaming player, supports HLS/HTTP-FLV/WebRTC etc.
JavaScript
12
star
26

srs-docs

The documents for SRS
JavaScript
11
star
27

tc-ui

WebUI for tcconfig and tc
JavaScript
7
star
28

srs-helm

Helm Charts for SRS media server.
Shell
6
star
29

issues-translation

Use AI/GPT to translate GitHub issues into English.
Python
5
star
30

flutter_rtc

WebRTC demo by Flutter for https://github.com/ossrs/srs
Dart
4
star
31

srs-ack-template

Template repository for deploying SRS to ACK(Alibaba Cloud Container Service for Kubernetes)
4
star
32

tea

TEA(TC eBPF for AV) is a network emulator and a set of tools for SRS and any media systems.
C
4
star
33

srs-las

LAS server based on SRS
C++
3
star
34

srs-simulcast

WebRTC simulcast for SRS
C++
3
star
35

srs-spa

The SPA(Stream Player for Android) play live stream from SRS over HTTP-FLV.
3
star
36

flutter_srs

A new Flutter project.
C++
2
star
37

srs-sctp

WebRTC datachannel for SRS
C++
2
star
38

srs-toolkit-idea

SRS Toolkit for IntelliJ IDEA - a plugin for integrating with SRS from JetBrains IDEs, for https://github.com/ossrs/srs
Kotlin
2
star
39

srs-aks-template

Template repository for deploying SRS to AKS(Azure Kubernetes Service)
2
star
40

ossrs.net

For https://ossrs.net
HTML
1
star
41

srs-droplet-template

Deploy SRS to DigitalOcean droplet
1
star
42

srs-g711

Support G.711 for SRS
C++
1
star
43

srs-secure-api

Demonstrated Secure HTTP API for SRS.
1
star
44

k8s-set-context-action

GitHub Action for setting context before deploying to Kubernetes clusters
JavaScript
1
star