mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix #184, support AnnexB in RTMP body for HLS. 2.0.2
This commit is contained in:
parent
1f0f98ff04
commit
57e8356221
7 changed files with 291 additions and 120 deletions
|
@ -36,8 +36,9 @@ using namespace std;
|
|||
#include <srs_kernel_error.hpp>
|
||||
#include <srs_app_kbps.hpp>
|
||||
#include <srs_app_json.hpp>
|
||||
#include <srs_kernel_stream.hpp>
|
||||
|
||||
int srs_socket_connect(std::string server, int port, int64_t timeout, st_netfd_t* pstfd)
|
||||
int srs_socket_connect(string server, int port, int64_t timeout, st_netfd_t* pstfd)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -89,7 +90,7 @@ failed:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int srs_get_log_level(std::string level)
|
||||
int srs_get_log_level(string level)
|
||||
{
|
||||
if ("verbose" == level) {
|
||||
return SrsLogLevel::Verbose;
|
||||
|
@ -106,6 +107,35 @@ int srs_get_log_level(std::string level)
|
|||
}
|
||||
}
|
||||
|
||||
bool srs_avc_startswith_annexb(SrsStream* stream, int* pnb_start_code)
|
||||
{
|
||||
char* bytes = stream->data() + stream->pos();
|
||||
char* p = bytes;
|
||||
|
||||
for (;;) {
|
||||
if (!stream->require(p - bytes + 3)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// not match
|
||||
if (p[0] != 0x00 || p[1] != 0x00) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// match N[00] 00 00 01, where N>=0
|
||||
if (p[2] == 0x01) {
|
||||
if (pnb_start_code) {
|
||||
*pnb_start_code = (int)(p - bytes) + 3;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static SrsRusage _srs_system_rusage;
|
||||
|
||||
SrsRusage::SrsRusage()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue