mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Merge branch '2.0release' into develop
This commit is contained in:
commit
7d5f1c2be8
13 changed files with 1294 additions and 34 deletions
|
@ -566,6 +566,7 @@ Supported operating systems and hardware:
|
||||||
|
|
||||||
### SRS 2.0 history
|
### SRS 2.0 history
|
||||||
|
|
||||||
|
* v2.0, 2015-04-20, support ingest hls live stream to RTMP.
|
||||||
* v2.0, 2015-04-15, for [#383](https://github.com/winlinvip/simple-rtmp-server/issues/383), support mix_correct algorithm. 2.0.161.
|
* v2.0, 2015-04-15, for [#383](https://github.com/winlinvip/simple-rtmp-server/issues/383), support mix_correct algorithm. 2.0.161.
|
||||||
* v2.0, 2015-04-13, for [#381](https://github.com/winlinvip/simple-rtmp-server/issues/381), support reap hls/ts by gop or not. 2.0.160.
|
* v2.0, 2015-04-13, for [#381](https://github.com/winlinvip/simple-rtmp-server/issues/381), support reap hls/ts by gop or not. 2.0.160.
|
||||||
* v2.0, 2015-04-10, enhanced on_hls_notify, support HTTP GET when reap ts.
|
* v2.0, 2015-04-10, enhanced on_hls_notify, support HTTP GET when reap ts.
|
||||||
|
|
|
@ -57,8 +57,6 @@ echo -e " | ${SrsGprofSummaryColor}rm -f gmon.out; ./objs/srs -c conf/co
|
||||||
echo -e " | ${SrsGprofSummaryColor}killall -2 srs # or CTRL+C to stop gprof\${BLACK}"
|
echo -e " | ${SrsGprofSummaryColor}killall -2 srs # or CTRL+C to stop gprof\${BLACK}"
|
||||||
echo -e " | ${SrsGprofSummaryColor}gprof -b ./objs/srs gmon.out > gprof.srs.log && rm -f gmon.out # gprof report to gprof.srs.log\${BLACK}"
|
echo -e " | ${SrsGprofSummaryColor}gprof -b ./objs/srs gmon.out > gprof.srs.log && rm -f gmon.out # gprof report to gprof.srs.log\${BLACK}"
|
||||||
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
||||||
echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info, librtmp.\${BLACK}"
|
|
||||||
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
|
||||||
echo -e " |${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\${BLACK}"
|
echo -e " |${SrsUtestSummaryColor}utest: ./objs/srs_utest, the utest for srs\${BLACK}"
|
||||||
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
||||||
echo -e " |${SrsLibrtmpSummaryColor}librtmp @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLibrtmp\${BLACK}"
|
echo -e " |${SrsLibrtmpSummaryColor}librtmp @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLibrtmp\${BLACK}"
|
||||||
|
@ -71,6 +69,12 @@ echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/
|
||||||
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_detect_rtmp\${BLACK}"
|
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_detect_rtmp\${BLACK}"
|
||||||
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_bandwidth_check\${BLACK}"
|
echo -e " | ${SrsLibrtmpSummaryColor}librtmp-sample: ./research/librtmp/objs/srs_bandwidth_check\${BLACK}"
|
||||||
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
||||||
|
echo -e " |${SrsResearchSummaryColor}research: ./objs/research, api server, players, ts info, librtmp.\${BLACK}"
|
||||||
|
echo -e " | ${SrsResearchSummaryColor} @see https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_SrsLibrtmp#srs-librtmp-examples\${BLACK}"
|
||||||
|
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
||||||
|
echo -e " |\${GREEN}tools: important tool, others @see https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_SrsLibrtmp#srs-librtmp-examples\${BLACK}"
|
||||||
|
echo -e " | \${GREEN}./objs/srs_ingest_hls -i http://ossrs.net/live/livestream.m3u8 -y rtmp://127.0.0.1/live/livestream\${BLACK}"
|
||||||
|
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
|
||||||
echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}"
|
echo -e " |\${GREEN}server: ./objs/srs -c conf/srs.conf, start the srs server\${BLACK}"
|
||||||
echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DeliveryHLS\${BLACK}"
|
echo -e " | ${SrsHlsSummaryColor}hls @see: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DeliveryHLS\${BLACK}"
|
||||||
echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}"
|
echo -e " | ${SrsHlsSummaryColor}hls: generate m3u8 and ts from rtmp stream\${BLACK}"
|
||||||
|
@ -121,4 +125,4 @@ echo -e "\${BLACK}Examples for srs-librtmp at:\${BLACK}"
|
||||||
echo -e "\${GREEN} objs/research/librtmp\${BLACK}"
|
echo -e "\${GREEN} objs/research/librtmp\${BLACK}"
|
||||||
echo -e "\${GREEN} Examples: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_SrsLibrtmp#srs-librtmp-examples\${BLACK}"
|
echo -e "\${GREEN} Examples: https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_SrsLibrtmp#srs-librtmp-examples\${BLACK}"
|
||||||
END
|
END
|
||||||
fi
|
fi
|
||||||
|
|
21
trunk/configure
vendored
21
trunk/configure
vendored
|
@ -100,7 +100,7 @@ AR = ar
|
||||||
LINK = g++
|
LINK = g++
|
||||||
CXXFLAGS = ${CXXFLAGS}
|
CXXFLAGS = ${CXXFLAGS}
|
||||||
|
|
||||||
.PHONY: default srs librtmp
|
.PHONY: default srs srs_ingest_hls librtmp
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||||
MODULE_ID="MAIN"
|
MODULE_ID="MAIN"
|
||||||
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
|
MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP")
|
||||||
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibHttpParserRoot})
|
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibHttpParserRoot})
|
||||||
MODULE_FILES=("srs_main_server")
|
MODULE_FILES=("srs_main_server" "srs_main_ingest_hls")
|
||||||
# add each modules for main
|
# add each modules for main
|
||||||
for SRS_MODULE in ${SRS_MODULES[*]}; do
|
for SRS_MODULE in ${SRS_MODULES[*]}; do
|
||||||
. $SRS_MODULE/config
|
. $SRS_MODULE/config
|
||||||
|
@ -217,7 +217,7 @@ fi
|
||||||
# disable all app when export librtmp
|
# disable all app when export librtmp
|
||||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||||
# all main entrances
|
# all main entrances
|
||||||
MAIN_ENTRANCES=("srs_main_server")
|
MAIN_ENTRANCES=("srs_main_server" "srs_main_ingest_hls")
|
||||||
# add each modules for main
|
# add each modules for main
|
||||||
for SRS_MODULE in ${SRS_MODULES[*]}; do
|
for SRS_MODULE in ${SRS_MODULES[*]}; do
|
||||||
. $SRS_MODULE/config
|
. $SRS_MODULE/config
|
||||||
|
@ -232,6 +232,9 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
|
||||||
#
|
#
|
||||||
# srs: srs(simple rtmp server) over st(state-threads)
|
# srs: srs(simple rtmp server) over st(state-threads)
|
||||||
BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh
|
BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh
|
||||||
|
#
|
||||||
|
# srs_ingest_hls: to ingest hls stream to srs.
|
||||||
|
BUILD_KEY="srs_ingest_hls" APP_MAIN="srs_main_ingest_hls" APP_NAME="srs_ingest_hls" . auto/apps.sh
|
||||||
# add each modules for application
|
# add each modules for application
|
||||||
for SRS_MODULE in ${SRS_MODULES[*]}; do
|
for SRS_MODULE in ${SRS_MODULES[*]}; do
|
||||||
. $SRS_MODULE/config
|
. $SRS_MODULE/config
|
||||||
|
@ -272,7 +275,7 @@ 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 librtmp utest _prepare_dir $__mphonys
|
.PHONY: default _default install install-api help clean server srs_ingest_hls librtmp utest _prepare_dir $__mphonys
|
||||||
|
|
||||||
# install prefix.
|
# install prefix.
|
||||||
SRS_PREFIX=${SRS_PREFIX}
|
SRS_PREFIX=${SRS_PREFIX}
|
||||||
|
@ -300,14 +303,15 @@ fi
|
||||||
# the server, librtmp and utest
|
# the server, librtmp and utest
|
||||||
# where the bellow will check and disable some entry by only echo.
|
# where the bellow will check and disable some entry by only echo.
|
||||||
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
||||||
_default: server librtmp utest $__mdefaults
|
_default: server srs_ingest_hls librtmp utest $__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>|<server>|<srs_ingest_hls>|<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"
|
||||||
@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 " srs_ingest_hls build the hls ingest tool of srs."
|
||||||
@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"
|
||||||
|
@ -332,6 +336,8 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then
|
||||||
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
cat << END >> ${SRS_WORKDIR}/${SRS_MAKEFILE}
|
||||||
server: _prepare_dir
|
server: _prepare_dir
|
||||||
@echo "donot build the srs(simple rtmp server) for srs-librtmp"
|
@echo "donot build the srs(simple rtmp server) for srs-librtmp"
|
||||||
|
srs_ingest_hls: _prepare_dir
|
||||||
|
@echo "donot build the srs_ingest_hls for srs-librtmp"
|
||||||
|
|
||||||
END
|
END
|
||||||
else
|
else
|
||||||
|
@ -339,6 +345,9 @@ else
|
||||||
server: _prepare_dir
|
server: _prepare_dir
|
||||||
@echo "build the srs(simple rtmp server) over st(state-threads)"
|
@echo "build the srs(simple rtmp server) over st(state-threads)"
|
||||||
\$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} srs
|
\$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} srs
|
||||||
|
srs_ingest_hls: _prepare_dir
|
||||||
|
@echo "build the srs_ingest_hls for srs"
|
||||||
|
\$(MAKE) -f ${SRS_OBJS_DIR}/${SRS_MAKEFILE} srs_ingest_hls
|
||||||
|
|
||||||
END
|
END
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
file
|
file
|
||||||
main readonly separator,
|
main readonly separator,
|
||||||
../../src/main/srs_main_server.cpp,
|
../../src/main/srs_main_server.cpp,
|
||||||
|
../../src/main/srs_main_ingest_hls.cpp,
|
||||||
auto readonly separator,
|
auto readonly separator,
|
||||||
../../objs/srs_auto_headers.hpp,
|
../../objs/srs_auto_headers.hpp,
|
||||||
libs readonly separator,
|
libs readonly separator,
|
||||||
|
|
|
@ -105,6 +105,7 @@
|
||||||
3CC52DDD1ACE4023006FEB01 /* srs_utest_reload.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DD41ACE4023006FEB01 /* srs_utest_reload.cpp */; };
|
3CC52DDD1ACE4023006FEB01 /* srs_utest_reload.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DD41ACE4023006FEB01 /* srs_utest_reload.cpp */; };
|
||||||
3CC52DDE1ACE4023006FEB01 /* srs_utest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DD61ACE4023006FEB01 /* srs_utest.cpp */; };
|
3CC52DDE1ACE4023006FEB01 /* srs_utest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DD61ACE4023006FEB01 /* srs_utest.cpp */; };
|
||||||
3CD88B3F1ACA9C58000359E0 /* srs_app_async_call.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CD88B3D1ACA9C58000359E0 /* srs_app_async_call.cpp */; };
|
3CD88B3F1ACA9C58000359E0 /* srs_app_async_call.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CD88B3D1ACA9C58000359E0 /* srs_app_async_call.cpp */; };
|
||||||
|
3CE6CD311AE4AFB800706E07 /* srs_main_ingest_hls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CE6CD301AE4AFB800706E07 /* srs_main_ingest_hls.cpp */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
@ -361,6 +362,7 @@
|
||||||
3CC52DD71ACE4023006FEB01 /* srs_utest.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_utest.hpp; path = ../../src/utest/srs_utest.hpp; sourceTree = "<group>"; };
|
3CC52DD71ACE4023006FEB01 /* srs_utest.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_utest.hpp; path = ../../src/utest/srs_utest.hpp; sourceTree = "<group>"; };
|
||||||
3CD88B3D1ACA9C58000359E0 /* srs_app_async_call.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_async_call.cpp; path = ../../../src/app/srs_app_async_call.cpp; sourceTree = "<group>"; };
|
3CD88B3D1ACA9C58000359E0 /* srs_app_async_call.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_async_call.cpp; path = ../../../src/app/srs_app_async_call.cpp; sourceTree = "<group>"; };
|
||||||
3CD88B3E1ACA9C58000359E0 /* srs_app_async_call.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_async_call.hpp; path = ../../../src/app/srs_app_async_call.hpp; sourceTree = "<group>"; };
|
3CD88B3E1ACA9C58000359E0 /* srs_app_async_call.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_async_call.hpp; path = ../../../src/app/srs_app_async_call.hpp; sourceTree = "<group>"; };
|
||||||
|
3CE6CD301AE4AFB800706E07 /* srs_main_ingest_hls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_main_ingest_hls.cpp; path = ../../../src/main/srs_main_ingest_hls.cpp; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -442,6 +444,7 @@
|
||||||
3C1232041AAE80CB00CE8F6C /* main */ = {
|
3C1232041AAE80CB00CE8F6C /* main */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
3CE6CD301AE4AFB800706E07 /* srs_main_ingest_hls.cpp */,
|
||||||
3C1232051AAE812C00CE8F6C /* srs_main_server.cpp */,
|
3C1232051AAE812C00CE8F6C /* srs_main_server.cpp */,
|
||||||
);
|
);
|
||||||
name = main;
|
name = main;
|
||||||
|
@ -904,6 +907,7 @@
|
||||||
3C1232A71AAE81D900CE8F6C /* srs_app_listener.cpp in Sources */,
|
3C1232A71AAE81D900CE8F6C /* srs_app_listener.cpp in Sources */,
|
||||||
3C1232261AAE814D00CE8F6C /* srs_kernel_flv.cpp in Sources */,
|
3C1232261AAE814D00CE8F6C /* srs_kernel_flv.cpp in Sources */,
|
||||||
3C663F1A1AB0155100286D8B /* srs_rtmp_dump.c in Sources */,
|
3C663F1A1AB0155100286D8B /* srs_rtmp_dump.c in Sources */,
|
||||||
|
3CE6CD311AE4AFB800706E07 /* srs_main_ingest_hls.cpp in Sources */,
|
||||||
3C1232241AAE814D00CE8F6C /* srs_kernel_error.cpp in Sources */,
|
3C1232241AAE814D00CE8F6C /* srs_kernel_error.cpp in Sources */,
|
||||||
3C1232441AAE81A400CE8F6C /* srs_rtmp_handshake.cpp in Sources */,
|
3C1232441AAE81A400CE8F6C /* srs_rtmp_handshake.cpp in Sources */,
|
||||||
3C1232291AAE814D00CE8F6C /* srs_kernel_stream.cpp in Sources */,
|
3C1232291AAE814D00CE8F6C /* srs_kernel_stream.cpp in Sources */,
|
||||||
|
|
|
@ -257,7 +257,7 @@ void re_update(int64_t re, int32_t starttime, u_int32_t time)
|
||||||
int64_t now = srs_utils_time_ms();
|
int64_t now = srs_utils_time_ms();
|
||||||
int64_t diff = time - starttime - (now -re);
|
int64_t diff = time - starttime - (now -re);
|
||||||
if (diff > RE_PULSE_MS) {
|
if (diff > RE_PULSE_MS) {
|
||||||
usleep(diff * 1000);
|
usleep((useconds_t)(diff * 1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void re_cleanup(int64_t re, int32_t starttime, u_int32_t time)
|
void re_cleanup(int64_t re, int32_t starttime, u_int32_t time)
|
||||||
|
@ -269,6 +269,6 @@ void re_cleanup(int64_t re, int32_t starttime, u_int32_t time)
|
||||||
if (diff > 0) {
|
if (diff > 0) {
|
||||||
srs_human_trace("re_cleanup, diff=%d, start=%d, last=%d ms",
|
srs_human_trace("re_cleanup, diff=%d, start=%d, last=%d ms",
|
||||||
(int)diff, starttime, time);
|
(int)diff, starttime, time);
|
||||||
usleep(diff * 1000);
|
usleep((useconds_t)(diff * 1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,21 +330,21 @@ int SrsFFMPEG::start()
|
||||||
}
|
}
|
||||||
|
|
||||||
// the codec params is disabled when copy
|
// the codec params is disabled when copy
|
||||||
if (acodec != SRS_RTMP_ENCODER_COPY && acodec != SRS_RTMP_ENCODER_NO_AUDIO) {
|
if (acodec != SRS_RTMP_ENCODER_NO_AUDIO) {
|
||||||
params.push_back("-b:a");
|
if (acodec != SRS_RTMP_ENCODER_COPY) {
|
||||||
snprintf(tmp, sizeof(tmp), "%d", abitrate * 1000);
|
params.push_back("-b:a");
|
||||||
params.push_back(tmp);
|
snprintf(tmp, sizeof(tmp), "%d", abitrate * 1000);
|
||||||
|
params.push_back(tmp);
|
||||||
params.push_back("-ar");
|
|
||||||
snprintf(tmp, sizeof(tmp), "%d", asample_rate);
|
params.push_back("-ar");
|
||||||
params.push_back(tmp);
|
snprintf(tmp, sizeof(tmp), "%d", asample_rate);
|
||||||
|
params.push_back(tmp);
|
||||||
params.push_back("-ac");
|
|
||||||
snprintf(tmp, sizeof(tmp), "%d", achannels);
|
params.push_back("-ac");
|
||||||
params.push_back(tmp);
|
snprintf(tmp, sizeof(tmp), "%d", achannels);
|
||||||
|
params.push_back(tmp);
|
||||||
// aparams
|
|
||||||
if (!aparams.empty()) {
|
// aparams
|
||||||
std::vector<std::string>::iterator it;
|
std::vector<std::string>::iterator it;
|
||||||
for (it = aparams.begin(); it != aparams.end(); ++it) {
|
for (it = aparams.begin(); it != aparams.end(); ++it) {
|
||||||
std::string p = *it;
|
std::string p = *it;
|
||||||
|
@ -352,6 +352,20 @@ int SrsFFMPEG::start()
|
||||||
params.push_back(p);
|
params.push_back(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// for audio copy.
|
||||||
|
for (int i = 0; i < (int)aparams.size();) {
|
||||||
|
std::string pn = aparams[i++];
|
||||||
|
|
||||||
|
// aparams, the adts to asc filter "-bsf:a aac_adtstoasc"
|
||||||
|
if (pn == "-bsf:a" && i < (int)aparams.size()) {
|
||||||
|
std::string pv = aparams[i++];
|
||||||
|
if (pv == "aac_adtstoasc") {
|
||||||
|
params.push_back(pn);
|
||||||
|
params.push_back(pv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1401,7 +1401,7 @@ int SrsHttpParser::parse_message(SrsStSocket* skt, SrsHttpMessage** ppmsg)
|
||||||
header = http_parser();
|
header = http_parser();
|
||||||
url = "";
|
url = "";
|
||||||
headers.clear();
|
headers.clear();
|
||||||
body_parsed = 0;
|
header_parsed = 0;
|
||||||
|
|
||||||
// do parse
|
// do parse
|
||||||
if ((ret = parse_message_imp(skt)) != ERROR_SUCCESS) {
|
if ((ret = parse_message_imp(skt)) != ERROR_SUCCESS) {
|
||||||
|
@ -1437,12 +1437,12 @@ int SrsHttpParser::parse_message_imp(SrsStSocket* skt)
|
||||||
// when buffer not empty, parse it.
|
// when buffer not empty, parse it.
|
||||||
if (buffer->size() > 0) {
|
if (buffer->size() > 0) {
|
||||||
nparsed = http_parser_execute(&parser, &settings, buffer->bytes(), buffer->size());
|
nparsed = http_parser_execute(&parser, &settings, buffer->bytes(), buffer->size());
|
||||||
srs_info("buffer=%d, nparsed=%d, body=%d", buffer->size(), (int)nparsed, body_parsed);
|
srs_info("buffer=%d, nparsed=%d, header=%d", buffer->size(), (int)nparsed, header_parsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// consume the parsed bytes.
|
// consume the parsed bytes.
|
||||||
if (nparsed && nparsed - body_parsed > 0) {
|
if (nparsed && header_parsed) {
|
||||||
buffer->read_slice((int)nparsed - (int)body_parsed);
|
buffer->read_slice(header_parsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ok atleast header completed,
|
// ok atleast header completed,
|
||||||
|
@ -1491,6 +1491,7 @@ int SrsHttpParser::on_headers_complete(http_parser* parser)
|
||||||
obj->header = *parser;
|
obj->header = *parser;
|
||||||
// save the parser when header parse completed.
|
// save the parser when header parse completed.
|
||||||
obj->state = SrsHttpParseStateHeaderComplete;
|
obj->state = SrsHttpParseStateHeaderComplete;
|
||||||
|
obj->header_parsed = (int)parser->nread;
|
||||||
|
|
||||||
srs_info("***HEADERS COMPLETE***");
|
srs_info("***HEADERS COMPLETE***");
|
||||||
|
|
||||||
|
@ -1567,8 +1568,6 @@ int SrsHttpParser::on_body(http_parser* parser, const char* at, size_t length)
|
||||||
SrsHttpParser* obj = (SrsHttpParser*)parser->data;
|
SrsHttpParser* obj = (SrsHttpParser*)parser->data;
|
||||||
srs_assert(obj);
|
srs_assert(obj);
|
||||||
|
|
||||||
obj->body_parsed += length;
|
|
||||||
|
|
||||||
srs_info("Body: %.*s", (int)length, at);
|
srs_info("Body: %.*s", (int)length, at);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -599,7 +599,7 @@ private:
|
||||||
http_parser header;
|
http_parser header;
|
||||||
std::string url;
|
std::string url;
|
||||||
std::vector<SrsHttpHeaderField> headers;
|
std::vector<SrsHttpHeaderField> headers;
|
||||||
int body_parsed;
|
int header_parsed;
|
||||||
public:
|
public:
|
||||||
SrsHttpParser();
|
SrsHttpParser();
|
||||||
virtual ~SrsHttpParser();
|
virtual ~SrsHttpParser();
|
||||||
|
|
|
@ -274,7 +274,7 @@ bool SrsFastLog::generate_header(bool error, const char* tag, int context_id, co
|
||||||
|
|
||||||
// to calendar time
|
// to calendar time
|
||||||
struct tm* tm;
|
struct tm* tm;
|
||||||
if (_srs_config->get_utc_time()) {
|
if (_srs_config && _srs_config->get_utc_time()) {
|
||||||
if ((tm = gmtime(&tv.tv_sec)) == NULL) {
|
if ((tm = gmtime(&tv.tv_sec)) == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,6 +169,23 @@ int SrsTsMessage::stream_number()
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SrsTsMessage* SrsTsMessage::detach()
|
||||||
|
{
|
||||||
|
// @remark the packet cannot be used, but channel is ok.
|
||||||
|
SrsTsMessage* cp = new SrsTsMessage(channel, NULL);
|
||||||
|
cp->start_pts = start_pts;
|
||||||
|
cp->write_pcr = write_pcr;
|
||||||
|
cp->is_discontinuity = is_discontinuity;
|
||||||
|
cp->dts = dts;
|
||||||
|
cp->pts = pts;
|
||||||
|
cp->sid = sid;
|
||||||
|
cp->PES_packet_length = PES_packet_length;
|
||||||
|
cp->continuity_counter = continuity_counter;
|
||||||
|
cp->payload = payload;
|
||||||
|
payload = NULL;
|
||||||
|
return cp;
|
||||||
|
}
|
||||||
|
|
||||||
ISrsTsHandler::ISrsTsHandler()
|
ISrsTsHandler::ISrsTsHandler()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,6 +309,13 @@ public:
|
||||||
* @return the stream number for audio/video; otherwise, -1.
|
* @return the stream number for audio/video; otherwise, -1.
|
||||||
*/
|
*/
|
||||||
virtual int stream_number();
|
virtual int stream_number();
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* detach the ts message,
|
||||||
|
* for user maybe need to parse the message by queue.
|
||||||
|
* @remark we always use the payload of original message.
|
||||||
|
*/
|
||||||
|
virtual SrsTsMessage* detach();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
1204
trunk/src/main/srs_main_ingest_hls.cpp
Normal file
1204
trunk/src/main/srs_main_ingest_hls.cpp
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue