mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Merge branch '4.0release' into xialixin-dev-28181
This commit is contained in:
commit
a342f460e7
29 changed files with 654 additions and 203 deletions
|
@ -5,13 +5,13 @@ jobs:
|
||||||
- image: ossrs/srs:dev
|
- image: ossrs/srs:dev
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: cd trunk && ./configure && make
|
- run: cd trunk && ./configure --with-utest && make
|
||||||
test:
|
test:
|
||||||
docker:
|
docker:
|
||||||
- image: ossrs/srs:dev
|
- image: ossrs/srs:dev
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: cd trunk && ./configure --gcov && make && ./objs/srs_utest && bash auto/coverage.sh
|
- run: cd trunk && ./configure --with-utest --gcov && make && ./objs/srs_utest && bash auto/coverage.sh
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build_and_test:
|
build_and_test:
|
||||||
|
|
|
@ -56,3 +56,4 @@ CONTRIBUTORS ordered by first contribution.
|
||||||
* runner365<shi.weibd@hotmail.com>
|
* runner365<shi.weibd@hotmail.com>
|
||||||
* XiaofengWang<wasphin@gmail.com>
|
* XiaofengWang<wasphin@gmail.com>
|
||||||
* XiaLixin<xialx@yuntongxun.com>
|
* XiaLixin<xialx@yuntongxun.com>
|
||||||
|
* yanghuiwen<cainiaodj@qq.com>
|
||||||
|
|
105
README.md
105
README.md
|
@ -13,22 +13,22 @@ SRS is a RTMP/HLS/WebRTC/SRT/GB28181 streaming cluster, high efficiency, stable
|
||||||
<a name="product"></a>
|
<a name="product"></a>
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
**Step 1:** Get SRS.
|
**>>> Step 1:** Get SRS.
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/ossrs/srs &&
|
git clone https://gitee.com/winlinvip/srs.oschina.git srs &&
|
||||||
cd srs/trunk
|
cd srs/trunk && git remote set-url origin https://github.com/ossrs/srs.git && git pull
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note: Repository too large? Please clone from these [mirrors](#mirrors) instead.
|
> Note: We use [mirrors(gitee)](#mirrors) here, but it's also ok to directly clone by `git clone https://github.com/ossrs/srs.git && cd srs/trunk`
|
||||||
|
|
||||||
**Step 2:** Build SRS.
|
**>>> Step 2:** Build SRS.
|
||||||
|
|
||||||
```
|
```
|
||||||
./configure && make
|
./configure && make
|
||||||
```
|
```
|
||||||
|
|
||||||
> Remark: Recommend Centos6 64bits, please read wiki([CN][v3_CN_Build],[EN][v3_EN_Build]).
|
> Remark: Recommend to use Centos7 64bits, please read wiki([CN][v3_CN_Build],[EN][v3_EN_Build]).
|
||||||
|
|
||||||
> Note: You can also build SRS in docker, please read [docker][docker-dev].
|
> Note: You can also build SRS in docker, please read [docker][docker-dev].
|
||||||
|
|
||||||
|
@ -38,13 +38,16 @@ cd srs/trunk
|
||||||
./objs/srs -c conf/srs.conf
|
./objs/srs -c conf/srs.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
**Whatever**, you can also directly run SRS in [docker][docker-srs3]:
|
**>>> Whatever**, you can also directly run SRS in [docker][docker-srs3]:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run -p 1935:1935 -p 1985:1985 -p 8080:8080 ossrs/srs:3
|
docker run -p 1935:1935 -p 1985:1985 -p 8080:8080 \
|
||||||
|
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:3
|
||||||
```
|
```
|
||||||
|
|
||||||
**From here,** strongly recommend to read bellow wikis:
|
> Note: Again, we use [ACR](https://cr.console.aliyun.com/) here, you can directly run in docker hub by `docker run -p 1935:1935 -p 1985:1985 -p 8080:8080 ossrs/srs:3`
|
||||||
|
|
||||||
|
**>>> From here,** strongly recommend to read bellow wikis:
|
||||||
|
|
||||||
* Usage: How to delivery RTMP?([CN][v1_CN_SampleRTMP], [EN][v1_EN_SampleRTMP])
|
* Usage: How to delivery RTMP?([CN][v1_CN_SampleRTMP], [EN][v1_EN_SampleRTMP])
|
||||||
* Usage: How to delivery RTMP-Edge Cluster?([CN][v3_CN_SampleRTMPCluster], [EN][v3_EN_SampleRTMPCluster])
|
* Usage: How to delivery RTMP-Edge Cluster?([CN][v3_CN_SampleRTMPCluster], [EN][v3_EN_SampleRTMPCluster])
|
||||||
|
@ -169,6 +172,13 @@ For previous versions, please read:
|
||||||
|
|
||||||
## V3 changes
|
## V3 changes
|
||||||
|
|
||||||
|
* <strong>v3.0, 2020-03-29, [3.0 beta4(3.0.139)][r3.0b4] released. 122674 lines.</strong>
|
||||||
|
* v3.0, 2020-03-28, Support multiple OS/Platform build cache. 3.0.139
|
||||||
|
* v3.0, 2020-03-28, For [#1250][bug #1250], support macOS, OSX, MacbookPro, Apple Darwin. 3.0.138
|
||||||
|
* v3.0, 2020-03-21, For [#1629][bug #1629], fix kickoff FLV client bug. 3.0.137
|
||||||
|
* v3.0, 2020-03-21, For [#1619][bug #1619], configure without utest by default. 3.0.136
|
||||||
|
* v3.0, 2020-03-21, For [#1651][bug #1651], fix return pnwrite of srs_write_large_iovs. 3.0.135
|
||||||
|
* <strong>v3.0, 2020-03-18, [3.0 beta3(3.0.134)][r3.0b3] released. 122509 lines.</strong>
|
||||||
* v3.0, 2020-03-12, For [#1635][bug #1635], inotify watch ConfigMap for reload. 3.0.134
|
* v3.0, 2020-03-12, For [#1635][bug #1635], inotify watch ConfigMap for reload. 3.0.134
|
||||||
* v3.0, 2020-03-12, For [#1635][bug #1635], support auto reaload config by inotify. 3.0.129
|
* v3.0, 2020-03-12, For [#1635][bug #1635], support auto reaload config by inotify. 3.0.129
|
||||||
* v3.0, 2020-03-12, For [#1630][bug #1630], disable cache for stream changing, and drop dup header. 3.0.128
|
* v3.0, 2020-03-12, For [#1630][bug #1630], disable cache for stream changing, and drop dup header. 3.0.128
|
||||||
|
@ -775,6 +785,8 @@ For previous versions, please read:
|
||||||
|
|
||||||
## Releases
|
## Releases
|
||||||
|
|
||||||
|
* 2020-03-29, [Release v3.0-b3][r3.0b4], 3.0 beta4, 3.0.139, 122674 lines.
|
||||||
|
* 2020-03-18, [Release v3.0-b3][r3.0b3], 3.0 beta3, 3.0.134, 122509 lines.
|
||||||
* 2020-03-05, [Release v3.0-b2][r3.0b2], 3.0 beta2, 3.0.123, 122170 lines.
|
* 2020-03-05, [Release v3.0-b2][r3.0b2], 3.0 beta2, 3.0.123, 122170 lines.
|
||||||
* 2020-02-14, [Release v3.0-b1][r3.0b1], 3.0 beta1, 3.0.117, 121964 lines.
|
* 2020-02-14, [Release v3.0-b1][r3.0b1], 3.0 beta1, 3.0.117, 121964 lines.
|
||||||
* 2020-02-02, [Release v3.0-b0][r3.0b0], 3.0 beta0, 3.0.112, 121709 lines.
|
* 2020-02-02, [Release v3.0-b0][r3.0b0], 3.0 beta0, 3.0.112, 121709 lines.
|
||||||
|
@ -875,7 +887,7 @@ Comparing with other media servers, SRS is much better and stronger, for details
|
||||||
| Feature | SRS | NGINX | CRTMPD | AMS | WOWZA |
|
| Feature | SRS | NGINX | CRTMPD | AMS | WOWZA |
|
||||||
| ----------- | ------- | ----- | --------- | -------- | ------ |
|
| ----------- | ------- | ----- | --------- | -------- | ------ |
|
||||||
| Concurrency | 7.5k | 3k | 2k | 2k | 3k |
|
| Concurrency | 7.5k | 3k | 2k | 2k | 3k |
|
||||||
|MultipleProcess| Experiment| Stable | X | X | X |
|
|MultipleProcess| [Stable][v3_CN_ReusePort] | Stable | X | X | X |
|
||||||
| RTMP Latency| 0.1s | 3s | 3s | 3s | 3s |
|
| RTMP Latency| 0.1s | 3s | 3s | 3s | 3s |
|
||||||
| HLS Latency | 10s | 30s | X | 30s | 30s |
|
| HLS Latency | 10s | 30s | X | 30s | 30s |
|
||||||
|
|
||||||
|
@ -938,18 +950,18 @@ The data for playing RTMP was benchmarked by [SB][srs-bench]:
|
||||||
|
|
||||||
| Update | SRS | Clients | Type | CPU | Memory | Commit |
|
| Update | SRS | Clients | Type | CPU | Memory | Commit |
|
||||||
| ------------- | --------- | ------------- | ------------- | --------- | -------- | ------------ |
|
| ------------- | --------- | ------------- | ------------- | --------- | -------- | ------------ |
|
||||||
| 2013-11-28 | 0.5.0 | 1.8k(1800) | players | 90% | 41M | - |
|
|
||||||
| 2014-07-12 | 0.9.156 | 1.8k(1800) | players | 68% | 38MB | - |
|
|
||||||
| 2014-07-12 | 0.9.156 | 2.7k(2700) | players | 89% | 61MB | [code][p6] |
|
|
||||||
| 2014-11-11 | 1.0.5 | 2.7k(2700) | players | 85% | 66MB | - |
|
|
||||||
| 2014-11-11 | 2.0.12 | 2.7k(2700) | players | 85% | 66MB | - |
|
|
||||||
| 2014-11-12 | 2.0.14 | 2.7k(2700) | players | 69% | 59MB | - |
|
|
||||||
| 2014-11-12 | 2.0.14 | 3.5k(3500) | players | 95% | 78MB | [code][p7] |
|
|
||||||
| 2014-11-13 | 2.0.15 | 6.0k(6000) | players | 82% | 203MB | [code][p8] |
|
|
||||||
| 2014-11-22 | 2.0.30 | 7.5k(7500) | players | 87% | 320MB | [code][p9] |
|
|
||||||
| 2014-12-05 | 2.0.55 | 8.0k(8000) | players | 89% | 360MB | [code][p10] |
|
|
||||||
| 2014-12-05 | 2.0.57 | 9.0k(9000) | players | 90% | 468MB | [code][p11] |
|
|
||||||
| 2014-12-07 | 2.0.67 | 10k(10000) | players | 95% | 656MB | [code][p12] |
|
| 2014-12-07 | 2.0.67 | 10k(10000) | players | 95% | 656MB | [code][p12] |
|
||||||
|
| 2014-12-05 | 2.0.57 | 9.0k(9000) | players | 90% | 468MB | [code][p11] |
|
||||||
|
| 2014-12-05 | 2.0.55 | 8.0k(8000) | players | 89% | 360MB | [code][p10] |
|
||||||
|
| 2014-11-22 | 2.0.30 | 7.5k(7500) | players | 87% | 320MB | [code][p9] |
|
||||||
|
| 2014-11-13 | 2.0.15 | 6.0k(6000) | players | 82% | 203MB | [code][p8] |
|
||||||
|
| 2014-11-12 | 2.0.14 | 3.5k(3500) | players | 95% | 78MB | [code][p7] |
|
||||||
|
| 2014-11-12 | 2.0.14 | 2.7k(2700) | players | 69% | 59MB | - |
|
||||||
|
| 2014-11-11 | 2.0.12 | 2.7k(2700) | players | 85% | 66MB | - |
|
||||||
|
| 2014-11-11 | 1.0.5 | 2.7k(2700) | players | 85% | 66MB | - |
|
||||||
|
| 2014-07-12 | 0.9.156 | 2.7k(2700) | players | 89% | 61MB | [code][p6] |
|
||||||
|
| 2014-07-12 | 0.9.156 | 1.8k(1800) | players | 68% | 38MB | - |
|
||||||
|
| 2013-11-28 | 0.5.0 | 1.8k(1800) | players | 90% | 41M | - |
|
||||||
|
|
||||||
<a name="publish-rtmp-benchmark"></a>
|
<a name="publish-rtmp-benchmark"></a>
|
||||||
**Publish RTMP benchmark**
|
**Publish RTMP benchmark**
|
||||||
|
@ -958,15 +970,15 @@ The data for publishing RTMP was benchmarked by [SB][srs-bench]:
|
||||||
|
|
||||||
| Update | SRS | Clients | Type | CPU | Memory | Commit |
|
| Update | SRS | Clients | Type | CPU | Memory | Commit |
|
||||||
| ------------- | --------- | ------------- | ------------- | --------- | -------- | ------------ |
|
| ------------- | --------- | ------------- | ------------- | --------- | -------- | ------------ |
|
||||||
| 2014-12-03 | 1.0.10 | 1.2k(1200) | publishers | 96% | 43MB | - |
|
|
||||||
| 2014-12-03 | 2.0.12 | 1.2k(1200) | publishers | 96% | 43MB | - |
|
|
||||||
| 2014-12-03 | 2.0.47 | 1.2k(1200) | publishers | 84% | 76MB | [code][p1] |
|
|
||||||
| 2014-12-03 | 2.0.47 | 1.4k(1400) | publishers | 95% | 140MB | - |
|
|
||||||
| 2014-12-03 | 2.0.48 | 1.4k(1400) | publishers | 95% | 140MB | [code][p2] |
|
|
||||||
| 2014-12-04 | 2.0.49 | 1.4k(1400) | publishers | 68% | 144MB | - |
|
|
||||||
| 2014-12-04 | 2.0.49 | 2.5k(2500) | publishers | 95% | 404MB | [code][p3] |
|
|
||||||
| 2014-12-04 | 2.0.51 | 2.5k(2500) | publishers | 91% | 259MB | [code][p4] |
|
|
||||||
| 2014-12-04 | 2.0.52 | 4.0k(4000) | publishers | 80% | 331MB | [code][p5] |
|
| 2014-12-04 | 2.0.52 | 4.0k(4000) | publishers | 80% | 331MB | [code][p5] |
|
||||||
|
| 2014-12-04 | 2.0.51 | 2.5k(2500) | publishers | 91% | 259MB | [code][p4] |
|
||||||
|
| 2014-12-04 | 2.0.49 | 2.5k(2500) | publishers | 95% | 404MB | [code][p3] |
|
||||||
|
| 2014-12-04 | 2.0.49 | 1.4k(1400) | publishers | 68% | 144MB | - |
|
||||||
|
| 2014-12-03 | 2.0.48 | 1.4k(1400) | publishers | 95% | 140MB | [code][p2] |
|
||||||
|
| 2014-12-03 | 2.0.47 | 1.4k(1400) | publishers | 95% | 140MB | - |
|
||||||
|
| 2014-12-03 | 2.0.47 | 1.2k(1200) | publishers | 84% | 76MB | [code][p1] |
|
||||||
|
| 2014-12-03 | 2.0.12 | 1.2k(1200) | publishers | 96% | 43MB | - |
|
||||||
|
| 2014-12-03 | 1.0.10 | 1.2k(1200) | publishers | 96% | 43MB | - |
|
||||||
|
|
||||||
<a name="play-http-flv-benchmark"></a>
|
<a name="play-http-flv-benchmark"></a>
|
||||||
**Play HTTP FLV benchmark**
|
**Play HTTP FLV benchmark**
|
||||||
|
@ -976,11 +988,11 @@ The data for playing HTTP FLV was benchmarked by [SB][srs-bench]:
|
||||||
|
|
||||||
| Update | SRS | Clients | Type | CPU | Memory | Commit |
|
| Update | SRS | Clients | Type | CPU | Memory | Commit |
|
||||||
| ------------- | --------- | ------------- | ------------- | --------- | -------- | ------------ |
|
| ------------- | --------- | ------------- | ------------- | --------- | -------- | ------------ |
|
||||||
| 2014-05-24 | 2.0.167 | 1.0k(1000) | players | 82% | 86MB | - |
|
|
||||||
| 2014-05-24 | 2.0.168 | 2.3k(2300) | players | 92% | 276MB | [code][p17] |
|
|
||||||
| 2014-05-24 | 2.0.169 | 3.0k(3000) | players | 94% | 188MB | [code][p18] |
|
|
||||||
| 2014-05-24 | 2.0.170 | 3.0k(3000) | players | 89% | 96MB | [code][p19] |
|
|
||||||
| 2014-05-25 | 2.0.171 | 6.0k(6000) | players | 84% | 297MB | [code][p20] |
|
| 2014-05-25 | 2.0.171 | 6.0k(6000) | players | 84% | 297MB | [code][p20] |
|
||||||
|
| 2014-05-24 | 2.0.170 | 3.0k(3000) | players | 89% | 96MB | [code][p19] |
|
||||||
|
| 2014-05-24 | 2.0.169 | 3.0k(3000) | players | 94% | 188MB | [code][p18] |
|
||||||
|
| 2014-05-24 | 2.0.168 | 2.3k(2300) | players | 92% | 276MB | [code][p17] |
|
||||||
|
| 2014-05-24 | 2.0.167 | 1.0k(1000) | players | 82% | 86MB | - |
|
||||||
|
|
||||||
<a name="latency-benchmark"></a>
|
<a name="latency-benchmark"></a>
|
||||||
**Latency benchmark**
|
**Latency benchmark**
|
||||||
|
@ -990,9 +1002,9 @@ The latency between encoder and player with realtime config([CN][v3_CN_LowLatenc
|
||||||
|
|
||||||
| Update | SRS | VP6 | H.264 | VP6+MP3 | H.264+MP3 |
|
| Update | SRS | VP6 | H.264 | VP6+MP3 | H.264+MP3 |
|
||||||
| ------------- | --------- | --------- | --------- | --------- | -------- |
|
| ------------- | --------- | --------- | --------- | --------- | -------- |
|
||||||
| 2014-12-03 | 1.0.10 | 0.4s | 0.4s | 0.9s | 1.2s |
|
|
||||||
| 2014-12-12 | 2.0.70 |[0.1s][p13]|[0.4s][p14]| 1.0s | 0.9s |
|
|
||||||
| 2014-12-16 | 2.0.72 | 0.1s | 0.4s |[0.8s][p15]|[0.6s][p16]|
|
| 2014-12-16 | 2.0.72 | 0.1s | 0.4s |[0.8s][p15]|[0.6s][p16]|
|
||||||
|
| 2014-12-12 | 2.0.70 |[0.1s][p13]|[0.4s][p14]| 1.0s | 0.9s |
|
||||||
|
| 2014-12-03 | 1.0.10 | 0.4s | 0.4s | 0.9s | 1.2s |
|
||||||
|
|
||||||
> 2018-08-05, [c45f72e](https://github.com/ossrs/srs/commit/c45f72ef7bac9c7cf85b9125fc9e3aafd53f396f), Refine HTTP-FLV latency, support realtime mode. 2.0.252
|
> 2018-08-05, [c45f72e](https://github.com/ossrs/srs/commit/c45f72ef7bac9c7cf85b9125fc9e3aafd53f396f), Refine HTTP-FLV latency, support realtime mode. 2.0.252
|
||||||
|
|
||||||
|
@ -1146,23 +1158,25 @@ A big THANK YOU goes to:
|
||||||
OSChina: [https://gitee.com/winlinvip/srs.oschina][oschina], the GIT usage([CN][v1_CN_Git], [EN][v1_EN_Git])
|
OSChina: [https://gitee.com/winlinvip/srs.oschina][oschina], the GIT usage([CN][v1_CN_Git], [EN][v1_EN_Git])
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://gitee.com/winlinvip/srs.oschina.git
|
git clone https://gitee.com/winlinvip/srs.oschina.git srs &&
|
||||||
|
cd srs && git remote set-url origin https://github.com/ossrs/srs.git && git pull
|
||||||
```
|
```
|
||||||
|
|
||||||
> Remark: For users in China, recomment to use mirror from CSDN or OSChina, because they are much faster.
|
> Remark: For users in China, recomment to use mirror from CSDN or OSChina, because they are much faster.
|
||||||
|
|
||||||
|
Gitlab: [https://gitlab.com/winlinvip/srs-gitlab][gitlab], the GIT usage([CN][v1_CN_Git], [EN][v1_EN_Git])
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://gitlab.com/winlinvip/srs-gitlab.git srs &&
|
||||||
|
cd srs && git remote set-url origin https://github.com/ossrs/srs.git && git pull
|
||||||
|
```
|
||||||
|
|
||||||
Github: [https://github.com/ossrs/srs][srs], the GIT usage([CN][v1_CN_Git], [EN][v1_EN_Git])
|
Github: [https://github.com/ossrs/srs][srs], the GIT usage([CN][v1_CN_Git], [EN][v1_EN_Git])
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/ossrs/srs.git
|
git clone https://github.com/ossrs/srs.git
|
||||||
```
|
```
|
||||||
|
|
||||||
Gitlab: [https://gitlab.com/winlinvip/srs-gitlab][gitlab], the GIT usage([CN][v1_CN_Git], [EN][v1_EN_Git])
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://gitlab.com/winlinvip/srs-gitlab.git
|
|
||||||
```
|
|
||||||
|
|
||||||
| Branch | Cost | Size | CMD |
|
| Branch | Cost | Size | CMD |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| 3.0release | 2m19.931s | 262MB | git clone -b 3.0release https://gitee.com/winlinvip/srs.oschina.git |
|
| 3.0release | 2m19.931s | 262MB | git clone -b 3.0release https://gitee.com/winlinvip/srs.oschina.git |
|
||||||
|
@ -1382,6 +1396,8 @@ Winlin
|
||||||
[v3_CN_LowLatency#merged-write]: https://github.com/ossrs/srs/wiki/v3_CN_LowLatency#merged-write
|
[v3_CN_LowLatency#merged-write]: https://github.com/ossrs/srs/wiki/v3_CN_LowLatency#merged-write
|
||||||
[v3_CN_NgExec]:https://github.com/ossrs/srs/wiki/v3_CN_NgExec
|
[v3_CN_NgExec]:https://github.com/ossrs/srs/wiki/v3_CN_NgExec
|
||||||
[v3_EN_NgExec]:https://github.com/ossrs/srs/wiki/v3_EN_NgExec
|
[v3_EN_NgExec]:https://github.com/ossrs/srs/wiki/v3_EN_NgExec
|
||||||
|
[v3_CN_ReusePort]:https://github.com/ossrs/srs/wiki/v3_CN_ReusePort
|
||||||
|
[v3_EN_ReusePort]:https://github.com/ossrs/srs/wiki/v3_EN_ReusePort
|
||||||
|
|
||||||
[bug #213]: https://github.com/ossrs/srs/issues/213
|
[bug #213]: https://github.com/ossrs/srs/issues/213
|
||||||
[bug #194]: https://github.com/ossrs/srs/issues/194
|
[bug #194]: https://github.com/ossrs/srs/issues/194
|
||||||
|
@ -1704,6 +1720,9 @@ Winlin
|
||||||
[bug #1594]: https://github.com/ossrs/srs/issues/1594
|
[bug #1594]: https://github.com/ossrs/srs/issues/1594
|
||||||
[bug #1630]: https://github.com/ossrs/srs/issues/1630
|
[bug #1630]: https://github.com/ossrs/srs/issues/1630
|
||||||
[bug #1635]: https://github.com/ossrs/srs/issues/1635
|
[bug #1635]: https://github.com/ossrs/srs/issues/1635
|
||||||
|
[bug #1651]: https://github.com/ossrs/srs/issues/1651
|
||||||
|
[bug #1619]: https://github.com/ossrs/srs/issues/1619
|
||||||
|
[bug #1629]: https://github.com/ossrs/srs/issues/1629
|
||||||
[bug #yyyyyyyyyyyyy]: https://github.com/ossrs/srs/issues/yyyyyyyyyyyyy
|
[bug #yyyyyyyyyyyyy]: https://github.com/ossrs/srs/issues/yyyyyyyyyyyyy
|
||||||
|
|
||||||
[bug #1631]: https://github.com/ossrs/srs/issues/1631
|
[bug #1631]: https://github.com/ossrs/srs/issues/1631
|
||||||
|
@ -1712,6 +1731,8 @@ Winlin
|
||||||
|
|
||||||
[exo #828]: https://github.com/google/ExoPlayer/pull/828
|
[exo #828]: https://github.com/google/ExoPlayer/pull/828
|
||||||
|
|
||||||
|
[r3.0b4]: https://github.com/ossrs/srs/releases/tag/v3.0-b4
|
||||||
|
[r3.0b3]: https://github.com/ossrs/srs/releases/tag/v3.0-b3
|
||||||
[r3.0b2]: https://github.com/ossrs/srs/releases/tag/v3.0-b2
|
[r3.0b2]: https://github.com/ossrs/srs/releases/tag/v3.0-b2
|
||||||
[r3.0b1]: https://github.com/ossrs/srs/releases/tag/v3.0-b1
|
[r3.0b1]: https://github.com/ossrs/srs/releases/tag/v3.0-b1
|
||||||
[r3.0b0]: https://github.com/ossrs/srs/releases/tag/v3.0-b0
|
[r3.0b0]: https://github.com/ossrs/srs/releases/tag/v3.0-b0
|
||||||
|
|
1
trunk/.gitignore
vendored
1
trunk/.gitignore
vendored
|
@ -40,3 +40,4 @@ srs
|
||||||
*.ts
|
*.ts
|
||||||
*.h264
|
*.h264
|
||||||
*.264
|
*.264
|
||||||
|
3rdparty/ffmpeg-4.2-fit
|
||||||
|
|
12
trunk/3rdparty/st-srs/Makefile
vendored
12
trunk/3rdparty/st-srs/Makefile
vendored
|
@ -128,6 +128,7 @@ OTHER_FLAGS = -Wall
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS), DARWIN)
|
ifeq ($(OS), DARWIN)
|
||||||
|
EXTRA_OBJS = $(TARGETDIR)/md_darwin.o
|
||||||
LD = cc
|
LD = cc
|
||||||
SFLAGS = -fPIC -fno-common
|
SFLAGS = -fPIC -fno-common
|
||||||
DSO_SUFFIX = dylib
|
DSO_SUFFIX = dylib
|
||||||
|
@ -139,8 +140,8 @@ CFLAGS += -arch ppc
|
||||||
LDFLAGS += -arch ppc
|
LDFLAGS += -arch ppc
|
||||||
endif
|
endif
|
||||||
ifeq ($(INTEL), yes)
|
ifeq ($(INTEL), yes)
|
||||||
CFLAGS += -arch i386 -arch x86_64
|
CFLAGS += -arch x86_64
|
||||||
LDFLAGS += -arch i386 -arch x86_64
|
LDFLAGS += -arch x86_64
|
||||||
endif
|
endif
|
||||||
LDFLAGS += -dynamiclib -install_name /sw/lib/libst.$(MAJOR).$(DSO_SUFFIX) -compatibility_version $(MAJOR) -current_version $(VERSION)
|
LDFLAGS += -dynamiclib -install_name /sw/lib/libst.$(MAJOR).$(DSO_SUFFIX) -compatibility_version $(MAJOR) -current_version $(VERSION)
|
||||||
OTHER_FLAGS = -Wall
|
OTHER_FLAGS = -Wall
|
||||||
|
@ -313,7 +314,9 @@ endif
|
||||||
# for SRS
|
# for SRS
|
||||||
# disable examples for ubuntu crossbuild failed.
|
# disable examples for ubuntu crossbuild failed.
|
||||||
# @see https://github.com/winlinvip/simple-rtmp-server/issues/308
|
# @see https://github.com/winlinvip/simple-rtmp-server/issues/308
|
||||||
|
ifeq ($(OS), LINUX)
|
||||||
EXAMPLES =
|
EXAMPLES =
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(OS), DARWIN)
|
ifeq ($(OS), DARWIN)
|
||||||
LINKNAME = libst.$(DSO_SUFFIX)
|
LINKNAME = libst.$(DSO_SUFFIX)
|
||||||
|
@ -369,10 +372,13 @@ $(HEADER): public.h
|
||||||
$(TARGETDIR)/md.o: md.S
|
$(TARGETDIR)/md.o: md.S
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(TARGETDIR)/md_darwin.o: md_darwin.S
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(TARGETDIR)/%.o: %.c common.h md.h
|
$(TARGETDIR)/%.o: %.c common.h md.h
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
examples::
|
examples: $(SLIBRARY)
|
||||||
@echo Making $@
|
@echo Making $@
|
||||||
@cd $@; $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" OS="$(OS)" TARGETDIR="$(TARGETDIR)"
|
@cd $@; $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" OS="$(OS)" TARGETDIR="$(TARGETDIR)"
|
||||||
|
|
||||||
|
|
22
trunk/3rdparty/st-srs/md.h
vendored
22
trunk/3rdparty/st-srs/md.h
vendored
|
@ -120,15 +120,11 @@
|
||||||
#define MD_ALWAYS_UNSERIALIZED_ACCEPT
|
#define MD_ALWAYS_UNSERIALIZED_ACCEPT
|
||||||
#define MD_HAVE_SOCKLEN_T
|
#define MD_HAVE_SOCKLEN_T
|
||||||
|
|
||||||
#define MD_SETJMP(env) _setjmp(env)
|
#define MD_USE_BUILTIN_SETJMP
|
||||||
#define MD_LONGJMP(env, val) _longjmp(env, val)
|
|
||||||
|
|
||||||
#if defined(__ppc__)
|
#if defined(__amd64__) || defined(__x86_64__)
|
||||||
#define MD_JB_SP 0
|
#define JB_SP 12
|
||||||
#elif defined(__i386__)
|
#define MD_GET_SP(_t) *((long *)&((_t)->context[JB_SP]))
|
||||||
#define MD_JB_SP 9
|
|
||||||
#elif defined(__x86_64__)
|
|
||||||
#define MD_JB_SP 4
|
|
||||||
#else
|
#else
|
||||||
#error Unknown CPU architecture
|
#error Unknown CPU architecture
|
||||||
#endif
|
#endif
|
||||||
|
@ -137,9 +133,17 @@
|
||||||
ST_BEGIN_MACRO \
|
ST_BEGIN_MACRO \
|
||||||
if (MD_SETJMP((_thread)->context)) \
|
if (MD_SETJMP((_thread)->context)) \
|
||||||
_main(); \
|
_main(); \
|
||||||
*((long *)&((_thread)->context[MD_JB_SP])) = (long) (_sp); \
|
MD_GET_SP(_thread) = (long) (_sp); \
|
||||||
ST_END_MACRO
|
ST_END_MACRO
|
||||||
|
|
||||||
|
#if defined(MD_USE_BUILTIN_SETJMP)
|
||||||
|
#define MD_SETJMP(env) _st_md_cxt_save(env)
|
||||||
|
#define MD_LONGJMP(env, val) _st_md_cxt_restore(env, val)
|
||||||
|
|
||||||
|
extern int _st_md_cxt_save(jmp_buf env);
|
||||||
|
extern void _st_md_cxt_restore(jmp_buf env, int val);
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MD_GET_UTIME() \
|
#define MD_GET_UTIME() \
|
||||||
struct timeval tv; \
|
struct timeval tv; \
|
||||||
(void) gettimeofday(&tv, NULL); \
|
(void) gettimeofday(&tv, NULL); \
|
||||||
|
|
76
trunk/3rdparty/st-srs/md_darwin.S
vendored
Normal file
76
trunk/3rdparty/st-srs/md_darwin.S
vendored
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
|
||||||
|
/* If user disable the ASM, such as avoiding bugs in ASM, donot compile it. */
|
||||||
|
#if !defined(MD_ST_NO_ASM)
|
||||||
|
|
||||||
|
#if defined(__amd64__) || defined(__x86_64__)
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Internal __jmp_buf layout
|
||||||
|
*/
|
||||||
|
#define JB_RBX 0
|
||||||
|
#define JB_RBP 1
|
||||||
|
#define JB_R12 2 /* Backup IP, https://www.cnblogs.com/Five100Miles/p/8458561.html */
|
||||||
|
#define JB_R13 3 /* Backup SP, https://www.cnblogs.com/Five100Miles/p/8458561.html */
|
||||||
|
#define JB_R14 4 /* Backup LR, https://www.cnblogs.com/Five100Miles/p/8458561.html */
|
||||||
|
#define JB_R15 5 /* Backup PC, https://www.cnblogs.com/Five100Miles/p/8458561.html */
|
||||||
|
#define JB_RSP 6
|
||||||
|
#define JB_PC 7
|
||||||
|
|
||||||
|
.file "md_darwin.S"
|
||||||
|
.text
|
||||||
|
|
||||||
|
/* _st_md_cxt_save(__jmp_buf env) */ /* The env is rdi, http://blog.chinaunix.net/uid-20157960-id-1974354.html */
|
||||||
|
.globl __st_md_cxt_save
|
||||||
|
.align 16
|
||||||
|
__st_md_cxt_save:
|
||||||
|
/*
|
||||||
|
* Save registers.
|
||||||
|
*/
|
||||||
|
movq %rbx, (JB_RBX*8)(%rdi) /* Save rbx to env[0], *(int64_t*)(rdi+0)=rbx */
|
||||||
|
movq %rbp, (JB_RBP*8)(%rdi) /* Save rbp to env[1], *(int64_t*)(rdi+1)=rbp */
|
||||||
|
movq %r12, (JB_R12*8)(%rdi) /* Save r12 to env[2], *(int64_t*)(rdi+2)=r12 */
|
||||||
|
movq %r13, (JB_R13*8)(%rdi) /* Save r13 to env[3], *(int64_t*)(rdi+3)=r13 */
|
||||||
|
movq %r14, (JB_R14*8)(%rdi) /* Save r14 to env[4], *(int64_t*)(rdi+4)=r14 */
|
||||||
|
movq %r15, (JB_R15*8)(%rdi) /* Save r15 to env[5], *(int64_t*)(rdi+5)=r15 */
|
||||||
|
/* Save SP */
|
||||||
|
leaq 8(%rsp), %rdx /* Save *(int64_t*)(rsp+8) to rdx, https://my.oschina.net/guonaihong/blog/508907 */
|
||||||
|
movq %rdx, (JB_RSP*8)(%rdi) /* Save rdx(rsp) to env[6], *(int64_t*)(rdi+6)=rdx */
|
||||||
|
/* Save PC we are returning to */
|
||||||
|
movq (%rsp), %rax /* Save PC(parent function address) %(rsp) to rax */
|
||||||
|
movq %rax, (JB_PC*8)(%rdi) /* Save rax(PC) to env[7], *(int64_t*)(rdi+7)=rax */
|
||||||
|
xorq %rax, %rax /* Reset rax to 0 */
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
|
/* _st_md_cxt_restore(__jmp_buf env, int val) */ /* The env is rdi, val is esi/rsi, http://blog.chinaunix.net/uid-20157960-id-1974354.html */
|
||||||
|
.globl __st_md_cxt_restore
|
||||||
|
.align 16
|
||||||
|
__st_md_cxt_restore:
|
||||||
|
/*
|
||||||
|
* Restore registers.
|
||||||
|
*/
|
||||||
|
movq (JB_RBX*8)(%rdi), %rbx /* Load rbx from env[0] */
|
||||||
|
movq (JB_RBP*8)(%rdi), %rbp /* Load rbp from env[1] */
|
||||||
|
movq (JB_R12*8)(%rdi), %r12 /* Load r12 from env[2] */
|
||||||
|
movq (JB_R13*8)(%rdi), %r13 /* Load r13 from env[3] */
|
||||||
|
movq (JB_R14*8)(%rdi), %r14 /* Load r14 from env[4] */
|
||||||
|
movq (JB_R15*8)(%rdi), %r15 /* Load r15 from env[5] */
|
||||||
|
/* Set return value */ /* The esi is param1 val, the eax is return value */
|
||||||
|
test %esi, %esi /* if (!val) { */
|
||||||
|
mov $01, %eax /* val=1; */
|
||||||
|
cmove %eax, %esi /* } */
|
||||||
|
mov %esi, %eax /* return val; */
|
||||||
|
movq (JB_PC*8)(%rdi), %rdx /* Load rdx(PC) from env[7] */
|
||||||
|
movq (JB_RSP*8)(%rdi), %rsp /* Load rsp from env[6] */
|
||||||
|
/* Jump to saved PC */
|
||||||
|
jmpq *%rdx /* Jump to rdx(PC) */
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -143,6 +143,11 @@ if [ $SRS_CROSS_BUILD = YES ]; then
|
||||||
else
|
else
|
||||||
srs_undefine_macro "SRS_AUTO_CROSSBUILD" $SRS_AUTO_HEADERS_H
|
srs_undefine_macro "SRS_AUTO_CROSSBUILD" $SRS_AUTO_HEADERS_H
|
||||||
fi
|
fi
|
||||||
|
if [ $SRS_OSX = YES ]; then
|
||||||
|
srs_define_macro "SRS_AUTO_OSX" $SRS_AUTO_HEADERS_H
|
||||||
|
else
|
||||||
|
srs_undefine_macro "SRS_AUTO_OSX" $SRS_AUTO_HEADERS_H
|
||||||
|
fi
|
||||||
|
|
||||||
# prefix
|
# prefix
|
||||||
echo "" >> $SRS_AUTO_HEADERS_H
|
echo "" >> $SRS_AUTO_HEADERS_H
|
||||||
|
|
|
@ -17,7 +17,7 @@ mkdir -p $workdir && cd $workdir
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Enter workdir failed, ret=$ret"; exit $ret; fi
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "Enter workdir failed, ret=$ret"; exit $ret; fi
|
||||||
|
|
||||||
# Collect all *.gcno and *.gcda to objs/cover.
|
# Collect all *.gcno and *.gcda to objs/cover.
|
||||||
cd $workdir && (rm -rf src && cp -R ../../src . && cp -R ../src .)
|
cd $workdir && (rm -rf src && cp -R ../../src . && cp -R ../src/* src/)
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Collect *.gcno and *.gcda failed, ret=$ret"; exit $ret; fi
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "Collect *.gcno and *.gcda failed, ret=$ret"; exit $ret; fi
|
||||||
|
|
||||||
# Generate *.gcov for coverage.
|
# Generate *.gcov for coverage.
|
||||||
|
|
|
@ -109,6 +109,7 @@ function Ubuntu_prepare()
|
||||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||||
Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for ubuntu failed, ret=$ret"; exit $ret; fi
|
Ubuntu_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for ubuntu failed, ret=$ret"; exit $ret; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
# for Centos, auto install tools by yum
|
# for Centos, auto install tools by yum
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
|
@ -182,14 +183,105 @@ function Centos_prepare()
|
||||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||||
Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for CentOS failed, ret=$ret"; exit $ret; fi
|
Centos_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for CentOS failed, ret=$ret"; exit $ret; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#####################################################################################
|
||||||
|
# For OSX, auto install tools by brew
|
||||||
|
#####################################################################################
|
||||||
|
OS_IS_OSX=NO
|
||||||
|
function OSX_prepare()
|
||||||
|
{
|
||||||
|
uname -s|grep Darwin >/dev/null 2>&1
|
||||||
|
ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
if [ $SRS_OSX = YES ]; then
|
||||||
|
echo "OSX check failed, actual is `uname -s`"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
return 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# cross build for arm, install the cross build tool chain.
|
||||||
|
if [ $SRS_CROSS_BUILD = YES ]; then
|
||||||
|
echo "embeded(arm/mips) is invalid for OSX"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
OS_IS_OSX=YES
|
||||||
|
echo "OSX detected, install tools if needed"
|
||||||
|
# requires the osx when os
|
||||||
|
if [ $OS_IS_OSX = YES ]; then
|
||||||
|
if [ $SRS_OSX = NO ]; then
|
||||||
|
echo "OSX detected, must specifies the --osx"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
brew --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install brew"
|
||||||
|
echo "ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\""
|
||||||
|
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
|
||||||
|
echo "install brew success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install gcc"
|
||||||
|
echo "brew install gcc"
|
||||||
|
brew install gcc; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
|
||||||
|
echo "install gcc success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
g++ --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install gcc-c++"
|
||||||
|
echo "brew install gcc-c++"
|
||||||
|
brew install gcc-c++; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
|
||||||
|
echo "install gcc-c++ success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
make --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install make"
|
||||||
|
echo "brew install make"
|
||||||
|
brew install make; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
|
||||||
|
echo "install make success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
patch --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install patch"
|
||||||
|
echo "brew install patch"
|
||||||
|
brew install patch; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
|
||||||
|
echo "install patch success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
unzip --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install unzip"
|
||||||
|
echo "brew install unzip"
|
||||||
|
brew install unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
|
||||||
|
echo "install unzip success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "OSX install tools success"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
# donot prepare tools, for srs-librtmp depends only gcc and g++.
|
||||||
|
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||||
|
OSX_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "OSX prepare failed, ret=$ret"; exit $ret; fi
|
||||||
|
fi
|
||||||
|
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
# for Centos, auto install tools by yum
|
# for Centos, auto install tools by yum
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
# We must use a bash function instead of variable.
|
# We must use a bash function instead of variable.
|
||||||
function sed_utility() {
|
function sed_utility() {
|
||||||
|
if [ $OS_IS_OSX = YES ]; then
|
||||||
|
sed -i '' "$@"
|
||||||
|
else
|
||||||
sed -i "$@"
|
sed -i "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then
|
ret=$?; if [[ $ret -ne 0 ]]; then
|
||||||
|
if [ $OS_IS_OSX = YES ]; then
|
||||||
|
echo "sed -i '' \"$@\""
|
||||||
|
else
|
||||||
echo "sed -i \"$@\""
|
echo "sed -i \"$@\""
|
||||||
|
fi
|
||||||
return $ret
|
return $ret
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -204,7 +296,7 @@ SED="sed_utility" && echo "SED is $SED"
|
||||||
# directly build on arm/mips, for example, pi or cubie,
|
# directly build on arm/mips, for example, pi or cubie,
|
||||||
# export srs-librtmp
|
# export srs-librtmp
|
||||||
# others is invalid.
|
# others is invalid.
|
||||||
if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $SRS_EXPORT_LIBRTMP_PROJECT = NO ]]; then
|
if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $OS_IS_OSX = NO && $SRS_EXPORT_LIBRTMP_PROJECT = NO ]]; then
|
||||||
if [[ $SRS_PI = NO && $SRS_CUBIE = NO && $SRS_CROSS_BUILD = NO ]]; then
|
if [[ $SRS_PI = NO && $SRS_CUBIE = NO && $SRS_CROSS_BUILD = NO ]]; then
|
||||||
echo "Your OS `uname -s` is not supported."
|
echo "Your OS `uname -s` is not supported."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -216,29 +308,48 @@ fi
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||||
# check the cross build flag file, if flag changed, need to rebuild the st.
|
# check the cross build flag file, if flag changed, need to rebuild the st.
|
||||||
_ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_EPOLL"
|
_ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_EPOLL" && _ST_LD=${SRS_TOOL_LD} && _ST_OBJ="LINUX_*"
|
||||||
if [[ $SRS_VALGRIND == YES ]]; then
|
if [[ $SRS_VALGRIND == YES ]]; then
|
||||||
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_VALGRIND"
|
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_VALGRIND"
|
||||||
fi
|
fi
|
||||||
|
# for osx, use darwin for st, donot use epoll.
|
||||||
|
if [[ $SRS_OSX == YES ]]; then
|
||||||
|
_ST_MAKE=darwin-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_KQUEUE" && _ST_LD=${SRS_TOOL_CC} && _ST_OBJ="DARWIN_*"
|
||||||
|
fi
|
||||||
# Pass the global extra flags.
|
# Pass the global extra flags.
|
||||||
if [[ $SRS_EXTRA_FLAGS != '' ]]; then
|
if [[ $SRS_EXTRA_FLAGS != '' ]]; then
|
||||||
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS $SRS_EXTRA_FLAGS"
|
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS $SRS_EXTRA_FLAGS"
|
||||||
fi
|
fi
|
||||||
# Patched ST from https://github.com/ossrs/state-threads/tree/srs
|
# Patched ST from https://github.com/ossrs/state-threads/tree/srs
|
||||||
if [[ -f ${SRS_OBJS}/st/libst.a ]]; then
|
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/st/libst.a ]]; then
|
||||||
echo "The state-threads is ok.";
|
echo "The state-threads is ok.";
|
||||||
else
|
else
|
||||||
echo "Building state-threads.";
|
echo "Building state-threads.";
|
||||||
(
|
(
|
||||||
rm -rf ${SRS_OBJS}/st-srs && cd ${SRS_OBJS} &&
|
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/st-srs && mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/st-srs &&
|
||||||
ln -sf ../3rdparty/st-srs && cd st-srs &&
|
# Create a hidden directory .src
|
||||||
make clean && make ${_ST_MAKE} EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" \
|
cd ${SRS_OBJS}/${SRS_PLATFORM}/st-srs && ln -sf ../../../3rdparty/st-srs .src &&
|
||||||
CC=${SRS_TOOL_CC} AR=${SRS_TOOL_AR} LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB} &&
|
# Link source files under .src
|
||||||
cd .. && rm -f st && ln -sf st-srs/obj st
|
for file in `(cd .src && find . -maxdepth 1 -type f ! -name '*.o' ! -name '*.d')`; do
|
||||||
|
ln -sf .src/$file $file;
|
||||||
|
done &&
|
||||||
|
# Link source files under .src/xxx, the first child dir.
|
||||||
|
for dir in `(cd .src && find . -maxdepth 1 -type d|grep '\./'|grep -v Linux|grep -v Darwin)`; do
|
||||||
|
mkdir -p $dir &&
|
||||||
|
for file in `(cd .src/$dir && find . -maxdepth 1 -type f ! -name '*.o' ! -name '*.d')`; do
|
||||||
|
ln -sf ../.src/$dir/$file $dir/$file;
|
||||||
|
done;
|
||||||
|
done &&
|
||||||
|
# Build source code.
|
||||||
|
make ${_ST_MAKE} EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" \
|
||||||
|
CC=${SRS_TOOL_CC} AR=${SRS_TOOL_AR} LD=${_ST_LD} RANDLIB=${SRS_TOOL_RANDLIB} &&
|
||||||
|
cd .. && rm -f st && ln -sf st-srs/${_ST_OBJ} st
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
# check status
|
# check status
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build state-threads failed, ret=$ret"; exit $ret; fi
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build state-threads failed, ret=$ret"; exit $ret; fi
|
||||||
|
# Always update the links.
|
||||||
|
(cd ${SRS_OBJS} && rm -rf st && ln -sf ${SRS_PLATFORM}/st-srs/${_ST_OBJ} st)
|
||||||
if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "Build state-threads static lib failed."; exit -1; fi
|
if [ ! -f ${SRS_OBJS}/st/libst.a ]; then echo "Build state-threads static lib failed."; exit -1; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -291,19 +402,19 @@ fi
|
||||||
# cherrypy for http hooks callback, CherryPy-3.2.4
|
# cherrypy for http hooks callback, CherryPy-3.2.4
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||||
if [[ -f ${SRS_OBJS}/CherryPy-3.2.4/setup.py ]]; then
|
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/CherryPy-3.2.4/setup.py ]]; then
|
||||||
echo "CherryPy-3.2.4 is ok.";
|
echo "CherryPy-3.2.4 is ok.";
|
||||||
else
|
else
|
||||||
echo "Installing CherryPy-3.2.4";
|
echo "Installing CherryPy-3.2.4";
|
||||||
(
|
(
|
||||||
rm -rf ${SRS_OBJS}/CherryPy-3.2.4 && cd ${SRS_OBJS} &&
|
rm -rf ${SRS_OBJS}/CherryPy-3.2.4 && cd ${SRS_OBJS}/${SRS_PLATFORM} &&
|
||||||
unzip -q ../3rdparty/CherryPy-3.2.4.zip && cd CherryPy-3.2.4 &&
|
unzip -q ../../3rdparty/CherryPy-3.2.4.zip && cd CherryPy-3.2.4 &&
|
||||||
python setup.py install --user
|
python setup.py install --user
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
# check status
|
# check status
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "build CherryPy-3.2.4 failed, ret=$ret"; exit $ret; fi
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "build CherryPy-3.2.4 failed, ret=$ret"; exit $ret; fi
|
||||||
if [ ! -f ${SRS_OBJS}/CherryPy-3.2.4/setup.py ]; then echo "build CherryPy-3.2.4 failed."; exit -1; fi
|
if [ ! -f ${SRS_OBJS}/${SRS_PLATFORM}/CherryPy-3.2.4/setup.py ]; then echo "build CherryPy-3.2.4 failed."; exit -1; fi
|
||||||
|
|
||||||
echo "Link players to cherrypy static-dir"
|
echo "Link players to cherrypy static-dir"
|
||||||
rm -rf research/api-server/static-dir/players &&
|
rm -rf research/api-server/static-dir/players &&
|
||||||
|
@ -336,21 +447,26 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then
|
||||||
OPENSSL_CONFIG="./Configure linux-armv4"
|
OPENSSL_CONFIG="./Configure linux-armv4"
|
||||||
else
|
else
|
||||||
# If not crossbuild, try to use exists libraries.
|
# If not crossbuild, try to use exists libraries.
|
||||||
if [[ -f /usr/local/lib64/libssl.a && ! -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then
|
if [[ -f /usr/local/lib64/libssl.a && ! -f ${SRS_OBJS}/${SRS_PLATFORM}/openssl/lib/libssl.a ]]; then
|
||||||
(mkdir -p ${SRS_OBJS}/openssl/lib && cd ${SRS_OBJS}/openssl/lib &&
|
(mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/openssl/lib && cd ${SRS_OBJS}/${SRS_PLATFORM}/openssl/lib &&
|
||||||
ln -sf /usr/local/lib64/libssl.a && ln -sf /usr/local/lib64/libcrypto.a)
|
ln -sf /usr/local/lib64/libssl.a && ln -sf /usr/local/lib64/libcrypto.a)
|
||||||
(mkdir -p ${SRS_OBJS}/openssl/include && cd ${SRS_OBJS}/openssl/include &&
|
(mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/openssl/include && cd ${SRS_OBJS}/${SRS_PLATFORM}/openssl/include &&
|
||||||
ln -sf /usr/local/include/openssl)
|
ln -sf /usr/local/include/openssl)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# Which lib we use.
|
||||||
|
OPENSSL_LIB="openssl-1.1.0e/_release"
|
||||||
|
if [[ ! -f ${SRS_OBJS}/${SRS_PLATFORM}/${OPENSSL_LIB}/lib/libssl.a ]]; then
|
||||||
|
OPENSSL_LIB="openssl"
|
||||||
|
fi
|
||||||
# cross build not specified, if exists flag, need to rebuild for no-arm platform.
|
# cross build not specified, if exists flag, need to rebuild for no-arm platform.
|
||||||
if [[ -f ${SRS_OBJS}/openssl/lib/libssl.a ]]; then
|
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/openssl/lib/libssl.a ]]; then
|
||||||
echo "Openssl-1.1.0e is ok.";
|
echo "Openssl-1.1.0e is ok.";
|
||||||
else
|
else
|
||||||
echo "Building openssl-1.1.0e.";
|
echo "Building openssl-1.1.0e.";
|
||||||
(
|
(
|
||||||
rm -rf ${SRS_OBJS}/openssl-1.1.0e && cd ${SRS_OBJS} &&
|
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/openssl-1.1.0e && cd ${SRS_OBJS}/${SRS_PLATFORM} &&
|
||||||
unzip -q ../3rdparty/openssl-1.1.0e.zip && cd openssl-1.1.0e &&
|
unzip -q ../../3rdparty/openssl-1.1.0e.zip && cd openssl-1.1.0e &&
|
||||||
${OPENSSL_CONFIG} --prefix=`pwd`/_release $OPENSSL_OPTIONS &&
|
${OPENSSL_CONFIG} --prefix=`pwd`/_release $OPENSSL_OPTIONS &&
|
||||||
make CC=${SRS_TOOL_CC} AR="${SRS_TOOL_AR} -rs" LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB} && make install_sw &&
|
make CC=${SRS_TOOL_CC} AR="${SRS_TOOL_AR} -rs" LD=${SRS_TOOL_LD} RANDLIB=${SRS_TOOL_RANDLIB} && make install_sw &&
|
||||||
cd .. && rm -rf openssl && ln -sf openssl-1.1.0e/_release openssl
|
cd .. && rm -rf openssl && ln -sf openssl-1.1.0e/_release openssl
|
||||||
|
@ -358,6 +474,8 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then
|
||||||
fi
|
fi
|
||||||
# check status
|
# check status
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build openssl-1.1.0e failed, ret=$ret"; exit $ret; fi
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build openssl-1.1.0e failed, ret=$ret"; exit $ret; fi
|
||||||
|
# Always update the links.
|
||||||
|
(cd ${SRS_OBJS} && rm -rf openssl && ln -sf ${SRS_PLATFORM}/${OPENSSL_LIB} openssl)
|
||||||
if [ ! -f ${SRS_OBJS}/openssl/lib/libssl.a ]; then echo "Build openssl-1.1.0e failed."; exit -1; fi
|
if [ ! -f ${SRS_OBJS}/openssl/lib/libssl.a ]; then echo "Build openssl-1.1.0e failed."; exit -1; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -365,24 +483,19 @@ fi
|
||||||
# live transcoding, ffmpeg-4.1, x264-core157, lame-3.99.5, libaacplus-2.0.2.
|
# live transcoding, ffmpeg-4.1, x264-core157, lame-3.99.5, libaacplus-2.0.2.
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
# Always link the ffmpeg tools if exists.
|
# Always link the ffmpeg tools if exists.
|
||||||
if [[ -f /usr/local/bin/ffmpeg && ! -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]]; then
|
if [[ -f /usr/local/bin/ffmpeg && ! -f ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg/bin/ffmpeg ]]; then
|
||||||
mkdir -p ${SRS_OBJS}/ffmpeg/bin && ln -sf /usr/local/bin/ffmpeg ${SRS_OBJS}/ffmpeg/bin/ffmpeg
|
mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg/bin &&
|
||||||
|
ln -sf /usr/local/bin/ffmpeg ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg/bin/ffmpeg
|
||||||
fi
|
fi
|
||||||
if [ $SRS_FFMPEG_TOOL = YES ]; then
|
if [ $SRS_FFMPEG_TOOL = YES ]; then
|
||||||
if [[ -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]]; then
|
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/ffmpeg/bin/ffmpeg ]]; then
|
||||||
echo "ffmpeg-4.1 is ok.";
|
echo "ffmpeg-4.1 is ok.";
|
||||||
else
|
else
|
||||||
echo "build ffmpeg-4.1";
|
echo "no ffmpeg found, please use srs-docker or --without-ffmpeg";
|
||||||
(
|
exit -1;
|
||||||
cd ${SRS_OBJS} && pwd_dir=`pwd` &&
|
|
||||||
rm -rf ffmepg.src && mkdir -p ffmpeg.src && cd ffmpeg.src &&
|
|
||||||
rm -f build_ffmpeg.sh && ln -sf ../../auto/build_ffmpeg.sh && . build_ffmpeg.sh &&
|
|
||||||
cd ${pwd_dir} && rm -rf ffmpeg && ln -sf ffmpeg.src/_release ffmpeg
|
|
||||||
)
|
|
||||||
fi
|
fi
|
||||||
# check status
|
# Always update the links.
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "build ffmpeg-4.1 failed, ret=$ret"; exit $ret; fi
|
(cd ${SRS_OBJS} && rm -rf ffmpeg && ln -sf ${SRS_PLATFORM}/ffmpeg)
|
||||||
if [ ! -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]; then echo "build ffmpeg-4.1 failed."; exit -1; fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
|
@ -430,18 +543,20 @@ fi
|
||||||
# build utest code
|
# build utest code
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
if [ $SRS_UTEST = YES ]; then
|
if [ $SRS_UTEST = YES ]; then
|
||||||
if [[ -f ${SRS_OBJS}/gtest/include/gtest/gtest.h ]]; then
|
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/gtest/include/gtest/gtest.h ]]; then
|
||||||
echo "The gtest-1.6.0 is ok.";
|
echo "The gtest-1.6.0 is ok.";
|
||||||
else
|
else
|
||||||
echo "Build gtest-1.6.0";
|
echo "Build gtest-1.6.0";
|
||||||
(
|
(
|
||||||
rm -rf ${SRS_OBJS}/gtest-1.6.0 && cd ${SRS_OBJS} &&
|
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/gtest-1.6.0 && cd ${SRS_OBJS}/${SRS_PLATFORM} &&
|
||||||
unzip -q ../3rdparty/gtest-1.6.0.zip &&
|
unzip -q ../../3rdparty/gtest-1.6.0.zip &&
|
||||||
rm -rf gtest && ln -sf gtest-1.6.0 gtest
|
rm -rf gtest && ln -sf gtest-1.6.0 gtest
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
# check status
|
# check status
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build gtest-1.6.0 failed, ret=$ret"; exit $ret; fi
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build gtest-1.6.0 failed, ret=$ret"; exit $ret; fi
|
||||||
|
# Always update the links.
|
||||||
|
(cd ${SRS_OBJS} && rm -rf gtest && ln -sf ${SRS_PLATFORM}/gtest-1.6.0 gtest)
|
||||||
if [ ! -f ${SRS_OBJS}/gtest/include/gtest/gtest.h ]; then echo "Build gtest-1.6.0 failed."; exit -1; fi
|
if [ ! -f ${SRS_OBJS}/gtest/include/gtest/gtest.h ]; then echo "Build gtest-1.6.0 failed."; exit -1; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -449,13 +564,13 @@ fi
|
||||||
# build gperf code
|
# build gperf code
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
if [ $SRS_GPERF = YES ]; then
|
if [ $SRS_GPERF = YES ]; then
|
||||||
if [[ -f ${SRS_OBJS}/gperf/bin/pprof ]]; then
|
if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/gperf/bin/pprof ]]; then
|
||||||
echo "The gperftools-2.1 is ok.";
|
echo "The gperftools-2.1 is ok.";
|
||||||
else
|
else
|
||||||
echo "Build gperftools-2.1";
|
echo "Build gperftools-2.1";
|
||||||
(
|
(
|
||||||
rm -rf ${SRS_OBJS}/gperftools-2.1 && cd ${SRS_OBJS} &&
|
rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/gperftools-2.1 && cd ${SRS_OBJS}/${SRS_PLATFORM} &&
|
||||||
unzip -q ../3rdparty/gperftools-2.1.zip && cd gperftools-2.1 &&
|
unzip -q ../../3rdparty/gperftools-2.1.zip && cd gperftools-2.1 &&
|
||||||
./configure --prefix=`pwd`/_release --enable-frame-pointers && make ${SRS_JOBS} && make install &&
|
./configure --prefix=`pwd`/_release --enable-frame-pointers && make ${SRS_JOBS} && make install &&
|
||||||
cd .. && rm -rf gperf && ln -sf gperftools-2.1/_release gperf &&
|
cd .. && rm -rf gperf && ln -sf gperftools-2.1/_release gperf &&
|
||||||
rm -rf pprof && ln -sf gperf/bin/pprof pprof
|
rm -rf pprof && ln -sf gperf/bin/pprof pprof
|
||||||
|
@ -463,10 +578,7 @@ if [ $SRS_GPERF = YES ]; then
|
||||||
fi
|
fi
|
||||||
# check status
|
# check status
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build gperftools-2.1 failed, ret=$ret"; exit $ret; fi
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "Build gperftools-2.1 failed, ret=$ret"; exit $ret; fi
|
||||||
|
# Always update the links.
|
||||||
|
(cd ${SRS_OBJS} && rm -rf pprof && ln -sf ${SRS_PLATFORM}/gperf/bin/pprof pprof)
|
||||||
if [ ! -f ${SRS_OBJS}/gperf/bin/pprof ]; then echo "Build gperftools-2.1 failed."; exit -1; fi
|
if [ ! -f ${SRS_OBJS}/gperf/bin/pprof ]; then echo "Build gperftools-2.1 failed."; exit -1; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#####################################################################################
|
|
||||||
# generated the test script
|
|
||||||
#####################################################################################
|
|
||||||
rm -rf ${SRS_OBJS}/srs.test && ln -sf `pwd`/scripts/srs.test objs/srs.test
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ SRS_NGINX=NO
|
||||||
SRS_FFMPEG_TOOL=NO
|
SRS_FFMPEG_TOOL=NO
|
||||||
SRS_LIBRTMP=NO
|
SRS_LIBRTMP=NO
|
||||||
SRS_RESEARCH=NO
|
SRS_RESEARCH=NO
|
||||||
SRS_UTEST=YES
|
SRS_UTEST=NO
|
||||||
SRS_GPERF=NO # Performance test: tcmalloc
|
SRS_GPERF=NO # Performance test: tcmalloc
|
||||||
SRS_GPERF_MC=NO # Performance test: gperf memory check
|
SRS_GPERF_MC=NO # Performance test: gperf memory check
|
||||||
SRS_GPERF_MD=NO # Performance test: gperf memory defence
|
SRS_GPERF_MD=NO # Performance test: gperf memory defence
|
||||||
|
@ -108,6 +108,8 @@ SRS_TOOL_AR=ar
|
||||||
SRS_TOOL_LD=ld
|
SRS_TOOL_LD=ld
|
||||||
SRS_TOOL_RANDLIB=randlib
|
SRS_TOOL_RANDLIB=randlib
|
||||||
SRS_EXTRA_FLAGS=
|
SRS_EXTRA_FLAGS=
|
||||||
|
# Set the object files tag name.
|
||||||
|
SRS_BUILD_TAG=
|
||||||
|
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
# menu
|
# menu
|
||||||
|
@ -176,6 +178,7 @@ Toolchain options: @see https://github.com/ossrs/srs/issues/1547#issuec
|
||||||
--ld=<LD> Use linker tool LD, default is ld.
|
--ld=<LD> Use linker tool LD, default is ld.
|
||||||
--randlib=<RANDLIB> Use randlib tool RANDLIB, default is randlib.
|
--randlib=<RANDLIB> Use randlib tool RANDLIB, default is randlib.
|
||||||
--extra-flags=<EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS.
|
--extra-flags=<EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS.
|
||||||
|
--build-tag=<TAG> Set the build object directory suffix.
|
||||||
|
|
||||||
Conflicts:
|
Conflicts:
|
||||||
1. --with-gmc vs --with-gmp:
|
1. --with-gmc vs --with-gmp:
|
||||||
|
@ -204,10 +207,6 @@ Remark:
|
||||||
END
|
END
|
||||||
}
|
}
|
||||||
|
|
||||||
function ignore_option() {
|
|
||||||
echo "ignore option \"$option\""
|
|
||||||
}
|
|
||||||
|
|
||||||
function parse_user_option() {
|
function parse_user_option() {
|
||||||
case "$option" in
|
case "$option" in
|
||||||
-h) help=yes ;;
|
-h) help=yes ;;
|
||||||
|
@ -266,6 +265,7 @@ function parse_user_option() {
|
||||||
--ld) SRS_TOOL_LD=${value} ;;
|
--ld) SRS_TOOL_LD=${value} ;;
|
||||||
--randlib) SRS_TOOL_RANDLIB=${value} ;;
|
--randlib) SRS_TOOL_RANDLIB=${value} ;;
|
||||||
--extra-flags) SRS_EXTRA_FLAGS=${value} ;;
|
--extra-flags) SRS_EXTRA_FLAGS=${value} ;;
|
||||||
|
--build-tag) SRS_BUILD_TAG=${value} ;;
|
||||||
|
|
||||||
--x86-x64) SRS_X86_X64=YES ;;
|
--x86-x64) SRS_X86_X64=YES ;;
|
||||||
--x86-64) SRS_X86_X64=YES ;;
|
--x86-64) SRS_X86_X64=YES ;;
|
||||||
|
@ -297,16 +297,16 @@ function parse_user_option() {
|
||||||
--with-hls) SRS_HLS=YES ;;
|
--with-hls) SRS_HLS=YES ;;
|
||||||
--with-dvr) SRS_DVR=YES ;;
|
--with-dvr) SRS_DVR=YES ;;
|
||||||
|
|
||||||
--without-stream-caster) ignore_option ;;
|
--without-stream-caster) echo "ignore option \"$option\"" ;;
|
||||||
--without-ingest) ignore_option ;;
|
--without-ingest) echo "ignore option \"$option\"" ;;
|
||||||
--without-ssl) ignore_option ;;
|
--without-ssl) echo "ignore option \"$option\"" ;;
|
||||||
--without-stat) ignore_option ;;
|
--without-stat) echo "ignore option \"$option\"" ;;
|
||||||
--without-transcode) ignore_option ;;
|
--without-transcode) echo "ignore option \"$option\"" ;;
|
||||||
--without-http-callback) ignore_option ;;
|
--without-http-callback) echo "ignore option \"$option\"" ;;
|
||||||
--without-http-server) ignore_option ;;
|
--without-http-server) echo "ignore option \"$option\"" ;;
|
||||||
--without-http-api) ignore_option ;;
|
--without-http-api) echo "ignore option \"$option\"" ;;
|
||||||
--without-hls) ignore_option ;;
|
--without-hls) echo "ignore option \"$option\"" ;;
|
||||||
--without-dvr) ignore_option ;;
|
--without-dvr) echo "ignore option \"$option\"" ;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "$0: error: invalid option \"$option\""
|
echo "$0: error: invalid option \"$option\""
|
||||||
|
@ -397,7 +397,7 @@ function apply_user_presets() {
|
||||||
SRS_HDS=YES
|
SRS_HDS=YES
|
||||||
SRS_LIBRTMP=YES
|
SRS_LIBRTMP=YES
|
||||||
SRS_RESEARCH=NO
|
SRS_RESEARCH=NO
|
||||||
SRS_UTEST=YES
|
SRS_UTEST=NO
|
||||||
SRS_STATIC=NO
|
SRS_STATIC=NO
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ function apply_user_presets() {
|
||||||
SRS_HDS=YES
|
SRS_HDS=YES
|
||||||
SRS_LIBRTMP=YES
|
SRS_LIBRTMP=YES
|
||||||
SRS_RESEARCH=NO
|
SRS_RESEARCH=NO
|
||||||
SRS_UTEST=YES
|
SRS_UTEST=NO
|
||||||
SRS_STATIC=NO
|
SRS_STATIC=NO
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -553,6 +553,7 @@ function regenerate_options() {
|
||||||
if [ $SRS_LOG_TRACE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace"; fi
|
if [ $SRS_LOG_TRACE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace"; fi
|
||||||
if [ $SRS_GCOV = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gcov"; fi
|
if [ $SRS_GCOV = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gcov"; fi
|
||||||
if [[ $SRS_EXTRA_FLAGS != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --extra-flags=\\\"$SRS_EXTRA_FLAGS\\\""; fi
|
if [[ $SRS_EXTRA_FLAGS != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --extra-flags=\\\"$SRS_EXTRA_FLAGS\\\""; fi
|
||||||
|
if [[ $SRS_BUILD_TAG != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --build-tag=\\\"$SRS_BUILD_TAG\\\""; fi
|
||||||
if [[ $SRS_TOOL_CC != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cc=$SRS_TOOL_CC"; fi
|
if [[ $SRS_TOOL_CC != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cc=$SRS_TOOL_CC"; fi
|
||||||
if [[ $SRS_TOOL_CXX != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx=$SRS_TOOL_CXX"; fi
|
if [[ $SRS_TOOL_CXX != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx=$SRS_TOOL_CXX"; fi
|
||||||
if [[ $SRS_TOOL_AR != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ar=$SRS_TOOL_AR"; fi
|
if [[ $SRS_TOOL_AR != '' ]]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ar=$SRS_TOOL_AR"; fi
|
||||||
|
@ -575,16 +576,12 @@ function check_option_conflicts() {
|
||||||
echo "For crossbuild, must not use default toolchain, cc: $SRS_TOOL_CC, cxx: $SRS_TOOL_CXX, ar: $SRS_TOOL_AR"; exit -1
|
echo "For crossbuild, must not use default toolchain, cc: $SRS_TOOL_CC, cxx: $SRS_TOOL_CXX, ar: $SRS_TOOL_AR"; exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $SRS_OSX = YES ]; then
|
|
||||||
echo "We don't support OSX, please use docker https://github.com/ossrs/srs-docker"; exit -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $SRS_NGINX == YES ]]; then
|
if [[ $SRS_NGINX == YES ]]; then
|
||||||
echo "Don't support building NGINX, please use docker https://github.com/ossrs/srs-docker"; exit -1
|
echo "Don't support building NGINX, please use docker https://github.com/ossrs/srs-docker"; exit -1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $SRS_FFMPEG_TOOL == YES ]]; then
|
if [[ $SRS_FFMPEG_TOOL == YES ]]; then
|
||||||
echo "Don't support building FFMPEG, please use docker https://github.com/ossrs/srs-docker"; exit -1
|
echo "Don't support building FFMPEG, please use docker https://github.com/ossrs/srs-docker"; exit -1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: FIXME: check more os.
|
# TODO: FIXME: check more os.
|
||||||
|
|
|
@ -1,3 +1,24 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# when options parsed, setup some variables, then build the depends.
|
# when options parsed, setup some variables, then build the depends.
|
||||||
|
OS_KERNEL_NAME=$(uname -s)
|
||||||
|
OS_KERNRL_RELEASE=$(uname -r|awk -F '-' '{print $1}')
|
||||||
|
OS_PREFIX="Platform"
|
||||||
|
SRS_PLATFORM="${OS_PREFIX}-${OS_KERNEL_NAME}-${OS_KERNRL_RELEASE}"
|
||||||
|
if [[ ${SRS_BUILD_TAG} != "" ]]; then
|
||||||
|
SRS_PLATFORM="${SRS_PLATFORM}-${SRS_BUILD_TAG}"
|
||||||
|
fi
|
||||||
|
echo "SRS_WORKDIR: ${SRS_WORKDIR}, SRS_OBJS_DIR: ${SRS_OBJS_DIR}, SRS_OBJS: ${SRS_OBJS}, SRS_PLATFORM: ${SRS_PLATFORM}"
|
||||||
|
|
||||||
|
# For src object files on each platform.
|
||||||
|
(
|
||||||
|
mkdir -p ${SRS_OBJS_DIR} && cd ${SRS_OBJS_DIR} &&
|
||||||
|
rm -rf src utest srs srs_utest research include lib srs_hls_ingester srs_mp4_parser &&
|
||||||
|
mkdir -p ${SRS_PLATFORM}/src && ln -sf ${SRS_PLATFORM}/src &&
|
||||||
|
mkdir -p ${SRS_PLATFORM}/utest && ln -sf ${SRS_PLATFORM}/utest &&
|
||||||
|
mkdir -p ${SRS_PLATFORM}/research && ln -sf ${SRS_PLATFORM}/research &&
|
||||||
|
mkdir -p ${SRS_PLATFORM}/include && ln -sf ${SRS_PLATFORM}/include &&
|
||||||
|
mkdir -p ${SRS_PLATFORM}/lib && ln -sf ${SRS_PLATFORM}/lib
|
||||||
|
)
|
||||||
|
echo "Fast cleanup, if need to do full cleanup, please use: make clean"
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,10 @@ mkdir -p ${SRS_OBJS}/utest
|
||||||
# the prefix to generate the objs/utest/Makefile
|
# the prefix to generate the objs/utest/Makefile
|
||||||
# dirs relative to current dir(objs/utest), it's trunk/objs/utest
|
# dirs relative to current dir(objs/utest), it's trunk/objs/utest
|
||||||
# trunk of srs, which contains the src dir, relative to objs/utest, it's trunk
|
# trunk of srs, which contains the src dir, relative to objs/utest, it's trunk
|
||||||
SRS_TRUNK_PREFIX=../..
|
SRS_TRUNK_PREFIX=../../..
|
||||||
# gest dir, relative to objs/utest, it's trunk/objs/gtest
|
# gest dir, relative to objs/utest, it's trunk/objs/gtest
|
||||||
GTEST_DIR=${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/gtest
|
GTEST_DIR=${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/gtest
|
||||||
|
|
||||||
# the extra defines to compile utest.
|
|
||||||
EXTRA_DEFINES=""
|
|
||||||
|
|
||||||
cat << END > ${FILE}
|
cat << END > ${FILE}
|
||||||
# user must run make the ${SRS_OBJS_DIR}/utest dir
|
# user must run make the ${SRS_OBJS_DIR}/utest dir
|
||||||
# at the same dir of Makefile.
|
# at the same dir of Makefile.
|
||||||
|
|
66
trunk/configure
vendored
66
trunk/configure
vendored
|
@ -26,16 +26,11 @@ BLACK="\\033[0m"
|
||||||
# setup variables when options parsed.
|
# setup variables when options parsed.
|
||||||
. auto/setup_variables.sh
|
. auto/setup_variables.sh
|
||||||
|
|
||||||
# clean the exists, when not export srs-librtmp.
|
# We don't need to cleanup the exists files.
|
||||||
# do this only when the options is ok.
|
|
||||||
if [[ -f Makefile ]]; then
|
|
||||||
make clean
|
|
||||||
fi
|
|
||||||
# remove makefile
|
|
||||||
rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
rm -f ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
||||||
|
|
||||||
# create objs
|
# create objs
|
||||||
mkdir -p ${SRS_OBJS}
|
mkdir -p ${SRS_OBJS}/${SRS_PLATFORM}
|
||||||
|
|
||||||
# for export srs-librtmp, change target to it.
|
# for export srs-librtmp, change target to it.
|
||||||
. auto/generate-srs-librtmp-project.sh
|
. auto/generate-srs-librtmp-project.sh
|
||||||
|
@ -57,7 +52,7 @@ SrsLibrtmpSampleEntry="nossl"
|
||||||
if [ $SRS_SSL = YES ]; then SrsLibrtmpSampleEntry="ssl";fi
|
if [ $SRS_SSL = YES ]; then SrsLibrtmpSampleEntry="ssl";fi
|
||||||
# utest make entry, (cd utest; make)
|
# utest make entry, (cd utest; make)
|
||||||
SrsUtestMakeEntry="@echo -e \"ignore utest for it's disabled\""
|
SrsUtestMakeEntry="@echo -e \"ignore utest for it's disabled\""
|
||||||
if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS_DIR}/utest; \$(MAKE))"; fi
|
if [ $SRS_UTEST = YES ]; then SrsUtestMakeEntry="(cd ${SRS_OBJS_DIR}/${SRS_PLATFORM}/utest && \$(MAKE))"; fi
|
||||||
|
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
# finger out modules to install.
|
# finger out modules to install.
|
||||||
|
@ -355,6 +350,11 @@ if [ $SRS_LIBRTMP = YES ]; then
|
||||||
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${LIBS_OBJS[@]}"
|
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${LIBS_OBJS[@]}"
|
||||||
BUILD_KEY="librtmp" LIB_NAME="lib/srs_librtmp" . auto/libs.sh
|
BUILD_KEY="librtmp" LIB_NAME="lib/srs_librtmp" . auto/libs.sh
|
||||||
fi
|
fi
|
||||||
|
# For utest on mac.
|
||||||
|
# @see https://github.com/protocolbuffers/protobuf/issues/51#issuecomment-111044468
|
||||||
|
if [[ $SRS_OSX == YES ]]; then
|
||||||
|
EXTRA_DEFINES="-DGTEST_USE_OWN_TR1_TUPLE=1"
|
||||||
|
fi
|
||||||
#
|
#
|
||||||
# utest, the unit-test cases of srs, base on gtest1.6
|
# utest, the unit-test cases of srs, base on gtest1.6
|
||||||
if [ $SRS_UTEST = YES ]; then
|
if [ $SRS_UTEST = YES ]; then
|
||||||
|
@ -391,7 +391,9 @@ mv ${SRS_WORKDIR}/${SRS_MAKEFILE} ${SRS_WORKDIR}/${SRS_MAKEFILE}.bk
|
||||||
|
|
||||||
# generate phony header
|
# generate phony header
|
||||||
cat << END > ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
cat << END > ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
||||||
.PHONY: default _default install install-api help clean server srs_ingest_hls librtmp utest _prepare_dir $__mphonys
|
.PHONY: default _default install install-api help clean destroy server srs_ingest_hls librtmp utest _prepare_dir $__mphonys
|
||||||
|
.PHONY: clean_srs clean_modules clean_st clean_openssl clean_ffmpeg clean_nginx clean_cherrypy
|
||||||
|
.PHONY: st
|
||||||
|
|
||||||
# install prefix.
|
# install prefix.
|
||||||
SRS_PREFIX=${SRS_PREFIX}
|
SRS_PREFIX=${SRS_PREFIX}
|
||||||
|
@ -410,24 +412,58 @@ _default: server srs_ingest_hls librtmp utest __modules $__mdefaults
|
||||||
@bash objs/_srs_build_summary.sh
|
@bash objs/_srs_build_summary.sh
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Usage: make <help>|<clean>|<server>|<librtmp>|<utest>|<install>|<install-api>|<uninstall>"
|
@echo "Usage: make <help>|<clean>|<destroy>|<server>|<librtmp>|<utest>|<install>|<install-api>|<uninstall>"
|
||||||
@echo " help display this help menu"
|
@echo " help display this help menu"
|
||||||
@echo " clean cleanup project"
|
@echo " clean cleanup project and all depends"
|
||||||
|
@echo " destroy Cleanup all files for this platform in ${SRS_OBJS_DIR}/${SRS_PLATFORM}"
|
||||||
@echo " server build the srs(simple rtmp server) over st(state-threads)"
|
@echo " server build the srs(simple rtmp server) over st(state-threads)"
|
||||||
@echo " librtmp build the client publish/play library, and samples"
|
@echo " librtmp build the client publish/play library, and samples"
|
||||||
@echo " utest build the utest for srs"
|
@echo " utest build the utest for srs"
|
||||||
@echo " install install srs to the prefix path"
|
@echo " install install srs to the prefix path"
|
||||||
@echo " install-api install srs and api-server to the prefix path"
|
@echo " install-api install srs and api-server to the prefix path"
|
||||||
@echo " uninstall uninstall srs from prefix path"
|
@echo " uninstall uninstall srs from prefix path"
|
||||||
|
@echo "To clean special module:"
|
||||||
|
@echo " clean_st Clean depend st-srs in ${SRS_OBJS_DIR}/${SRS_PLATFORM}/st-srs"
|
||||||
|
@echo " clean_openssl Clean depend openssl in objs"
|
||||||
|
@echo " clean_ffmpeg Clean depend ffmpeg in objs"
|
||||||
@echo "@remark all modules will auto genearted and build"
|
@echo "@remark all modules will auto genearted and build"
|
||||||
@echo "For example:"
|
@echo "For example:"
|
||||||
@echo " make"
|
@echo " make"
|
||||||
@echo " make help"
|
@echo " make help"
|
||||||
|
|
||||||
clean:
|
doclean:
|
||||||
(cd ${SRS_OBJS_DIR} && rm -rf srs srs_utest $__mcleanups)
|
(cd ${SRS_OBJS_DIR} && rm -rf srs srs_utest $__mcleanups)
|
||||||
(cd ${SRS_OBJS_DIR} && rm -rf src include lib)
|
(cd ${SRS_OBJS_DIR} && rm -rf src/* include lib)
|
||||||
(cd ${SRS_OBJS_DIR}/utest && rm -rf *.o *.a)
|
(mkdir -p ${SRS_OBJS_DIR}/utest && cd ${SRS_OBJS_DIR}/utest && rm -rf *.o *.a)
|
||||||
|
(cd research/librtmp && make clean)
|
||||||
|
(cd research/api-server/static-dir && rm -rf crossdomain.xml forward live players)
|
||||||
|
|
||||||
|
clean: clean_srs clean_modules
|
||||||
|
@echo "You can clean each some components, see make help"
|
||||||
|
|
||||||
|
destroy: clean_st clean_openssl clean_ffmpeg clean_nginx clean_cherrypy
|
||||||
|
(cd ${SRS_OBJS_DIR} && rm -rf ${SRS_PLATFORM})
|
||||||
|
|
||||||
|
clean_srs:
|
||||||
|
(cd ${SRS_OBJS_DIR} && rm -rf srs srs_utest)
|
||||||
|
(cd ${SRS_OBJS_DIR}/${SRS_PLATFORM} && rm -rf src include lib utest)
|
||||||
|
|
||||||
|
clean_modules:
|
||||||
|
(cd ${SRS_OBJS_DIR} && rm -rf $__mdefaults)
|
||||||
|
|
||||||
|
clean_st:
|
||||||
|
(cd ${SRS_OBJS_DIR}/${SRS_PLATFORM}/st-srs && make clean)
|
||||||
|
|
||||||
|
clean_openssl:
|
||||||
|
(cd ${SRS_OBJS_DIR}/${SRS_PLATFORM} && rm -rf openssl*)
|
||||||
|
|
||||||
|
clean_ffmpeg:
|
||||||
|
(cd ${SRS_OBJS_DIR}/${SRS_PLATFORM} && rm -rf ffmpeg)
|
||||||
|
|
||||||
|
clean_nginx:
|
||||||
|
(cd ${SRS_OBJS_DIR} && rm -rf nginx)
|
||||||
|
|
||||||
|
clean_cherrypy:
|
||||||
(cd research/librtmp && make clean)
|
(cd research/librtmp && make clean)
|
||||||
(cd research/api-server/static-dir && rm -rf crossdomain.xml forward live players)
|
(cd research/api-server/static-dir && rm -rf crossdomain.xml forward live players)
|
||||||
|
|
||||||
|
@ -559,7 +595,7 @@ librtmp: server
|
||||||
@echo "Building the client publish/play library."
|
@echo "Building the client publish/play library."
|
||||||
\$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} librtmp
|
\$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} librtmp
|
||||||
@echo "Building the srs-librtmp example."
|
@echo "Building the srs-librtmp example."
|
||||||
(cd research/librtmp; \$(MAKE) EXTRA_CXXFLAGS="${SrsGcov}" ${SrsLibrtmpSampleEntry})
|
(cd research/librtmp && \$(MAKE) EXTRA_CXXFLAGS="${SrsGcov}" ${SrsLibrtmpSampleEntry})
|
||||||
|
|
||||||
END
|
END
|
||||||
else
|
else
|
||||||
|
|
|
@ -3,13 +3,15 @@ project(srs CXX)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(../../objs
|
INCLUDE_DIRECTORIES(../../objs
|
||||||
../../objs/st ../../objs/hp ../../objs/openssl/include
|
../../objs/st ../../objs/hp ../../objs/openssl/include
|
||||||
../../src/core ../../src/kernel ../../src/protocol ../../src/app)
|
../../src/core ../../src/kernel ../../src/protocol ../../src/app
|
||||||
|
../../src/service)
|
||||||
|
|
||||||
set(SOURCE_FILES ../../src/main/srs_main_server.cpp)
|
set(SOURCE_FILES ../../src/main/srs_main_server.cpp)
|
||||||
AUX_SOURCE_DIRECTORY(../../src/core SOURCE_FILES)
|
AUX_SOURCE_DIRECTORY(../../src/core SOURCE_FILES)
|
||||||
AUX_SOURCE_DIRECTORY(../../src/kernel SOURCE_FILES)
|
AUX_SOURCE_DIRECTORY(../../src/kernel SOURCE_FILES)
|
||||||
AUX_SOURCE_DIRECTORY(../../src/protocol SOURCE_FILES)
|
AUX_SOURCE_DIRECTORY(../../src/protocol SOURCE_FILES)
|
||||||
AUX_SOURCE_DIRECTORY(../../src/app SOURCE_FILES)
|
AUX_SOURCE_DIRECTORY(../../src/app SOURCE_FILES)
|
||||||
|
AUX_SOURCE_DIRECTORY(../../src/service SOURCE_FILES)
|
||||||
|
|
||||||
ADD_DEFINITIONS("-g -O0")
|
ADD_DEFINITIONS("-g -O0")
|
||||||
|
|
||||||
|
@ -18,7 +20,6 @@ TARGET_LINK_LIBRARIES(srs dl)
|
||||||
TARGET_LINK_LIBRARIES(srs ${PROJECT_SOURCE_DIR}/../../objs/st/libst.a)
|
TARGET_LINK_LIBRARIES(srs ${PROJECT_SOURCE_DIR}/../../objs/st/libst.a)
|
||||||
TARGET_LINK_LIBRARIES(srs ${PROJECT_SOURCE_DIR}/../../objs/openssl/lib/libssl.a)
|
TARGET_LINK_LIBRARIES(srs ${PROJECT_SOURCE_DIR}/../../objs/openssl/lib/libssl.a)
|
||||||
TARGET_LINK_LIBRARIES(srs ${PROJECT_SOURCE_DIR}/../../objs/openssl/lib/libcrypto.a)
|
TARGET_LINK_LIBRARIES(srs ${PROJECT_SOURCE_DIR}/../../objs/openssl/lib/libcrypto.a)
|
||||||
TARGET_LINK_LIBRARIES(srs ${PROJECT_SOURCE_DIR}/../../objs/hp/libhttp_parser.a)
|
|
||||||
TARGET_LINK_LIBRARIES(srs -ldl)
|
TARGET_LINK_LIBRARIES(srs -ldl)
|
||||||
|
|
||||||
IF(NOT EXISTS ${PROJECT_SOURCE_DIR}/../../objs/st/libst.a)
|
IF(NOT EXISTS ${PROJECT_SOURCE_DIR}/../../objs/st/libst.a)
|
||||||
|
|
|
@ -16,6 +16,7 @@ PI=NO
|
||||||
MIPS=NO
|
MIPS=NO
|
||||||
#
|
#
|
||||||
EMBEDED=NO
|
EMBEDED=NO
|
||||||
|
JOBS=1
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
##################################################################################
|
##################################################################################
|
||||||
|
@ -39,6 +40,7 @@ do
|
||||||
--mips) MIPS=YES ;;
|
--mips) MIPS=YES ;;
|
||||||
--arm) ARM=YES ;;
|
--arm) ARM=YES ;;
|
||||||
--pi) PI=YES ;;
|
--pi) PI=YES ;;
|
||||||
|
--jobs) JOBS=$value ;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "$0: error: invalid option \"$option\", @see $0 --help"
|
echo "$0: error: invalid option \"$option\", @see $0 --help"
|
||||||
|
@ -56,6 +58,7 @@ if [ $help = yes ]; then
|
||||||
--mips for mips cross-build platform, configure/make/package.
|
--mips for mips cross-build platform, configure/make/package.
|
||||||
--pi for pi platform, configure/make/package.
|
--pi for pi platform, configure/make/package.
|
||||||
--x86-64 alias for --x86-x64.
|
--x86-64 alias for --x86-x64.
|
||||||
|
--jobs Set the configure and make jobs.
|
||||||
END
|
END
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -113,26 +116,26 @@ ok_msg "real os is ${os_name}-${os_major_version} ${os_release} ${os_machine}"
|
||||||
|
|
||||||
# build srs
|
# build srs
|
||||||
# @see https://github.com/ossrs/srs/wiki/v1_CN_Build
|
# @see https://github.com/ossrs/srs/wiki/v1_CN_Build
|
||||||
ok_msg "start build srs"
|
ok_msg "start build srs, ARM: $ARM, MIPS: $MIPS, PI: $PI, X86_64: $X86_X64, JOBS: $JOBS"
|
||||||
if [ $ARM = YES ]; then
|
if [ $ARM = YES ]; then
|
||||||
(
|
(
|
||||||
cd $work_dir &&
|
cd $work_dir &&
|
||||||
./configure --arm --prefix=$INSTALL && make
|
./configure --arm --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} && make
|
||||||
) >> $log 2>&1
|
) >> $log 2>&1
|
||||||
elif [ $MIPS = YES ]; then
|
elif [ $MIPS = YES ]; then
|
||||||
(
|
(
|
||||||
cd $work_dir &&
|
cd $work_dir &&
|
||||||
./configure --mips --prefix=$INSTALL && make
|
./configure --mips --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} && make
|
||||||
) >> $log 2>&1
|
) >> $log 2>&1
|
||||||
elif [ $PI = YES ]; then
|
elif [ $PI = YES ]; then
|
||||||
(
|
(
|
||||||
cd $work_dir &&
|
cd $work_dir &&
|
||||||
./configure --pi --prefix=$INSTALL && make
|
./configure --pi --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} && make
|
||||||
) >> $log 2>&1
|
) >> $log 2>&1
|
||||||
elif [ $X86_X64 = YES ]; then
|
elif [ $X86_X64 = YES ]; then
|
||||||
(
|
(
|
||||||
cd $work_dir &&
|
cd $work_dir &&
|
||||||
./configure --x86-x64 --prefix=$INSTALL && make
|
./configure --x86-x64 --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} && make
|
||||||
) >> $log 2>&1
|
) >> $log 2>&1
|
||||||
else
|
else
|
||||||
failed_msg "invalid option, must be --x86-x64/--arm/--mips/--pi, see --help"; exit 1;
|
failed_msg "invalid option, must be --x86-x64/--arm/--mips/--pi, see --help"; exit 1;
|
||||||
|
|
|
@ -203,13 +203,26 @@ srs_error_t SrsResponseOnlyHttpConn::pop_message(ISrsHttpMessage** preq)
|
||||||
return srs_error_wrap(err, "init socket");
|
return srs_error_wrap(err, "init socket");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = parser->parse_message(&skt, preq)) != srs_success) {
|
// Check user interrupt by interval.
|
||||||
return srs_error_wrap(err, "parse message");
|
skt.set_recv_timeout(3 * SRS_UTIME_SECONDS);
|
||||||
|
|
||||||
|
// drop all request body.
|
||||||
|
char body[4096];
|
||||||
|
while (true) {
|
||||||
|
if ((err = trd->pull()) != srs_success) {
|
||||||
|
return srs_error_wrap(err, "timeout");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach owner connection to message.
|
if ((err = skt.read(body, 4096, NULL)) != srs_success) {
|
||||||
SrsHttpMessage* hreq = (SrsHttpMessage*)(*preq);
|
// Because we use timeout to check trd state, so we should ignore any timeout.
|
||||||
hreq->set_connection(this);
|
if (srs_error_code(err) == ERROR_SOCKET_TIMEOUT) {
|
||||||
|
srs_freep(err);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return srs_error_wrap(err, "read response");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -236,6 +249,11 @@ srs_error_t SrsResponseOnlyHttpConn::on_got_http_message(ISrsHttpMessage* msg)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SrsResponseOnlyHttpConn::expire()
|
||||||
|
{
|
||||||
|
SrsHttpConn::expire();
|
||||||
|
}
|
||||||
|
|
||||||
SrsHttpServer::SrsHttpServer(SrsServer* svr)
|
SrsHttpServer::SrsHttpServer(SrsServer* svr)
|
||||||
{
|
{
|
||||||
server = svr;
|
server = svr;
|
||||||
|
|
|
@ -101,6 +101,9 @@ public:
|
||||||
virtual srs_error_t pop_message(ISrsHttpMessage** preq);
|
virtual srs_error_t pop_message(ISrsHttpMessage** preq);
|
||||||
public:
|
public:
|
||||||
virtual srs_error_t on_got_http_message(ISrsHttpMessage* msg);
|
virtual srs_error_t on_got_http_message(ISrsHttpMessage* msg);
|
||||||
|
public:
|
||||||
|
// Set connection to expired.
|
||||||
|
virtual void expire();
|
||||||
};
|
};
|
||||||
|
|
||||||
// The http server, use http stream or static server to serve requests.
|
// The http server, use http stream or static server to serve requests.
|
||||||
|
|
|
@ -593,9 +593,14 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
|
||||||
|
|
||||||
SrsMessageArray msgs(SRS_PERF_MW_MSGS);
|
SrsMessageArray msgs(SRS_PERF_MW_MSGS);
|
||||||
|
|
||||||
|
// Use receive thread to accept the close event to avoid FD leak.
|
||||||
|
// @see https://github.com/ossrs/srs/issues/636#issuecomment-298208427
|
||||||
|
SrsHttpMessage* hr = dynamic_cast<SrsHttpMessage*>(r);
|
||||||
|
SrsResponseOnlyHttpConn* hc = dynamic_cast<SrsResponseOnlyHttpConn*>(hr->connection());
|
||||||
|
|
||||||
// update the statistic when source disconveried.
|
// update the statistic when source disconveried.
|
||||||
SrsStatistic* stat = SrsStatistic::instance();
|
SrsStatistic* stat = SrsStatistic::instance();
|
||||||
if ((err = stat->on_client(_srs_context->get_id(), req, NULL, SrsRtmpConnPlay)) != srs_success) {
|
if ((err = stat->on_client(_srs_context->get_id(), req, hc, SrsRtmpConnPlay)) != srs_success) {
|
||||||
return srs_error_wrap(err, "stat on client");
|
return srs_error_wrap(err, "stat on client");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,11 +619,6 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
|
||||||
|
|
||||||
SrsFlvStreamEncoder* ffe = dynamic_cast<SrsFlvStreamEncoder*>(enc);
|
SrsFlvStreamEncoder* ffe = dynamic_cast<SrsFlvStreamEncoder*>(enc);
|
||||||
|
|
||||||
// Use receive thread to accept the close event to avoid FD leak.
|
|
||||||
// @see https://github.com/ossrs/srs/issues/636#issuecomment-298208427
|
|
||||||
SrsHttpMessage* hr = dynamic_cast<SrsHttpMessage*>(r);
|
|
||||||
SrsResponseOnlyHttpConn* hc = dynamic_cast<SrsResponseOnlyHttpConn*>(hr->connection());
|
|
||||||
|
|
||||||
// Set the socket options for transport.
|
// Set the socket options for transport.
|
||||||
bool tcp_nodelay = _srs_config->get_tcp_nodelay(req->vhost);
|
bool tcp_nodelay = _srs_config->get_tcp_nodelay(req->vhost);
|
||||||
if (tcp_nodelay) {
|
if (tcp_nodelay) {
|
||||||
|
|
|
@ -30,7 +30,9 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
#include <sys/inotify.h>
|
#include <sys/inotify.h>
|
||||||
|
#endif
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <srs_kernel_log.hpp>
|
#include <srs_kernel_log.hpp>
|
||||||
|
@ -509,6 +511,7 @@ srs_error_t SrsInotifyWorker::start()
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
// Whether enable auto reload config.
|
// Whether enable auto reload config.
|
||||||
bool auto_reload = _srs_config->inotify_auto_reload();
|
bool auto_reload = _srs_config->inotify_auto_reload();
|
||||||
if (!auto_reload && _srs_in_docker && _srs_config->auto_reload_for_docker()) {
|
if (!auto_reload && _srs_in_docker && _srs_config->auto_reload_for_docker()) {
|
||||||
|
@ -579,6 +582,7 @@ srs_error_t SrsInotifyWorker::start()
|
||||||
if ((err = trd->start()) != srs_success) {
|
if ((err = trd->start()) != srs_success) {
|
||||||
return srs_error_wrap(err, "inotify");
|
return srs_error_wrap(err, "inotify");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -587,6 +591,7 @@ srs_error_t SrsInotifyWorker::cycle()
|
||||||
{
|
{
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
string config_path = _srs_config->config();
|
string config_path = _srs_config->config();
|
||||||
string config_file = srs_path_basename(config_path);
|
string config_file = srs_path_basename(config_path);
|
||||||
string k8s_file = "..data";
|
string k8s_file = "..data";
|
||||||
|
@ -626,6 +631,7 @@ srs_error_t SrsInotifyWorker::cycle()
|
||||||
|
|
||||||
srs_usleep(3000 * SRS_UTIME_MILLISECONDS);
|
srs_usleep(3000 * SRS_UTIME_MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,9 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#ifdef SRS_AUTO_OSX
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <srs_kernel_log.hpp>
|
#include <srs_kernel_log.hpp>
|
||||||
|
@ -326,6 +329,7 @@ SrsProcSystemStat* srs_get_system_proc_stat()
|
||||||
|
|
||||||
bool get_proc_system_stat(SrsProcSystemStat& r)
|
bool get_proc_system_stat(SrsProcSystemStat& r)
|
||||||
{
|
{
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
FILE* f = fopen("/proc/stat", "r");
|
FILE* f = fopen("/proc/stat", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
srs_warn("open system cpu stat failed, ignore");
|
srs_warn("open system cpu stat failed, ignore");
|
||||||
|
@ -355,6 +359,7 @@ bool get_proc_system_stat(SrsProcSystemStat& r)
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#endif
|
||||||
|
|
||||||
r.ok = true;
|
r.ok = true;
|
||||||
|
|
||||||
|
@ -363,6 +368,7 @@ bool get_proc_system_stat(SrsProcSystemStat& r)
|
||||||
|
|
||||||
bool get_proc_self_stat(SrsProcSelfStat& r)
|
bool get_proc_self_stat(SrsProcSelfStat& r)
|
||||||
{
|
{
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
FILE* f = fopen("/proc/self/stat", "r");
|
FILE* f = fopen("/proc/self/stat", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
srs_warn("open self cpu stat failed, ignore");
|
srs_warn("open self cpu stat failed, ignore");
|
||||||
|
@ -389,6 +395,7 @@ bool get_proc_self_stat(SrsProcSelfStat& r)
|
||||||
&r.guest_time, &r.cguest_time);
|
&r.guest_time, &r.cguest_time);
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#endif
|
||||||
|
|
||||||
r.ok = true;
|
r.ok = true;
|
||||||
|
|
||||||
|
@ -484,6 +491,7 @@ SrsDiskStat* srs_get_disk_stat()
|
||||||
|
|
||||||
bool srs_get_disk_vmstat_stat(SrsDiskStat& r)
|
bool srs_get_disk_vmstat_stat(SrsDiskStat& r)
|
||||||
{
|
{
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
FILE* f = fopen("/proc/vmstat", "r");
|
FILE* f = fopen("/proc/vmstat", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
srs_warn("open vmstat failed, ignore");
|
srs_warn("open vmstat failed, ignore");
|
||||||
|
@ -503,6 +511,7 @@ bool srs_get_disk_vmstat_stat(SrsDiskStat& r)
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#endif
|
||||||
|
|
||||||
r.ok = true;
|
r.ok = true;
|
||||||
|
|
||||||
|
@ -514,6 +523,7 @@ bool srs_get_disk_diskstats_stat(SrsDiskStat& r)
|
||||||
r.ok = true;
|
r.ok = true;
|
||||||
r.sample_time = srsu2ms(srs_get_system_time());
|
r.sample_time = srsu2ms(srs_get_system_time());
|
||||||
|
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
// if disabled, ignore all devices.
|
// if disabled, ignore all devices.
|
||||||
SrsConfDirective* conf = _srs_config->get_stats_disk_device();
|
SrsConfDirective* conf = _srs_config->get_stats_disk_device();
|
||||||
if (conf == NULL) {
|
if (conf == NULL) {
|
||||||
|
@ -584,6 +594,7 @@ bool srs_get_disk_diskstats_stat(SrsDiskStat& r)
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#endif
|
||||||
|
|
||||||
r.ok = true;
|
r.ok = true;
|
||||||
|
|
||||||
|
@ -676,6 +687,7 @@ void srs_update_meminfo()
|
||||||
{
|
{
|
||||||
SrsMemInfo& r = _srs_system_meminfo;
|
SrsMemInfo& r = _srs_system_meminfo;
|
||||||
|
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
FILE* f = fopen("/proc/meminfo", "r");
|
FILE* f = fopen("/proc/meminfo", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
srs_warn("open meminfo failed, ignore");
|
srs_warn("open meminfo failed, ignore");
|
||||||
|
@ -701,6 +713,7 @@ void srs_update_meminfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
#endif
|
||||||
|
|
||||||
r.sample_time = srsu2ms(srs_get_system_time());
|
r.sample_time = srsu2ms(srs_get_system_time());
|
||||||
r.MemActive = r.MemTotal - r.MemFree;
|
r.MemActive = r.MemTotal - r.MemFree;
|
||||||
|
@ -768,6 +781,7 @@ void srs_update_platform_info()
|
||||||
|
|
||||||
r.srs_startup_time = srsu2ms(srs_get_system_startup_time());
|
r.srs_startup_time = srsu2ms(srs_get_system_startup_time());
|
||||||
|
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
if (true) {
|
if (true) {
|
||||||
FILE* f = fopen("/proc/uptime", "r");
|
FILE* f = fopen("/proc/uptime", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
|
@ -796,6 +810,43 @@ void srs_update_platform_info()
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// man 3 sysctl
|
||||||
|
if (true) {
|
||||||
|
struct timeval tv;
|
||||||
|
size_t len = sizeof(timeval);
|
||||||
|
|
||||||
|
int mib[2];
|
||||||
|
mib[0] = CTL_KERN;
|
||||||
|
mib[1] = KERN_BOOTTIME;
|
||||||
|
if (sysctl(mib, 2, &tv, &len, NULL, 0) < 0) {
|
||||||
|
srs_warn("sysctl boottime failed, ignore");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
time_t bsec = tv.tv_sec;
|
||||||
|
time_t csec = ::time(NULL);
|
||||||
|
r.os_uptime = difftime(csec, bsec);
|
||||||
|
}
|
||||||
|
|
||||||
|
// man 3 sysctl
|
||||||
|
if (true) {
|
||||||
|
struct loadavg la;
|
||||||
|
size_t len = sizeof(loadavg);
|
||||||
|
|
||||||
|
int mib[2];
|
||||||
|
mib[0] = CTL_VM;
|
||||||
|
mib[1] = VM_LOADAVG;
|
||||||
|
if (sysctl(mib, 2, &la, &len, NULL, 0) < 0) {
|
||||||
|
srs_warn("sysctl loadavg failed, ignore");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
r.load_one_minutes = (double)la.ldavg[0] / la.fscale;
|
||||||
|
r.load_five_minutes = (double)la.ldavg[1] / la.fscale;
|
||||||
|
r.load_fifteen_minutes = (double)la.ldavg[2] / la.fscale;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
r.ok = true;
|
r.ok = true;
|
||||||
}
|
}
|
||||||
|
@ -842,6 +893,7 @@ int srs_get_network_devices_count()
|
||||||
|
|
||||||
void srs_update_network_devices()
|
void srs_update_network_devices()
|
||||||
{
|
{
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
if (true) {
|
if (true) {
|
||||||
FILE* f = fopen("/proc/net/dev", "r");
|
FILE* f = fopen("/proc/net/dev", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
|
@ -878,6 +930,7 @@ void srs_update_network_devices()
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsNetworkRtmpServer::SrsNetworkRtmpServer()
|
SrsNetworkRtmpServer::SrsNetworkRtmpServer()
|
||||||
|
@ -925,6 +978,7 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
|
||||||
int nb_tcp_mem = 0;
|
int nb_tcp_mem = 0;
|
||||||
int nb_udp4 = 0;
|
int nb_udp4 = 0;
|
||||||
|
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
if (true) {
|
if (true) {
|
||||||
FILE* f = fopen("/proc/net/sockstat", "r");
|
FILE* f = fopen("/proc/net/sockstat", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
|
@ -954,9 +1008,20 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// TODO: FIXME: impelments it.
|
||||||
|
nb_socks = 0;
|
||||||
|
nb_tcp4_hashed = 0;
|
||||||
|
nb_tcp_orphans = 0;
|
||||||
|
nb_tcp_tws = 0;
|
||||||
|
nb_tcp_total = 0;
|
||||||
|
nb_tcp_mem = 0;
|
||||||
|
nb_udp4 = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
int nb_tcp_estab = 0;
|
int nb_tcp_estab = 0;
|
||||||
|
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
if (true) {
|
if (true) {
|
||||||
FILE* f = fopen("/proc/net/snmp", "r");
|
FILE* f = fopen("/proc/net/snmp", "r");
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
|
@ -986,6 +1051,7 @@ void srs_update_rtmp_server(int nb_conn, SrsKbps* kbps)
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// @see: https://github.com/shemminger/iproute2/blob/master/misc/ss.c
|
// @see: https://github.com/shemminger/iproute2/blob/master/misc/ss.c
|
||||||
// TODO: FIXME: ignore the slabstat, @see: get_slabstat()
|
// TODO: FIXME: ignore the slabstat, @see: get_slabstat()
|
||||||
|
|
|
@ -24,6 +24,6 @@
|
||||||
#ifndef SRS_CORE_VERSION3_HPP
|
#ifndef SRS_CORE_VERSION3_HPP
|
||||||
#define SRS_CORE_VERSION3_HPP
|
#define SRS_CORE_VERSION3_HPP
|
||||||
|
|
||||||
#define SRS_VERSION3_REVISION 134
|
#define SRS_VERSION3_REVISION 139
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -124,7 +124,9 @@ srs_utime_t srs_get_system_startup_time()
|
||||||
}
|
}
|
||||||
|
|
||||||
// For utest to mock it.
|
// For utest to mock it.
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
_srs_gettimeofday_t _srs_gettimeofday = ::gettimeofday;
|
_srs_gettimeofday_t _srs_gettimeofday = ::gettimeofday;
|
||||||
|
#endif
|
||||||
|
|
||||||
srs_utime_t srs_update_system_time()
|
srs_utime_t srs_update_system_time()
|
||||||
{
|
{
|
||||||
|
@ -652,15 +654,20 @@ bool srs_path_exists(std::string path)
|
||||||
string srs_path_dirname(string path)
|
string srs_path_dirname(string path)
|
||||||
{
|
{
|
||||||
std::string dirname = path;
|
std::string dirname = path;
|
||||||
size_t pos = string::npos;
|
|
||||||
|
|
||||||
if ((pos = dirname.rfind("/")) != string::npos) {
|
// No slash, it must be current dir.
|
||||||
|
size_t pos = string::npos;
|
||||||
|
if ((pos = dirname.rfind("/")) == string::npos) {
|
||||||
|
return "./";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Path under root.
|
||||||
if (pos == 0) {
|
if (pos == 0) {
|
||||||
return "/";
|
return "/";
|
||||||
}
|
}
|
||||||
dirname = dirname.substr(0, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Fetch the directory.
|
||||||
|
dirname = dirname.substr(0, pos);
|
||||||
return dirname;
|
return dirname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,11 @@ extern int srs_chunk_header_c3(int perfer_cid, uint32_t timestamp, char* cache,
|
||||||
|
|
||||||
// For utest to mock it.
|
// For utest to mock it.
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
typedef int (*_srs_gettimeofday_t)(struct timeval* tv, struct timezone* tz);
|
#ifdef SRS_AUTO_OSX
|
||||||
|
#define _srs_gettimeofday gettimeofday
|
||||||
|
#else
|
||||||
|
typedef int (*_srs_gettimeofday_t) (struct timeval* tv, struct timezone* tz);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -127,8 +127,8 @@ srs_error_t do_main(int argc, char** argv)
|
||||||
srs_trace("%s, %s", RTMP_SIG_SRS_SERVER, RTMP_SIG_SRS_LICENSE);
|
srs_trace("%s, %s", RTMP_SIG_SRS_SERVER, RTMP_SIG_SRS_LICENSE);
|
||||||
srs_trace("authors: %s", RTMP_SIG_SRS_AUTHORS);
|
srs_trace("authors: %s", RTMP_SIG_SRS_AUTHORS);
|
||||||
srs_trace("contributors: %s", SRS_AUTO_CONSTRIBUTORS);
|
srs_trace("contributors: %s", SRS_AUTO_CONSTRIBUTORS);
|
||||||
srs_trace("cwd=%s, work_dir=%s, build: %s, configure: %s, uname: %s",
|
srs_trace("cwd=%s, work_dir=%s, build: %s, configure: %s, uname: %s, osx: %d",
|
||||||
_srs_config->cwd().c_str(), cwd.c_str(), SRS_AUTO_BUILD_DATE, SRS_AUTO_USER_CONFIGURE, SRS_AUTO_UNAME);
|
_srs_config->cwd().c_str(), cwd.c_str(), SRS_AUTO_BUILD_DATE, SRS_AUTO_USER_CONFIGURE, SRS_AUTO_UNAME, SRS_AUTO_OSX_BOOL);
|
||||||
srs_trace("configure detail: " SRS_AUTO_CONFIGURE);
|
srs_trace("configure detail: " SRS_AUTO_CONFIGURE);
|
||||||
#ifdef SRS_AUTO_EMBEDED_TOOL_CHAIN
|
#ifdef SRS_AUTO_EMBEDED_TOOL_CHAIN
|
||||||
srs_trace("crossbuild tool chain: " SRS_AUTO_EMBEDED_TOOL_CHAIN);
|
srs_trace("crossbuild tool chain: " SRS_AUTO_EMBEDED_TOOL_CHAIN);
|
||||||
|
@ -335,8 +335,8 @@ void show_macro_features()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if VERSION_MAJOR > VERSION_STABLE
|
#if VERSION_MAJOR > VERSION_STABLE
|
||||||
#warning "Current branch is unstable."
|
#warning "Current branch is beta."
|
||||||
srs_warn("Develop is unstable, please use branch: git checkout -b %s origin/%s", VERSION_STABLE_BRANCH, VERSION_STABLE_BRANCH);
|
srs_warn("%s/%s is beta", RTMP_SIG_SRS_KEY, RTMP_SIG_SRS_VERSION);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SRS_PERF_SO_SNDBUF_SIZE) && !defined(SRS_PERF_MW_SO_SNDBUF)
|
#if defined(SRS_PERF_SO_SNDBUF_SIZE) && !defined(SRS_PERF_MW_SO_SNDBUF)
|
||||||
|
|
|
@ -336,7 +336,7 @@ srs_error_t srs_write_large_iovs(ISrsProtocolReadWriter* skt, iovec* iovs, int s
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// send in a time.
|
// send in a time.
|
||||||
if (size < limits) {
|
if (size <= limits) {
|
||||||
if ((err = skt->writev(iovs, size, pnwrite)) != srs_success) {
|
if ((err = skt->writev(iovs, size, pnwrite)) != srs_success) {
|
||||||
return srs_error_wrap(err, "writev");
|
return srs_error_wrap(err, "writev");
|
||||||
}
|
}
|
||||||
|
@ -345,12 +345,16 @@ srs_error_t srs_write_large_iovs(ISrsProtocolReadWriter* skt, iovec* iovs, int s
|
||||||
|
|
||||||
// send in multiple times.
|
// send in multiple times.
|
||||||
int cur_iov = 0;
|
int cur_iov = 0;
|
||||||
|
ssize_t nwrite = 0;
|
||||||
while (cur_iov < size) {
|
while (cur_iov < size) {
|
||||||
int cur_count = srs_min(limits, size - cur_iov);
|
int cur_count = srs_min(limits, size - cur_iov);
|
||||||
if ((err = skt->writev(iovs + cur_iov, cur_count, pnwrite)) != srs_success) {
|
if ((err = skt->writev(iovs + cur_iov, cur_count, &nwrite)) != srs_success) {
|
||||||
return srs_error_wrap(err, "writev");
|
return srs_error_wrap(err, "writev");
|
||||||
}
|
}
|
||||||
cur_iov += cur_count;
|
cur_iov += cur_count;
|
||||||
|
if (pnwrite) {
|
||||||
|
*pnwrite += nwrite;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -46,7 +46,7 @@ int SrsThreadContext::generate_id()
|
||||||
static int id = 0;
|
static int id = 0;
|
||||||
|
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
id = (100 + ((int)(int64_t)this)%1000);
|
id = (100 + ((uint32_t)(int64_t)this)%1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gid = id++;
|
int gid = id++;
|
||||||
|
|
|
@ -2565,7 +2565,7 @@ VOID TEST(KernelUtility, BytesUtils)
|
||||||
VOID TEST(KernelUtility, PathUtils)
|
VOID TEST(KernelUtility, PathUtils)
|
||||||
{
|
{
|
||||||
if (true) {
|
if (true) {
|
||||||
EXPECT_TRUE("" == srs_path_dirname(""));
|
EXPECT_TRUE("./" == srs_path_dirname(""));
|
||||||
EXPECT_TRUE("/" == srs_path_dirname("/"));
|
EXPECT_TRUE("/" == srs_path_dirname("/"));
|
||||||
EXPECT_TRUE("/" == srs_path_dirname("//"));
|
EXPECT_TRUE("/" == srs_path_dirname("//"));
|
||||||
EXPECT_TRUE("/" == srs_path_dirname("/stream"));
|
EXPECT_TRUE("/" == srs_path_dirname("/stream"));
|
||||||
|
@ -4208,6 +4208,7 @@ VOID TEST(KernelUtilityTest, CoverBitsBufferAll)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SRS_AUTO_OSX
|
||||||
extern _srs_gettimeofday_t _srs_gettimeofday;
|
extern _srs_gettimeofday_t _srs_gettimeofday;
|
||||||
int mock_gettimeofday(struct timeval* /*tp*/, struct timezone* /*tzp*/) {
|
int mock_gettimeofday(struct timeval* /*tp*/, struct timezone* /*tzp*/) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -4238,6 +4239,7 @@ VOID TEST(KernelUtilityTest, CoverTimeSpecial)
|
||||||
EXPECT_TRUE(-1 == srs_update_system_time());
|
EXPECT_TRUE(-1 == srs_update_system_time());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
extern int64_t _srs_system_time_startup_time;
|
extern int64_t _srs_system_time_startup_time;
|
||||||
extern int64_t _srs_system_time_us_cache;
|
extern int64_t _srs_system_time_us_cache;
|
||||||
|
|
|
@ -230,8 +230,6 @@ srs_error_t MockBufferIO::writev(const iovec *iov, int iov_size, ssize_t* nwrite
|
||||||
total += writen;
|
total += writen;
|
||||||
}
|
}
|
||||||
|
|
||||||
sbytes += total;
|
|
||||||
|
|
||||||
if (nwrite) {
|
if (nwrite) {
|
||||||
*nwrite = total;
|
*nwrite = total;
|
||||||
}
|
}
|
||||||
|
@ -6412,3 +6410,65 @@ VOID TEST(ProtocolKbpsTest, RAWStatistic)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID TEST(ProtocolKbpsTest, WriteLargeIOVs)
|
||||||
|
{
|
||||||
|
srs_error_t err;
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
iovec iovs[1];
|
||||||
|
iovs[0].iov_base = (char*)"Hello";
|
||||||
|
iovs[0].iov_len = 5;
|
||||||
|
|
||||||
|
MockBufferIO io;
|
||||||
|
ssize_t nn = 0;
|
||||||
|
HELPER_EXPECT_SUCCESS(srs_write_large_iovs(&io, iovs, 1, &nn));
|
||||||
|
EXPECT_EQ(5, nn);
|
||||||
|
EXPECT_EQ(5, io.sbytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
iovec iovs[1024];
|
||||||
|
int nn_iovs = (int)(sizeof(iovs)/sizeof(iovec));
|
||||||
|
for (int i = 0; i < nn_iovs; i++) {
|
||||||
|
iovs[i].iov_base = (char*)"Hello";
|
||||||
|
iovs[i].iov_len = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
MockBufferIO io;
|
||||||
|
ssize_t nn = 0;
|
||||||
|
HELPER_EXPECT_SUCCESS(srs_write_large_iovs(&io, iovs, nn_iovs, &nn));
|
||||||
|
EXPECT_EQ(5 * nn_iovs, nn);
|
||||||
|
EXPECT_EQ(5 * nn_iovs, io.sbytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
iovec iovs[1025];
|
||||||
|
int nn_iovs = (int)(sizeof(iovs)/sizeof(iovec));
|
||||||
|
for (int i = 0; i < nn_iovs; i++) {
|
||||||
|
iovs[i].iov_base = (char*)"Hello";
|
||||||
|
iovs[i].iov_len = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
MockBufferIO io;
|
||||||
|
ssize_t nn = 0;
|
||||||
|
HELPER_EXPECT_SUCCESS(srs_write_large_iovs(&io, iovs, nn_iovs, &nn));
|
||||||
|
EXPECT_EQ(5 * nn_iovs, nn);
|
||||||
|
EXPECT_EQ(5 * nn_iovs, io.sbytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
iovec iovs[4096];
|
||||||
|
int nn_iovs = (int)(sizeof(iovs)/sizeof(iovec));
|
||||||
|
for (int i = 0; i < nn_iovs; i++) {
|
||||||
|
iovs[i].iov_base = (char*)"Hello";
|
||||||
|
iovs[i].iov_len = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
MockBufferIO io;
|
||||||
|
ssize_t nn = 0;
|
||||||
|
HELPER_EXPECT_SUCCESS(srs_write_large_iovs(&io, iovs, nn_iovs, &nn));
|
||||||
|
EXPECT_EQ(5 * nn_iovs, nn);
|
||||||
|
EXPECT_EQ(5 * nn_iovs, io.sbytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue