1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Merge SRS2 for running srs-librtmp on Windows. 3.0.80

This commit is contained in:
winlin 2019-12-23 21:09:00 +08:00
commit 40f6ecaee2
13 changed files with 110 additions and 38 deletions

View file

@ -1169,7 +1169,7 @@ void SrsAmf0StrictArray::append(SrsAmf0Any* any)
int SrsAmf0Size::utf8(string value)
{
return 2 + (int)value.length();
return (int)(2 + value.length());
}
int SrsAmf0Size::str(string value)
@ -1752,7 +1752,7 @@ namespace _srs_internal
if (!stream->require(2)) {
return srs_error_new(ERROR_RTMP_AMF0_ENCODE, "requires 2 only %d bytes", stream->left());
}
stream->write_2bytes(value.length());
stream->write_2bytes((int16_t)value.length());
// empty string
if (value.length() <= 0) {

View file

@ -194,7 +194,7 @@ srs_error_t SrsFastStream::grow(ISrsReader* reader, int required_size)
// we just move the ptr to next.
srs_assert((int)nread > 0);
end += nread;
nb_free_space -= nread;
nb_free_space -= (int)nread;
}
return err;

View file

@ -61,6 +61,7 @@ void srs_vhost_resolve(string& vhost, string& app, string& param)
app = srs_string_replace(app, ",", "?");
app = srs_string_replace(app, "...", "?");
app = srs_string_replace(app, "&&", "?");
app = srs_string_replace(app, "&", "?");
app = srs_string_replace(app, "=", "?");
if (srs_string_ends_with(app, "/_definst_")) {
@ -78,6 +79,11 @@ void srs_vhost_resolve(string& vhost, string& app, string& param)
}
}
}
// vhost with params.
if ((pos = vhost.find("?")) != std::string::npos) {
vhost = vhost.substr(0, pos);
}
/* others */
}

View file

@ -183,7 +183,7 @@ srs_error_t SrsRawH264Stream::mux_sequence_header(string sps, string pps, uint32
// numOfSequenceParameterSets, always 1
stream.write_1bytes(0x01);
// sequenceParameterSetLength
stream.write_2bytes(sps.length());
stream.write_2bytes((int16_t)sps.length());
// sequenceParameterSetNALUnit
stream.write_string(sps);
}
@ -194,7 +194,7 @@ srs_error_t SrsRawH264Stream::mux_sequence_header(string sps, string pps, uint32
// numOfPictureParameterSets, always 1
stream.write_1bytes(0x01);
// pictureParameterSetLength
stream.write_2bytes(pps.length());
stream.write_2bytes((int16_t)pps.length());
// pictureParameterSetNALUnit
stream.write_string(pps);
}

View file

@ -220,7 +220,8 @@ srs_error_t SrsPacket::encode_packet(SrsBuffer* stream)
SrsProtocol::AckWindowSize::AckWindowSize()
{
window = 0;
sequence_number = nb_recv_bytes = 0;
sequence_number = 0;
nb_recv_bytes = 0;
}
SrsProtocol::SrsProtocol(ISrsProtocolReadWriter* io)
@ -253,6 +254,8 @@ SrsProtocol::SrsProtocol(ISrsProtocolReadWriter* io)
cs_cache[cid] = cs;
}
out_c0c3_caches = new char[SRS_CONSTS_C0C3_HEADERS_MAX];
}
SrsProtocol::~SrsProtocol()
@ -291,6 +294,8 @@ SrsProtocol::~SrsProtocol()
srs_freep(cs);
}
srs_freepa(cs_cache);
srs_freepa(out_c0c3_caches);
}
void SrsProtocol::set_auto_response(bool v)
@ -2375,7 +2380,8 @@ srs_error_t SrsRtmpServer::response_connect_app(SrsRequest *req, const char* ser
srs_error_t err = srs_success;
SrsConnectAppResPacket* pkt = new SrsConnectAppResPacket();
// @remark For windows, there must be a space between const string and macro.
pkt->props->set("fmsVer", SrsAmf0Any::str("FMS/" RTMP_SIG_FMS_VER));
pkt->props->set("capabilities", SrsAmf0Any::number(127));
pkt->props->set("mode", SrsAmf0Any::number(1));

View file

@ -213,7 +213,8 @@ private:
// The c0c3 caches must use unit SRS_CONSTS_RTMP_MAX_FMT0_HEADER_SIZE bytes.
//
// @remark, the c0c3 cache cannot be realloc.
char out_c0c3_caches[SRS_CONSTS_C0C3_HEADERS_MAX];
// To allocate it in heap to make VS2015 happy.
char* out_c0c3_caches;
// Whether warned user to increase the c0c3 header cache.
bool warned_c0c3_cache_dry;
// The output chunk size, default to 128, set by config.