Merge from SRS3

pull/1748/head
winlin 5 years ago
commit 61c7443c4b

@ -59,4 +59,6 @@ CONTRIBUTORS ordered by first contribution.
* xiaozhihong<xiaozhihong8@gmail.com>
* HuyaJohn<xiaozhihong@huya.com>
* yanghuiwen<cainiaodj@qq.com>
* Bepartofyou<pengqiang.wpq@alibaba-inc.com>
* Bepartofyou<309554135@qq.com>
* l<22312935+lam2003@users.noreply.github.com>
* xfalcon<x-falcon@users.noreply.github.com>

@ -184,6 +184,7 @@ For previous versions, please read:
## V3 changes
* v3.0, 2020-03-30, For [#1672][bug #1672], fix dvr close file failed bug. 3.0.140
* <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

@ -4,10 +4,15 @@
OS_KERNEL_NAME=$(uname -s)
OS_KERNRL_RELEASE=$(uname -r|awk -F '-' '{print $1}')
OS_PREFIX="Platform"
# Build platform cache.
SRS_PLATFORM="${OS_PREFIX}-${OS_KERNEL_NAME}-${OS_KERNRL_RELEASE}"
if [[ ${SRS_BUILD_TAG} != "" ]]; then
SRS_PLATFORM="${SRS_PLATFORM}-${SRS_BUILD_TAG}"
fi
# Use isolate cache for different SRS version.
SRS_PLATFORM="${SRS_PLATFORM}-SRS4"
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.

@ -11,7 +11,7 @@ for author in $authors; do
echo $author| grep 'winterserver' >/dev/null 2>&1 && continue;
echo $author| grep 'wenjie.zhao' >/dev/null 2>&1 && continue;
echo $author| grep 'zhaowenjie' >/dev/null 2>&1 && continue;
echo $author| grep 'noreply' >/dev/null 2>&1 && continue;
echo $author| grep 'pengqiang.wpq' >/dev/null 2>&1 && continue;
grep $author $AFILE 1>/dev/null 2>/dev/null && continue;

@ -179,12 +179,12 @@ srs_error_t SrsDvrSegmenter::close()
}
// Close the encoder, then close the fs object.
if ((err = close_encoder()) != srs_success) {
err = close_encoder();
fs->close(); // Always close the file.
if (err != srs_success) {
return srs_error_wrap(err, "close encoder");
}
fs->close();
// when tmp flv file exists, reap it.
if ((err = fragment->rename()) != srs_success) {
return srs_error_wrap(err, "rename fragment");

@ -24,6 +24,6 @@
#ifndef SRS_CORE_VERSION3_HPP
#define SRS_CORE_VERSION3_HPP
#define SRS_VERSION3_REVISION 139
#define SRS_VERSION3_REVISION 140
#endif

@ -124,7 +124,7 @@ srs_error_t SrsHttpParser::parse_message_imp(ISrsReader* reader)
enum http_errno code;
if ((code = HTTP_PARSER_ERRNO(&parser)) != HPE_OK) {
return srs_error_new(ERROR_HTTP_PARSE_HEADER, "parse %dB, nparsed=%d, err=%d/%s %s",
buffer->size(), consumed, http_errno_name(code), http_errno_description(code));
buffer->size(), consumed, code, http_errno_name(code), http_errno_description(code));
}
// When buffer consumed these bytes, it's dropped so the new ptr is actually the HTTP body. But http-parser

@ -246,7 +246,7 @@ VOID TEST(SrsAVCTest, H264IPBFrame)
if (true) {
SrsRawH264Stream h; string frame;
HELPER_ASSERT_SUCCESS(h.mux_ipb_frame((char*)"Hello", 5, frame));
EXPECT_EQ(4+5, frame.length());
EXPECT_EQ(4+5, (int)frame.length());
EXPECT_EQ(0, (uint8_t)frame.at(0)); EXPECT_EQ(0, (uint8_t)frame.at(1));
EXPECT_EQ(0, (uint8_t)frame.at(2)); EXPECT_EQ(5, (uint8_t)frame.at(3));
EXPECT_STREQ("Hello", frame.substr(4).c_str());
@ -407,7 +407,7 @@ VOID TEST(SrsAVCTest, AACMuxSequenceHeader)
codec.sound_rate = SrsAudioSampleRate22050;
codec.sampling_frequency_index = 7;
HELPER_ASSERT_SUCCESS(h.mux_sequence_header(&codec, sh));
EXPECT_EQ(2, sh.length());
EXPECT_EQ(2, (int)sh.length());
EXPECT_EQ(0x0b, (uint8_t)sh.at(0));
EXPECT_EQ(0x88, (uint8_t)sh.at(1));
}
@ -420,7 +420,7 @@ VOID TEST(SrsAVCTest, AACMuxSequenceHeader)
codec.sound_rate = SrsAudioSampleRate11025;
codec.sampling_frequency_index = 0xa;
HELPER_ASSERT_SUCCESS(h.mux_sequence_header(&codec, sh));
EXPECT_EQ(2, sh.length());
EXPECT_EQ(2, (int)sh.length());
EXPECT_EQ(0x0d, (uint8_t)sh.at(0));
EXPECT_EQ(0x08, (uint8_t)sh.at(1));
}
@ -442,7 +442,7 @@ VOID TEST(SrsAVCTest, AACMuxSequenceHeader)
codec.sampling_frequency_index = 4;
codec.sound_rate = SrsAudioSampleRateReserved;
HELPER_ASSERT_SUCCESS(h.mux_sequence_header(&codec, sh));
EXPECT_EQ(2, sh.length());
EXPECT_EQ(2, (int)sh.length());
EXPECT_EQ(0x0a, (uint8_t)sh.at(0));
EXPECT_EQ(0x08, (uint8_t)sh.at(1));
}
@ -488,7 +488,7 @@ VOID TEST(SrsAVCTest, AACMuxSequenceHeader)
codec.sound_rate = SrsAudioSampleRate44100;
codec.sampling_frequency_index = SrsAacSampleRateUnset;
HELPER_ASSERT_SUCCESS(h.mux_sequence_header(&codec, sh));
EXPECT_EQ(2, sh.length());
EXPECT_EQ(2, (int)sh.length());
EXPECT_EQ(0x0a, (uint8_t)sh.at(0));
EXPECT_EQ(0x08, (uint8_t)sh.at(1));
}

@ -4823,7 +4823,7 @@ VOID TEST(KernelMP4Test, CoverMP4CodecSingleFrame)
HELPER_EXPECT_SUCCESS(enc.write_sample(
&fmt, SrsMp4HandlerTypeVIDE, fmt.video->frame_type, fmt.video->avc_packet_type, 0, 0, (uint8_t*)fmt.raw, fmt.nb_raw
));
EXPECT_EQ(768, enc.width); EXPECT_EQ(320, enc.height);
EXPECT_EQ(768, (int)enc.width); EXPECT_EQ(320, (int)enc.height);
}
if (true) {
@ -4936,7 +4936,7 @@ VOID TEST(KernelMP4Test, CoverMP4MultipleVideos)
HELPER_EXPECT_SUCCESS(enc.write_sample(
&fmt, SrsMp4HandlerTypeVIDE, fmt.video->frame_type, fmt.video->avc_packet_type, 0, 0, (uint8_t*)fmt.raw, fmt.nb_raw
));
EXPECT_EQ(768, enc.width); EXPECT_EQ(320, enc.height);
EXPECT_EQ(768, (int)enc.width); EXPECT_EQ(320, (int)enc.height);
}
if (true) {
@ -5024,7 +5024,7 @@ VOID TEST(KernelMP4Test, CoverMP4MultipleCTTs)
HELPER_EXPECT_SUCCESS(enc.write_sample(
&fmt, SrsMp4HandlerTypeVIDE, fmt.video->frame_type, fmt.video->avc_packet_type, 0, 0, (uint8_t*)fmt.raw, fmt.nb_raw
));
EXPECT_EQ(768, enc.width); EXPECT_EQ(320, enc.height);
EXPECT_EQ(768, (int)enc.width); EXPECT_EQ(320, (int)enc.height);
}
if (true) {
@ -5126,7 +5126,7 @@ VOID TEST(KernelMP4Test, CoverMP4MultipleAVs)
HELPER_EXPECT_SUCCESS(enc.write_sample(
&fmt, SrsMp4HandlerTypeVIDE, fmt.video->frame_type, fmt.video->avc_packet_type, 0, 0, (uint8_t*)fmt.raw, fmt.nb_raw
));
EXPECT_EQ(768, enc.width); EXPECT_EQ(320, enc.height);
EXPECT_EQ(768, (int)enc.width); EXPECT_EQ(320, (int)enc.height);
}
if (true) {
@ -5240,7 +5240,7 @@ VOID TEST(KernelMP4Test, CoverMP4CodecErrorNoFrames)
HELPER_EXPECT_SUCCESS(enc.write_sample(
&fmt, SrsMp4HandlerTypeVIDE, fmt.video->frame_type, fmt.video->avc_packet_type, 0, 0, (uint8_t*)fmt.raw, fmt.nb_raw
));
EXPECT_EQ(768, enc.width); EXPECT_EQ(320, enc.height);
EXPECT_EQ(768, (int)enc.width); EXPECT_EQ(320, (int)enc.height);
}
if (true) {

@ -611,7 +611,7 @@ VOID TEST(KernelMp4Test, TFHDBox)
b.skip(-1 * b.pos());
SrsMp4TrackFragmentHeaderBox box;
HELPER_EXPECT_SUCCESS(box.decode(&b));
EXPECT_EQ(100, box.track_id);
EXPECT_EQ(100, (int)box.track_id);
}
}
@ -769,10 +769,10 @@ VOID TEST(KernelMp4Test, TRUNBox)
b.skip(-1 * b.pos());
SrsMp4TrackFragmentRunBox box;
HELPER_EXPECT_SUCCESS(box.decode(&b));
ASSERT_EQ(1, box.entries.size());
ASSERT_EQ(1, (int)box.entries.size());
SrsMp4TrunEntry* entry = box.entries.at(0);
EXPECT_EQ(1000, entry->sample_duration);
EXPECT_EQ(1000, (int)entry->sample_duration);
}
}
}
@ -803,7 +803,7 @@ VOID TEST(KernelMp4Test, FreeBox)
b.skip(-1 * b.pos());
SrsMp4FreeSpaceBox box(SrsMp4BoxTypeSKIP);
HELPER_EXPECT_SUCCESS(box.decode(&b));
EXPECT_EQ(4, box.data.size());
EXPECT_EQ(4, (int)box.data.size());
}
}
}
@ -906,11 +906,11 @@ VOID TEST(KernelMp4Test, TREXBox)
b.skip(-1 * b.pos());
SrsMp4TrackExtendsBox box;
HELPER_EXPECT_SUCCESS(box.decode(&b));
EXPECT_EQ(box.track_ID, 1);
EXPECT_EQ(box.default_sample_description_index, 2);
EXPECT_EQ(box.default_sample_size, 3);
EXPECT_EQ(box.default_sample_duration, 4);
EXPECT_EQ(box.default_sample_flags, 5);
EXPECT_EQ((int)box.track_ID, 1);
EXPECT_EQ((int)box.default_sample_description_index, 2);
EXPECT_EQ((int)box.default_sample_size, 3);
EXPECT_EQ((int)box.default_sample_duration, 4);
EXPECT_EQ((int)box.default_sample_flags, 5);
}
}
@ -948,7 +948,7 @@ VOID TEST(KernelMp4Test, TKHDBox)
b.skip(-1 * b.pos());
SrsMp4TrackHeaderBox box;
HELPER_EXPECT_SUCCESS(box.decode(&b));
EXPECT_EQ(box.track_ID, 1);
EXPECT_EQ((int)box.track_ID, 1);
}
}
@ -975,7 +975,7 @@ VOID TEST(KernelMp4Test, TKHDBox)
b.skip(-1 * b.pos());
SrsMp4TrackHeaderBox box;
HELPER_EXPECT_SUCCESS(box.decode(&b));
EXPECT_EQ(box.track_ID, 1);
EXPECT_EQ((int)box.track_ID, 1);
}
}
}

@ -5814,7 +5814,7 @@ VOID TEST(ProtocolHTTPTest, HTTPParser)
// size = 75, nparsed = 75, nread = 0
HELPER_EXPECT_SUCCESS(parser.parse("GET /gslb/v1/versions HTTP/1.1\r\nHost: ossrs.net\r\nContent-Length: 5\r\n\r\nHello"));
EXPECT_EQ(75, (int)parser.parsed);
EXPECT_EQ(0, parser.parser->nread);
EXPECT_EQ(0, (int)parser.parser->nread);
EXPECT_TRUE(parser.body && 5 == parser.body->length);
EXPECT_TRUE(parser.headers_complete);
EXPECT_TRUE(parser.message_complete);
@ -5825,7 +5825,7 @@ VOID TEST(ProtocolHTTPTest, HTTPParser)
// size = 150, nparsed = 150, nread = 0
HELPER_EXPECT_SUCCESS(parser.parse("GET /gslb/v1/versions HTTP/1.1\r\nHost: ossrs.net\r\nContent-Length: 5\r\n\r\nHelloGET /gslb/v1/versions HTTP/1.1\r\nHost: ossrs.net\r\nContent-Length: 5\r\n\r\nWorld"));
EXPECT_EQ(150, (int)parser.parsed);
EXPECT_EQ(0, parser.parser->nread);
EXPECT_EQ(0, (int)parser.parser->nread);
}
if (true) {
@ -5833,13 +5833,13 @@ VOID TEST(ProtocolHTTPTest, HTTPParser)
// size = 70, nparsed = 70, nread = 0, content_length = 5, Header("Content-Length", 5)
HELPER_EXPECT_SUCCESS(parser.parse("GET /gslb/v1/versions HTTP/1.1\r\nHost: ossrs.net\r\nContent-Length: 5\r\n\r\n"));
EXPECT_EQ(70, (int)parser.parsed);
EXPECT_EQ(0, parser.parser->nread);
EXPECT_EQ(5, parser.parser->content_length);
EXPECT_EQ(0, (int)parser.parser->nread);
EXPECT_EQ(5, (int)parser.parser->content_length);
// size = 79, nparsed = 5, nread = 1, content_length = -1, Header("Content-Length", 5)
HELPER_EXPECT_FAILED(parser.parse("elloGET /gslb/v1/versions HTTP/1.1\r\nHost: ossrs.net\r\nContent-Length: 5\r\n\r\nHello"));
EXPECT_EQ(5, (int)parser.parsed);
EXPECT_EQ(1, parser.parser->nread);
EXPECT_EQ(1, (int)parser.parser->nread);
EXPECT_EQ(-1, (int64_t)parser.parser->content_length);
}
@ -5848,13 +5848,13 @@ VOID TEST(ProtocolHTTPTest, HTTPParser)
// size = 70, nparsed = 70, nread = 0, content_length = 5, Header("Content-Length", 5)
HELPER_EXPECT_SUCCESS(parser.parse("GET /gslb/v1/versions HTTP/1.1\r\nHost: ossrs.net\r\nContent-Length: 5\r\n\r\n"));
EXPECT_EQ(70, (int)parser.parsed);
EXPECT_EQ(0, parser.parser->nread);
EXPECT_EQ(5, parser.parser->content_length);
EXPECT_EQ(0, (int)parser.parser->nread);
EXPECT_EQ(5, (int)parser.parser->content_length);
// size = 80, nparsed = 70, nread = 0, content_length = 0, Header("Content-Length", 5)
HELPER_EXPECT_SUCCESS(parser.parse("HelloGET /gslb/v1/versions HTTP/1.1\r\nHost: ossrs.net\r\nContent-Length: 5\r\n\r\nWorld"));
EXPECT_EQ(80, (int)parser.parsed);
EXPECT_EQ(0, parser.parser->nread);
EXPECT_EQ(0, (int)parser.parser->nread);
EXPECT_EQ(0, parser.parser->content_length);
}
@ -5863,7 +5863,7 @@ VOID TEST(ProtocolHTTPTest, HTTPParser)
// size = 73, nparsed = 73, nread = 0, content_length = 2, Header("Content-Length", 5)
HELPER_EXPECT_SUCCESS(parser.parse("GET /gslb/v1/versions HTTP/1.1\r\nHost: ossrs.net\r\nContent-Length: 5\r\n\r\nHel"));
EXPECT_EQ(73, (int)parser.parsed);
EXPECT_EQ(0, parser.parser->nread);
EXPECT_EQ(0, (int)parser.parser->nread);
EXPECT_EQ(2, parser.parser->content_length);
}
@ -5872,7 +5872,7 @@ VOID TEST(ProtocolHTTPTest, HTTPParser)
// size = 82, nparsed = 75, nread = 1, content_length = -1, Header("Content-Length", 5)
HELPER_EXPECT_FAILED(parser.parse("GET /gslb/v1/versions HTTP/1.1\r\nHost: ossrs.net\r\nContent-Length: 5\r\n\r\nHello World!"));
EXPECT_EQ(75, (int)parser.parsed);
EXPECT_EQ(1, parser.parser->nread);
EXPECT_EQ(1, (int)parser.parser->nread);
EXPECT_EQ(-1, (int64_t)parser.parser->content_length);
}
@ -5886,7 +5886,7 @@ VOID TEST(ProtocolHTTPTest, HTTPParser)
// size = 41, nparsed = 41, nread = 0
HELPER_EXPECT_SUCCESS(parser.parse("st: ossrs.net\r\nContent-Length: 5\r\n\r\nHello"));
EXPECT_EQ(41, (int)parser.parsed);
EXPECT_EQ(0, parser.parser->nread);
EXPECT_EQ(0, (int)parser.parser->nread);
}
if (true) {
@ -5899,7 +5899,7 @@ VOID TEST(ProtocolHTTPTest, HTTPParser)
// size = 34, nparsed = 34, nread = 0
HELPER_EXPECT_SUCCESS(parser.parse("rs.net\r\nContent-Length: 5\r\n\r\nHello"));
EXPECT_EQ(34, (int)parser.parsed);
EXPECT_EQ(0, parser.parser->nread);
EXPECT_EQ(0, (int)parser.parser->nread);
}
if (true) {
@ -5912,7 +5912,7 @@ VOID TEST(ProtocolHTTPTest, HTTPParser)
// size = 27, nparsed = 27, nread = 0
HELPER_EXPECT_SUCCESS(parser.parse("\nContent-Length: 5\r\n\r\nHello"));
EXPECT_EQ(27, (int)parser.parsed);
EXPECT_EQ(0, parser.parser->nread);
EXPECT_EQ(0, (int)parser.parser->nread);
}
if (true) {
@ -5925,7 +5925,7 @@ VOID TEST(ProtocolHTTPTest, HTTPParser)
// size = 7, nparsed = 7, nread = 0
HELPER_EXPECT_SUCCESS(parser.parse("\r\nHello"));
EXPECT_EQ(7, (int)parser.parsed);
EXPECT_EQ(0, parser.parser->nread);
EXPECT_EQ(0, (int)parser.parser->nread);
}
if (true) {
@ -5938,7 +5938,7 @@ VOID TEST(ProtocolHTTPTest, HTTPParser)
// size = 6, nparsed = 6, nread = 0
HELPER_EXPECT_SUCCESS(parser.parse("\nHello"));
EXPECT_EQ(6, (int)parser.parsed);
EXPECT_EQ(0, parser.parser->nread);
EXPECT_EQ(0, (int)parser.parser->nread);
}
if (true) {
@ -5946,7 +5946,7 @@ VOID TEST(ProtocolHTTPTest, HTTPParser)
// size = 75, nparsed = 75, nread = 0
HELPER_EXPECT_SUCCESS(parser.parse("GET /gslb/v1/versions HTTP/1.1\r\nHost: ossrs.net\r\nContent-Length: 5\r\n\r\nHello"));
EXPECT_EQ(75, (int)parser.parsed);
EXPECT_EQ(0, parser.parser->nread);
EXPECT_EQ(0, (int)parser.parser->nread);
}
if (true) {

@ -2495,7 +2495,7 @@ VOID TEST(ProtocolRTMPTest, CoverAll)
SrsCommonMessage* msg = NULL;
SrsAcknowledgementPacket* pkt = NULL;
HELPER_ASSERT_SUCCESS(r.expect_message(&msg, &pkt));
EXPECT_EQ(1024, pkt->sequence_number);
EXPECT_EQ(1024, (int)pkt->sequence_number);
srs_freep(msg); srs_freep(pkt);
}
}

Loading…
Cancel
Save