Skip to content

Commit

Permalink
Merge edc291a into 3ed4aed
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhihong authored Jun 12, 2022
2 parents 3ed4aed + edc291a commit 593747b
Show file tree
Hide file tree
Showing 52 changed files with 4,437 additions and 3,367 deletions.
8 changes: 3 additions & 5 deletions trunk/auto/depends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,9 @@ function OSX_prepare()

echo "OSX detected, install tools if needed"

brew --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install brew"
echo "ruby -e \"$(curl -fsSL https://github.com/Homebrew/install/master/install)\""
ruby -e "$(curl -fsSL https://github.com/Homebrew/install/master/install)"; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install brew success"
brew --version >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Please install brew at https://brew.sh/"
exit $ret
fi

gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
Expand Down
6 changes: 0 additions & 6 deletions trunk/auto/options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,6 @@ function apply_auto_options() {
SRS_TOOL_LD=$SRS_TOOL_CC
fi

# The SRT code in SRS requires c++11, although we build libsrt without c++11.
# TODO: FIXME: Remove c++11 code in SRT of SRS.
if [[ $SRS_SRT == YES ]]; then
SRS_CXX11=YES
fi

# Enable FFmpeg fit for RTC to transcode audio from AAC to OPUS, if user enabled it.
if [[ $SRS_RTC == YES && $SRS_FFMPEG_FIT == RESERVED ]]; then
SRS_FFMPEG_FIT=YES
Expand Down
54 changes: 49 additions & 5 deletions trunk/conf/full.conf
Original file line number Diff line number Diff line change
Expand Up @@ -352,23 +352,67 @@ stream_caster {
#############################################################################################
# SRT server section
#############################################################################################
# @doc https://github.com/ossrs/srs/issues/1147#issuecomment-577607026
# @doc https://github.com/ossrs/srs/issues/1147#usage
srt_server {
# whether SRT server is enabled.
# default: off
enabled on;
# The UDP listen port for SRT.
listen 10080;
# For detail parameters, please read wiki:
# https://github.com/ossrs/srs/wiki/v4_CN_SRTParams
# https://github.com/ossrs/srs/wiki/v4_EN_SRTParams
# https://github.com/ossrs/srs/wiki/v5_CN_SRTParams
# https://github.com/ossrs/srs/wiki/v5_EN_SRTParams

# The maxbw is the max bandwidth of the sender side.
# -1: Means the biggest bandwidth is infinity.
# 0: Means the bandwidth is determined by SRTO_INPUTBW.
# >0: Means the bandwidth is the configuration value.
# default: -1
maxbw 1000000000;
# The timeout time of the SRT connection on the sender side in ms. When SRT connects to a peer costs time
# more than this config, it will be close.
# default: 3000
connect_timeout 4000;
peerlatency 300;
recvlatency 300;
# The timeout time of SRT connection on the receiver side in ms. When the SRT connection is idle
# more than this config, it will be close.
# default: 10000
peer_idle_timeout 8000;
# Default app for vmix, see https://github.com/ossrs/srs/pull/1615
# default: live
default_app live;
# The peerlatency is set by the sender side and will notify the receiver side.
# default: 0
peerlatency 0;
# The recvlatency means latency from sender to receiver.
# default: 120
recvlatency 0;
# This latency configuration configures both recvlatency and peerlatency to the same value.
# default: 120
latency 0;
# The tsbpd mode means timestamp based packet delivery.
# SRT sender side will pack timestamp in each packet. If this config is true,
# the receiver will read the packet according to the timestamp in the head of the packet.
# default: on
tsbpdmode off;
# The tlpkdrop means too-late Packet Drop
# SRT sender side will pack timestamp in each packet, When the network is congested,
# the packet will drop if latency is bigger than the configuration in both sender side and receiver side.
# And on the sender side, it also will be dropped because latency is bigger than configuration.
# default: on
tlpktdrop off;
# The send buffer size of SRT.
# default: 8192 * (1500-28)
sendbuf 2000000;
# The recv buffer size of SRT.
# default: 8192 * (1500-28)
recvbuf 2000000;
}

vhost srt.vhost.srs.com {
srt {
enabled on;
srt_to_rtmp on;
}
}

#############################################################################################
Expand Down
14 changes: 12 additions & 2 deletions trunk/conf/srt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,22 @@ srt_server {
listen 10080;
maxbw 1000000000;
connect_timeout 4000;
peerlatency 300;
recvlatency 300;
peerlatency 0;
recvlatency 0;
latency 0;
tsbpdmode off;
tlpktdrop off;
sendbuf 2000000;
recvbuf 2000000;
}

# @doc https://github.com/ossrs/srs/issues/1147#issuecomment-577607026
vhost __defaultVhost__ {
srt {
enabled on;
srt_to_rtmp on;
}

http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
Expand Down
34 changes: 12 additions & 22 deletions trunk/configure
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ fi

# srt code path
if [[ $SRS_SRT == YES ]]; then
SrsSRTRoot="${SRS_WORKDIR}/src/srt"
LibSRTRoot="${SRS_OBJS_DIR}/srt/include"; LibSRTfile="${SRS_OBJS_DIR}/srt/lib/libsrt.a"
if [[ $SRS_SHARED_SRT == YES ]]; then LibSRTfile="-L${SRS_OBJS_DIR}/srt/lib -lsrt"; fi
fi
Expand Down Expand Up @@ -200,7 +199,7 @@ MODULE_ID="CORE"
MODULE_DEPENDS=()
ModuleLibIncs=(${SRS_OBJS_DIR})
MODULE_FILES=("srs_core" "srs_core_version5" "srs_core_autofree" "srs_core_performance"
"srs_core_time" "srs_core_platform")
"srs_core_time" "srs_core_platform" "srs_core_lock")
CORE_INCS="src/core"; MODULE_DIR=${CORE_INCS} . auto/modules.sh
CORE_OBJS="${MODULE_OBJS[@]}"
#
Expand Down Expand Up @@ -228,6 +227,10 @@ MODULE_FILES=("srs_protocol_amf0" "srs_protocol_io" "srs_protocol_conn" "srs_pro
"srs_protocol_raw_avc" "srs_protocol_rtsp_stack" "srs_protocol_http_stack" "srs_protocol_kbps" "srs_protocol_json"
"srs_protocol_format" "srs_protocol_log" "srs_protocol_st" "srs_protocol_http_client"
"srs_protocol_http_conn" "srs_protocol_rtmp_conn")
if [[ $SRS_SRT == YES ]]; then
MODULE_FILES+=("srs_protocol_srt")
ModuleLibIncs+=(${LibSRTRoot})
fi
if [[ $SRS_RTC == YES ]]; then
MODULE_FILES+=("srs_protocol_rtc_stun")
ModuleLibIncs+=(${LibSrtpRoot})
Expand All @@ -237,16 +240,6 @@ if [[ $SRS_FFMPEG_FIT == YES ]]; then
fi
PROTOCOL_INCS="src/protocol"; MODULE_DIR=${PROTOCOL_INCS} . auto/modules.sh
PROTOCOL_OBJS="${MODULE_OBJS[@]}"
#
#srt protocol features.
if [[ $SRS_SRT == YES ]]; then
MODULE_ID="SRT"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP")
ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSSLRoot} ${LibSRTRoot})
MODULE_FILES=("srt_server" "srt_handle" "srt_conn" "srt_to_rtmp" "ts_demux" "srt_data" "srt_log")
SRT_INCS=(${LibSRTRoot} ${SrsSRTRoot}); MODULE_DIR=${SrsSRTRoot} . auto/modules.sh
SRT_OBJS="${MODULE_OBJS[@]}"
fi

#
#App Module, for SRS server only.
Expand All @@ -262,6 +255,9 @@ fi
if [[ $SRS_FFMPEG_FIT == YES ]]; then
ModuleLibIncs+=("${LibFfmpegRoot[*]}")
fi
if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=("${LibSRTRoot[*]}")
fi
MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_source"
"srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" "srs_app_http_stream"
"srs_app_bandwidth" "srs_app_st" "srs_app_log" "srs_app_config"
Expand All @@ -273,6 +269,9 @@ MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_sourc
"srs_app_caster_flv" "srs_app_latest_version" "srs_app_uuid" "srs_app_process" "srs_app_ng_exec"
"srs_app_hourglass" "srs_app_dash" "srs_app_fragment" "srs_app_dvr"
"srs_app_coworkers" "srs_app_hybrid" "srs_app_threads")
if [[ $SRS_SRT == YES ]]; then
MODULE_FILES+=("srs_app_srt_server" "srs_app_srt_listener" "srs_app_srt_conn" "srs_app_srt_utility" "srs_app_srt_source")
fi
if [[ $SRS_RTC == YES ]]; then
MODULE_FILES+=("srs_app_rtc_conn" "srs_app_rtc_dtls" "srs_app_rtc_sdp"
"srs_app_rtc_queue" "srs_app_rtc_server" "srs_app_rtc_source" "srs_app_rtc_api")
Expand All @@ -294,9 +293,6 @@ APP_OBJS="${MODULE_OBJS[@]}"
#Server Module, for SRS only.
MODULE_ID="SERVER"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP")
if [[ $SRS_SRT == YES ]]; then
MODULE_DEPENDS+=("SRT")
fi
ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibGperfRoot} ${LibSSLRoot})
if [[ $SRS_RTC == YES ]]; then
ModuleLibIncs+=(${LibSrtpRoot})
Expand All @@ -306,7 +302,6 @@ if [[ $SRS_FFMPEG_FIT == YES ]]; then
fi
if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=(${LibSRTRoot})
ModuleLibIncs+=("${SrsSRTRoot[*]}")
fi
MODULE_FILES=("srs_main_server")
SERVER_INCS="src/main"; MODULE_DIR=${SERVER_INCS} . auto/modules.sh
Expand All @@ -324,7 +319,6 @@ if [[ $SRS_FFMPEG_FIT == YES ]]; then
fi
if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=(${LibSRTRoot})
ModuleLibIncs+=("${SrsSRTRoot[*]}")
fi
MODULE_FILES=()
DEFINES=""
Expand Down Expand Up @@ -370,7 +364,6 @@ if [[ $SRS_FFMPEG_FIT == YES ]]; then
fi
if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=(${LibSRTRoot})
ModuleLibIncs+=("${SrsSRTRoot[*]}")
MODULE_OBJS="${MODULE_OBJS} ${SRT_OBJS[@]}"
fi
LINK_OPTIONS="${SrsLinkOptions}${SrsGprofLink}${SrsGperfLink}"
Expand Down Expand Up @@ -416,7 +409,7 @@ if [ $SRS_UTEST = YES ]; then
ModuleLibIncs+=("${LibFfmpegRoot[*]}")
fi
if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=("${SrsSRTRoot[*]}")
ModuleLibIncs+=("${LibSRTRoot[*]}")
fi
ModuleLibFiles=(${LibSTfile} ${LibSSLfile})
if [[ $SRS_RTC == YES ]]; then
Expand All @@ -429,9 +422,6 @@ if [ $SRS_UTEST = YES ]; then
ModuleLibFiles+=("${LibSRTfile[*]}")
fi
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP")
if [[ $SRS_SRT == YES ]]; then
MODULE_DEPENDS+=("SRT")
fi
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${APP_OBJS[@]} ${SRT_OBJS[@]}"
LINK_OPTIONS="-lpthread ${SrsLinkOptions}" MODULE_DIR="src/utest" APP_NAME="srs_utest" . auto/utest.sh
fi
Expand Down
19 changes: 10 additions & 9 deletions trunk/ide/srs_clion/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@ ProcessorCount(JOBS)

# We should always configure SRS for switching between branches.
IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
EXEC_PROGRAM("cd ${SRS_DIR} && ./configure --osx --srt=on --utest=on --jobs=${JOBS}")
EXECUTE_PROCESS(
COMMAND ./configure --osx --srt=on --utest=on --jobs=${JOBS}
WORKING_DIRECTORY ${SRS_DIR} RESULT_VARIABLE ret)
ELSE ()
EXEC_PROGRAM("cd ${SRS_DIR} && ./configure --srt=on --utest=on --jobs=${JOBS}")
EXECUTE_PROCESS(
COMMAND ./configure --srt=on --utest=on --jobs=${JOBS}
WORKING_DIRECTORY ${SRS_DIR} RESULT_VARIABLE ret)
ENDIF ()
if(NOT ret EQUAL 0)
message(FATAL_ERROR "FAILED: ${ret}")
endif()

set(DEPS_LIBS ${SRS_DIR}/objs/st/libst.a
${SRS_DIR}/objs/openssl/lib/libssl.a
Expand Down Expand Up @@ -61,19 +68,13 @@ INCLUDE_DIRECTORIES(${SRS_DIR}/objs
${SRS_DIR}/src/kernel
${SRS_DIR}/src/protocol
${SRS_DIR}/src/app
${SRS_DIR}/src/service
${SRS_DIR}/src/srt)
${SRS_DIR}/src/service)

# Common used sources for SRS and utest.
AUX_SOURCE_DIRECTORY(${SRS_DIR}/src/core SOURCE_FILES)
AUX_SOURCE_DIRECTORY(${SRS_DIR}/src/kernel SOURCE_FILES)
AUX_SOURCE_DIRECTORY(${SRS_DIR}/src/protocol SOURCE_FILES)
AUX_SOURCE_DIRECTORY(${SRS_DIR}/src/app SOURCE_FILES)
AUX_SOURCE_DIRECTORY(${SRS_DIR}/src/srt SOURCE_FILES)

# Remove the duplicated test main for srt.
# TODO: FIMXE: Remove the file directly, use utest or main or research.
list(REMOVE_ITEM SOURCE_FILES ${SRS_DIR}/src/srt/ts_demux_test.cpp)

ADD_DEFINITIONS("-g -O0")

Expand Down
Loading

0 comments on commit 593747b

Please sign in to comment.