SRS 6.0-b0 源码 + danmaku 后端(排除 objs/3rdparty/测试媒体)

This commit is contained in:
RRRosmontis
2026-08-27 21:46:20 +08:00
commit 41b5da7c7e
578 changed files with 237858 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
# import log utility and check the detail log file is ok
# @param log the log file path, default to /dev/null
#######################################
# color echo.
#######################################
RED="\\033[31m"
GREEN="\\033[32m"
YELLOW="\\033[33m"
BLACK="\\033[0m"
POS="\\033[94G"
# if need to log to file, change the log path.
if [[ ! $log ]]; then
log=/dev/null;
fi
ok_msg(){
echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]"
# write to log file.
echo "[info] ${1}" >> $log
}
warn_msg(){
echo -e "${1}${POS}${BLACK}[ ${YELLOW}WARN${BLACK} ]"
# write to log file.
echo "[error] ${1}" >> $log
}
failed_msg(){
echo -e "${1}${POS}${BLACK}[${RED}FAILED${BLACK}]"
# write to log file.
echo "[error] ${1}" >> $log
}
function check_log(){
log_dir="`dirname $log`"
(mkdir -p ${log_dir} && chmod 777 ${log_dir} && touch $log)
ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "create log failed, ret=$ret"; return $ret; fi
ok_msg "create log( ${log} ) success"
echo "bravo-vms setup `date`" >> $log
ok_msg "see detail log: tailf ${log}"
return 0
}
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
if [[ ! -d 3rdparty/signaling || ! -d 3rdparty/httpx-static || ! -d 3rdparty/srs-bench ]]; then
echo "no signaling or httpx-static or srs-bench in $(pwd)"
exit -1
fi
if [[ ! -d ~/git/signaling || ! -d ~/git/go-oryx/httpx-static || ! -d ~/git/srs-bench ]]; then
echo "no signaling or httpx-static or srs-bench at ~/git"
exit -1
fi
if [[ ! -f ~/git/srs-bench/go.mod ]]; then
echo "no feature/rtc in srs-bench"
exit -1
fi
if [[ ! -d ~/git/state-threads ]]; then
echo "no state-threads at ~/git"
exit -1
fi
echo "Copy signaling"
cp -R 3rdparty/signaling/* ~/git/signaling/ &&
cp -R 3rdparty/signaling/.gitignore ~/git/signaling/ &&
(cd ~/git/signaling && git status)
echo "Copy httpx-static"
cp -R 3rdparty/httpx-static/* ~/git/go-oryx/httpx-static/ &&
cp -R 3rdparty/httpx-static/.gitignore ~/git/go-oryx/httpx-static/ &&
(cd ~/git/go-oryx && git status)
echo "Copy srs-bench"
cp -R 3rdparty/srs-bench/* ~/git/srs-bench/ &&
cp -R 3rdparty/srs-bench/.gitignore ~/git/srs-bench/ &&
(cd ~/git/srs-bench && git status)
echo "Copy state-threads"
cp -R 3rdparty/st-srs/* ~/git/state-threads/ &&
(cd ~/git/state-threads && git st)
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
# cd ~/git/srs
work_dir=$(cd -P $(dirname $0) && cd ../.. && pwd) && cd $work_dir && echo "Run script in ${work_dir}"
if [[ ! -d trunk ]]; then echo "no ./trunk found"; exit 1; fi
echo "For trunk/Dockerfile.test"
docker build --tag srs:test -f trunk/Dockerfile.test . &&
docker build --tag srs:cov -f trunk/Dockerfile.cov .
if [[ $? -ne 0 ]]; then echo "Docker for test failed"; exit 1; fi
echo "For trunk/Dockerfile"
docker buildx build --platform linux/arm/v7 --output "type=image,push=false" --build-arg IMAGE=ossrs/srs:ubuntu20-cache -f trunk/Dockerfile . &&
docker buildx build --platform linux/arm64/v8 --output "type=image,push=false" --build-arg IMAGE=ossrs/srs:ubuntu20-cache -f trunk/Dockerfile . &&
docker buildx build --platform linux/amd64 --output "type=image,push=false" --build-arg IMAGE=ossrs/srs:ubuntu20-cache -f trunk/Dockerfile .
if [[ $? -ne 0 ]]; then echo "Docker for release failed"; exit 1; fi
echo "For trunk/Dockerfile.pkg"
docker build --tag srs:pkg --build-arg version=1.2.3 -f trunk/Dockerfile.pkg .
if [[ $? -ne 0 ]]; then echo "Docker for pkg failed"; exit 1; fi
echo "For trunk/Dockerfile.builds"
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-baseline . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-all . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-no-webrtc . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-no-asm . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-ansi-no-ffmpeg . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos6-baseline . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos6-all . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu16-baseline . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu16-all . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu18-baseline . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu18-all . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu20-baseline . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu20-all . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu16-cross-armv7 . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu20-cross-armv7 . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu16-cross-aarch64 . &&
DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu20-cross-aarch64 .
if [[ $? -ne 0 ]]; then echo "Docker for build failed"; exit 1; fi
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
for file in $(git remote -v|grep -v https|grep -v gb28181|grep -v tmp|grep push|awk '{print $1}'); do
echo "";
echo "git push $file $@";
git push $file $@;
done
+7
View File
@@ -0,0 +1,7 @@
#/bin/bash
for ((;;)); do
ip=`ifconfig 2>&1|grep "inet addr"|grep -v "127"|awk '{print $2}'|awk -F ':' '{print $2}'`
echo "heatbeat at `date`, ip is ${ip}"
curl 'http://ossrs.net:8085/api/v1/servers' -H 'Content-Type: text/html' --data-binary "{\"ip\":\"${ip}\",\"device_id\":\"respberry-pi2\"}" && echo ""
sleep 10
done
+139
View File
@@ -0,0 +1,139 @@
#!/bin/bash
# user can config the following configs, then package.
INSTALL=/usr/local/srs
##################################################################################
##################################################################################
##################################################################################
# discover the current work dir, the log and access.
echo "argv[0]=$0"
if [[ ! -f $0 ]]; then
echo "directly execute the scripts on shell.";
work_dir=`pwd`
else
echo "execute scripts in file: $0";
work_dir=`dirname $0`; work_dir=`(cd ${work_dir} && pwd)`
fi
product_dir=$work_dir
log="${work_dir}/logs/package.`date +%s`.log" && . ${product_dir}/scripts/_log.sh && check_log
ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi
# check lsb_release
ok_msg "check tools"
lsb_release -v >/dev/null 2>&1; ret=$?
if [[ $ret -ne 0 ]]; then failed_msg "no lsb_release, install: yum install -y redhat-lsb"; exit $ret; fi
# user must stop service first.
ok_msg "check previous install"
if [[ -f /etc/init.d/srs ]]; then
/etc/init.d/srs status >/dev/null 2>&1
ret=$?; if [[ 0 -eq ${ret} ]]; then
failed_msg "you must stop the service first: sudo /etc/init.d/srs stop";
exit 1;
fi
fi
ok_msg "previous install checked"
# backup old srs
ok_msg "backup old srs"
install_root=$INSTALL
install_bin=$install_root/objs/srs
if [[ -d $install_root ]]; then
version="unknown"
if [[ -f $install_bin ]]; then
version=`$install_bin -v 2>/dev/stdout 1>/dev/null`
fi
backup_dir=${install_root}.`date "+%Y-%m-%d_%H-%M-%S"`.v-$version
ok_msg "backup installed dir, version=$version"
ok_msg " to=$backup_dir"
mv $install_root $backup_dir >>$log 2>&1
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "backup installed dir failed"; exit $ret; fi
ok_msg "backup installed dir success"
fi
ok_msg "old srs backuped"
# prepare files.
ok_msg "prepare files"
(
sed -i "s|^ROOT=.*|ROOT=\"${INSTALL}\"|g" $work_dir/${INSTALL}/etc/init.d/srs
) >> $log 2>&1
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "prepare files failed"; exit $ret; fi
ok_msg "prepare files success"
# copy core files
ok_msg "copy core components"
(
mkdir -p $install_root
cp -r $work_dir/${INSTALL}/conf $install_root &&
cp -r $work_dir/${INSTALL}/etc $install_root &&
cp -r $work_dir/${INSTALL}/usr $install_root &&
cp -r $work_dir/${INSTALL}/objs $install_root
) >>$log 2>&1
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "copy core components failed"; exit $ret; fi
ok_msg "copy core components success"
# install init.d scripts
ok_msg "install init.d scripts"
(
rm -rf /etc/init.d/srs &&
ln -sf $install_root/etc/init.d/srs /etc/init.d/srs
) >>$log 2>&1
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install init.d scripts failed"; exit $ret; fi
ok_msg "install init.d scripts success"
# For systemctl
if [[ -d /usr/lib/systemd/system ]]; then
ok_msg "install srs.service for systemctl"
(
cp -f $install_root/usr/lib/systemd/system/srs.service /usr/lib/systemd/system/srs.service &&
systemctl daemon-reload
) >>$log 2>&1
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install srs.service for systemctl failed"; exit $ret; fi
ok_msg "install srs.service for systemctl success"
fi
# install system service
lsb_release --id|grep "CentOS" >/dev/null 2>&1; os_id_centos=$?
lsb_release --id|grep "Ubuntu" >/dev/null 2>&1; os_id_ubuntu=$?
lsb_release --id|grep "Debian" >/dev/null 2>&1; os_id_debian=$?
lsb_release --id|grep "Raspbian" >/dev/null 2>&1; os_id_rasabian=$?
if [[ 0 -eq $os_id_centos ]]; then
ok_msg "install system service for CentOS"
if [[ -d /usr/lib/systemd/system ]]; then
systemctl enable srs
else
/sbin/chkconfig --add srs && /sbin/chkconfig srs on
fi
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install system service failed"; exit $ret; fi
ok_msg "install system service success"
elif [[ 0 -eq $os_id_ubuntu ]]; then
ok_msg "install system service for Ubuntu"
update-rc.d srs defaults
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install system service failed"; exit $ret; fi
ok_msg "install system service success"
elif [[ 0 -eq $os_id_debian ]]; then
ok_msg "install system service for Debian"
update-rc.d srs defaults
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install system service failed"; exit $ret; fi
ok_msg "install system service success"
elif [[ 0 -eq $os_id_rasabian ]]; then
ok_msg "install system service for RaspberryPi"
update-rc.d srs defaults
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install system service failed"; exit $ret; fi
ok_msg "install system service success"
else
warn_msg "ignore and donot install system service for `lsb_release --id|awk '{print $3}'`."
fi
echo ""
echo "see: https://github.com/ossrs/srs/wiki/v4_CN_LinuxService"
echo "install success, you can start SRS on CentOS6:"
echo -e "${GREEN} sudo /etc/init.d/srs start${BLACK}"
echo "or CentOS7:"
echo -e "${GREEN} sudo systemctl start srs${BLACK}"
echo "srs root is ${INSTALL}"
exit 0
+16
View File
@@ -0,0 +1,16 @@
#!/bin/bash
AFILE=`dirname $0`/../AUTHORS.txt
if [[ ! -f $AFILE ]]; then echo "No file at $AFILE"; exit -1; fi
authors=`git log --format='%ae'|grep -v localhost|grep -v demo|grep -v none|sort|uniq`
if [[ $? -ne 0 ]]; then echo "no authors"; exit -1; fi
for author in $authors; do
echo $author| grep -e "winlin" -e 'winterserver' >/dev/null 2>&1 && continue;
username=$(echo $author |awk -F '@' '{print $1}')
grep $username $AFILE 1>/dev/null 2>/dev/null && continue;
echo "* $(git log -1 --author="$author" --format='`%an<%ae>`'| sed 's/ //g')"
done
+220
View File
@@ -0,0 +1,220 @@
#!/bin/bash
echo "通用打包脚本,--help查看参数"
# Usage:
# bash package.sh [--help]
# option arm, whether build for arm, requires ubuntu12.
# user can config the following configs, then package.
INSTALL=/usr/local/srs
# whether build for arm, only for ubuntu12.
help=NO
X86_X64=NO
ARM=NO
PI=NO
MIPS=NO
#
EMBEDED=NO
JOBS=1
#
SRS_TAG=
#
OPTIONS=
##################################################################################
##################################################################################
##################################################################################
# parse options.
for option
do
case "$option" in
-*=*)
value=`echo "$option" | sed -e 's|[-_a-zA-Z0-9/]*=||'`
option=`echo "$option" | awk -F '=' '{print $1}'`
;;
*) value="" ;;
esac
case "$option" in
-h) help=yes ;;
--help) help=yes ;;
--x86-x64) X86_X64=YES ;;
--x86-64) X86_X64=YES ;;
--mips) MIPS=YES ;;
--arm) ARM=YES ;;
--pi) PI=YES ;;
--jobs) JOBS=$value ;;
--tag) SRS_TAG=$value ;;
*)
OPTIONS="${OPTIONS} ${option}=${value}"
echo "Apply option ${option}=${value}"
;;
esac
done
if [ $help = yes ]; then
cat << END
--help Print this message
--x86-x64 For x86-x64 platform, configure/make/package.
--x86-64 Alias for --x86-x64.
--arm For arm cross-build platform, configure/make/package.
--mips For mips cross-build platform, configure/make/package.
--pi For pi platform, configure/make/package.
--jobs Set the configure and make jobs.
--tag Set the version in zip file.
END
exit 0
fi
# embeded(arm/mips)
if [ $ARM = YES ]; then EMBEDED=YES; fi
if [ $MIPS = YES ]; then EMBEDED=YES; fi
# discover the current work dir, the log and access.
echo "argv[0]=$0"
if [[ ! -f $0 ]]; then
echo "directly execute the scripts on shell.";
work_dir=`pwd`
else
echo "execute scripts in file: $0";
work_dir=`dirname $0`; work_dir=`(cd ${work_dir} && pwd)`
fi
work_dir=`(cd ${work_dir}/.. && pwd)`
product_dir=$work_dir
build_objs=${work_dir}/objs
package_dir=${build_objs}/package
log="${build_objs}/logs/package.`date +%s`.log" && . ${product_dir}/scripts/_log.sh && check_log
ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi
# check lsb_release
lsb_release -a >/dev/null 2>&1
ret=$?; if [[ $ret -ne 0 ]]; then
failed_msg "lsb_release not found. "
failed_msg "to install on centos/debian(ubuntu/respberry-pi):";
failed_msg " sudo yum install -y lsb-release";
failed_msg " sudo aptitude install -y lsb-release";
failed_msg "or centos7:"
failed_msg " sudo yum install -y redhat-lsb"
exit $ret;
fi
# check os version
os_name=`lsb_release --id|awk '{print $3}'` &&
os_release=`lsb_release --release|awk '{print $2}'` &&
os_major_version=`echo $os_release|awk -F '.' '{print $1}'` &&
os_machine=`uname -i`
ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "lsb_release get os info failed."; exit $ret; fi
ok_msg "target os is ${os_name}-${os_major_version} ${os_release} ${os_machine}"
# for raspberry-pi
# use rasberry-pi instead all release
if [ $PI = YES ]; then
uname -a|grep "raspberrypi"; if [[ 0 -eq $? ]]; then os_name="RaspberryPi"; fi
if [[ "Raspbian" == $os_name ]]; then os_name="RaspberryPi"; fi
# check the cpu machine
if [[ "unknown" == $os_machine ]]; then os_machine=`uname -m`; fi
fi
ok_msg "real os is ${os_name}-${os_major_version} ${os_release} ${os_machine}"
# build srs
# @see https://github.com/ossrs/srs/wiki/v1_CN_Build
ok_msg "start build srs, ARM: $ARM, MIPS: $MIPS, PI: $PI, X86_64: $X86_X64, JOBS: $JOBS, TAG: $SRS_TAG"
if [ $ARM = YES ]; then
(
cd $work_dir &&
./configure --arm --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} ${OPTIONS} && make
) >> $log 2>&1
elif [ $MIPS = YES ]; then
(
cd $work_dir &&
./configure --mips --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} ${OPTIONS} && make
) >> $log 2>&1
elif [ $PI = YES ]; then
(
cd $work_dir &&
./configure --pi --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} ${OPTIONS} && make
) >> $log 2>&1
elif [ $X86_X64 = YES ]; then
(
cd $work_dir &&
./configure --x86-x64 --jobs=$JOBS --prefix=$INSTALL --build-tag=${os_name}${os_major_version} ${OPTIONS} && make
) >> $log 2>&1
else
failed_msg "invalid option, must be --x86-x64/--arm/--mips/--pi, see --help"; exit 1;
fi
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "build srs failed"; exit $ret; fi
ok_msg "build srs success"
# install srs
ok_msg "start install srs"
(
cd $work_dir && rm -rf $package_dir && make DESTDIR=$package_dir install
) >> $log 2>&1
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "install srs failed"; exit $ret; fi
ok_msg "install srs success"
# copy extra files to package.
ok_msg "start copy extra files to package"
(
cp $work_dir/scripts/install.sh $package_dir/INSTALL &&
sed -i "s|^INSTALL=.*|INSTALL=${INSTALL}|g" $package_dir/INSTALL &&
mkdir -p $package_dir/scripts &&
cp $work_dir/scripts/_log.sh $package_dir/scripts/_log.sh &&
chmod +x $package_dir/INSTALL
) >> $log 2>&1
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "copy extra files failed"; exit $ret; fi
ok_msg "copy extra files success"
# detect for arm.
if [ $ARM = YES ]; then
arm_cpu=`arm-linux-gnueabi-readelf --arch-specific ${build_objs}/srs|grep Tag_CPU_arch:|awk '{print $2}'`
os_machine=arm${arm_cpu}cpu
fi
if [ $MIPS = YES ]; then
os_machine=mips
fi
ok_msg "machine: $os_machine"
# generate zip dir and zip filename
srs_version=$SRS_TAG
if [[ $srs_version == '' ]]; then
if [ $EMBEDED = YES ]; then
srs_version_major=`cat $work_dir/src/core/srs_core.hpp| grep '#define VERSION_MAJOR'| awk '{print $3}'|xargs echo` &&
srs_version_minor=`cat $work_dir/src/core/srs_core.hpp| grep '#define VERSION_MINOR'| awk '{print $3}'|xargs echo` &&
srs_version_revision=`cat $work_dir/src/core/srs_core.hpp| grep '#define VERSION_REVISION'| awk '{print $3}'|xargs echo` &&
srs_version=$srs_version_major.$srs_version_minor.$srs_version_revision
else
srs_version=`${build_objs}/srs -v 2>/dev/stdout 1>/dev/null`
fi
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "get srs version failed"; exit $ret; fi
fi
ok_msg "get srs version $srs_version"
zip_dir="SRS-${os_name}${os_major_version}-${os_machine}-${srs_version}"
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "generate zip filename failed"; exit $ret; fi
ok_msg "target zip filename $zip_dir"
# zip package.
ok_msg "start zip package"
(
mv $package_dir ${build_objs}/${zip_dir} &&
cd ${build_objs} && rm -rf ${zip_dir}.zip && zip -q -r ${zip_dir}.zip ${zip_dir} &&
mv ${build_objs}/${zip_dir} $package_dir
) >> $log 2>&1
ret=$?; if [[ 0 -ne ${ret} ]]; then failed_msg "zip package failed"; exit $ret; fi
ok_msg "zip package success"
ok_msg "srs package success"
echo ""
echo "package: ${build_objs}/${zip_dir}.zip"
echo "install:"
echo " unzip -q ${zip_dir}.zip &&"
echo " cd ${zip_dir} &&"
echo " sudo bash INSTALL"
exit 0
+81
View File
@@ -0,0 +1,81 @@
#!/usr/bin/python
#
# Copyright (c) 2013-2025 Winlin
#
# SPDX-License-Identifier: MIT
#
import urllib, sys, json
url = "http://localhost:1985/api/v1/perf"
if len(sys.argv) < 2:
print "Usage: %s <url>"%(sys.argv[0])
print "For example:"
print " %s http://localhost:1985/api/v1/perf"%(sys.argv[0])
sys.exit(-1)
url = sys.argv[1]
print "Open %s"%(url)
f = urllib.urlopen(url)
s = f.read()
f.close()
print "Repsonse %s"%(s)
obj = json.loads(s)
print ""
p = obj['data']['dropped']
print('Frame-Dropped: %.1f%s'%(10000.0 * p['rtc_dropeed'] / p['rtc_frames'], '%%'))
p = obj['data']['bytes']
print('Padding-Overload: %.1f%s %dMB'%(10000.0 * p['rtc_padding'] / p['rtc_bytes'], '%%', p['rtc_padding']/1024/1024))
# 2, 3, 5, 9, 16, 32, 64, 128, 256
keys = ['lt_2', 'lt_3', 'lt_5', 'lt_9', 'lt_16', 'lt_32', 'lt_64', 'lt_128', 'lt_256', 'gt_256']
print("\n----------- 1 2 [3,4] [5,8] [9,15] [16,31] [32,63] [64,127] [128,255] [256,+) Packets"),
print ""
print("AV---Frames"),
p = obj['data']['avframes']
for k in keys:
k2 = '%s'%(k)
if k2 in p:
print(p[k2]),
else:
print(0),
print(p['nn']),
print ""
print("RTC--Frames"),
p = obj['data']['rtc']
for k in keys:
k2 = '%s'%(k)
if k2 in p:
print(p[k2]),
else:
print(0),
print(p['nn']),
print ""
print("RTP-Packets"),
p = obj['data']['rtp']
for k in keys:
k2 = '%s'%(k)
if k2 in p:
print(p[k2]),
else:
print(0),
print(p['nn']),
print ""
print("GSO-Packets"),
p = obj['data']['gso']
for k in keys:
k2 = '%s'%(k)
if k2 in p:
print(p[k2]),
else:
print(0),
print(p['nn']),
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
from=$1
to=$2
if [[ $from == '' ]]; then
echo "replace from must not be empty"
exit 1
fi
if [[ $to == '' ]]; then
echo "replace to must not be empty"
exit 1
fi
if [[ ! -d src || ! -d ide ]]; then
echo "please execute the script under trunk"
exit 1
fi
echo "from=$from"
echo "to=$to"
files="configure `ls auto` `ls conf` `ls scripts` `find etc -type f` `find ide -type f|grep -v xcuserdata` `find research -type f|grep -v objs` `find src -type f`"
for file in $files; do
grep -in "$from" $file >/dev/null 2>&1;
if [[ 0 -eq $? ]]; then
echo "replace $file";
sed -i '' "s|$from|$to|g" $file;
fi;
done
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
if [[ -d /usr/lib/systemd/system ]]; then
systemctl disable srs
systemctl stop srs
rm -f /usr/lib/systemd/system/srs.service
rm -f /etc/init.d/srs
else
/sbin/chkconfig srs off
/sbin/chkconfig --del srs
/etc/init.d/srs stop
rm -f /etc/init.d/srs
fi
rm -rf /usr/local/srs
echo "SRS uninstalled"
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
TRUNK_DIR=$(dirname $(realpath -q $0))/..
pushd $TRUNK_DIR > /dev/null
SRS_EXE=$(pwd)/objs/srs
if [ ! -f ${SRS_EXE} ]; then
echo "${SRS_EXE} not exist"
exit -1
fi
if [ ! -x ${SRS_EXE} ]; then
echo "${SRS_EXE} not executable"
exit -2
fi
for f in conf/*.conf
do
if [ -f $f ]; then
# skip below conf
if [[ $f == "conf/full.conf" ||
$f == "conf/hls.edge.conf" ||
$f == "conf/nginx.proxy.conf" ||
$f == "conf/include.vhost.conf" ]]; then
continue
fi
${SRS_EXE} -t -c $f
RET=$?
if [ $RET -ne 0 ]; then
echo "please check $f"
popd > /dev/null
exit $RET
fi
fi
done
popd > /dev/null