mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refine code
This commit is contained in:
parent
92c8c0505d
commit
366d6bcb82
7 changed files with 41 additions and 12 deletions
|
@ -4326,6 +4326,9 @@ int SrsMp4Decoder::do_load_next_box(SrsMp4Box** ppbox, uint32_t required_box_typ
|
||||||
ret = box->decode(buffer);
|
ret = box->decode(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip the box from stream, move stream to next box.
|
||||||
|
// For mdat box, skip the content in stream or underylayer reader.
|
||||||
|
// For other boxes, skip it from stream because we already decoded it or ignore it.
|
||||||
if (ret == ERROR_SUCCESS) {
|
if (ret == ERROR_SUCCESS) {
|
||||||
ret = br->skip(box, stream);
|
ret = br->skip(box, stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,9 +203,9 @@ extern "C"{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve server ip from RTMP handler.
|
* Retrieve server ip from RTMP handler.
|
||||||
* @Param ip A NULL terminated string specifies the server ip.
|
* @param ip A NULL terminated string specifies the server ip.
|
||||||
* @Param pid An int specifies the PID of server. -1 is no PID information.
|
* @param pid An int specifies the PID of server. -1 is no PID information.
|
||||||
* @Param cid An int specifies the CID of connection. -1 is no CID information.
|
* @param cid An int specifies the CID of connection. -1 is no CID information.
|
||||||
* @remark For SRS, ip/pid/cid is the UUID of a client. For other server, these values maybe unknown.
|
* @remark For SRS, ip/pid/cid is the UUID of a client. For other server, these values maybe unknown.
|
||||||
* @remark When connected to server by srs_rtmp_connect_app, the information is ready to be retrieved.
|
* @remark When connected to server by srs_rtmp_connect_app, the information is ready to be retrieved.
|
||||||
* @return 0, success; otherswise, failed.
|
* @return 0, success; otherswise, failed.
|
||||||
|
@ -214,7 +214,7 @@ extern "C"{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve server signature from RTMP handler.
|
* Retrieve server signature from RTMP handler.
|
||||||
* @Param sig A NULL terminated string specifies the server signature.
|
* @param sig A NULL terminated string specifies the server signature.
|
||||||
* @remark When connected to server by srs_rtmp_connect_app, the information is ready to be retrieved.
|
* @remark When connected to server by srs_rtmp_connect_app, the information is ready to be retrieved.
|
||||||
* @return 0, success; otherswise, failed.
|
* @return 0, success; otherswise, failed.
|
||||||
*/
|
*/
|
||||||
|
@ -299,7 +299,7 @@ extern "C"{
|
||||||
* @return 0, success; otherswise, failed.
|
* @return 0, success; otherswise, failed.
|
||||||
*/
|
*/
|
||||||
extern int srs_rtmp_read_packet(srs_rtmp_t rtmp, char* type, uint32_t* timestamp, char** data, int* size);
|
extern int srs_rtmp_read_packet(srs_rtmp_t rtmp, char* type, uint32_t* timestamp, char** data, int* size);
|
||||||
// @Param data User should never free it anymore.
|
// @param data User should never free it anymore.
|
||||||
extern int srs_rtmp_write_packet(srs_rtmp_t rtmp, char type, uint32_t timestamp, char* data, int size);
|
extern int srs_rtmp_write_packet(srs_rtmp_t rtmp, char type, uint32_t timestamp, char* data, int size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -64,7 +64,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
// directly failed when compile limited.
|
// directly failed when compile limited.
|
||||||
#if defined(SRS_AUTO_GPERF_MP) || defined(SRS_AUTO_GPERF_MP) \
|
#if defined(SRS_AUTO_GPERF_MP) || defined(SRS_AUTO_GPERF_MP) \
|
||||||
|| defined(SRS_AUTO_GPERF_MC) || defined(SRS_AUTO_GPERF_MP)
|
|| defined(SRS_AUTO_GPERF_MC) || defined(SRS_AUTO_GPERF_MP)
|
||||||
srs_error("donot support gmc/gmp/gcp/gprof");
|
srs_error("donot support gmc/gmp/gcp/gprof");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,12 +26,37 @@
|
||||||
#include <srs_kernel_error.hpp>
|
#include <srs_kernel_error.hpp>
|
||||||
#include <srs_service_log.hpp>
|
#include <srs_service_log.hpp>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
// @global log and context.
|
// @global log and context.
|
||||||
ISrsLog* _srs_log = new SrsConsoleLog(SrsLogLevelTrace, false);
|
ISrsLog* _srs_log = new SrsConsoleLog(SrsLogLevelTrace, false);
|
||||||
ISrsThreadContext* _srs_context = new SrsThreadContext();
|
ISrsThreadContext* _srs_context = new SrsThreadContext();
|
||||||
|
|
||||||
|
void help(char** argv)
|
||||||
|
{
|
||||||
|
printf("Usage: %s <mp4_file>\n"
|
||||||
|
" mp4_file The MP4 file path to parse.\n"
|
||||||
|
"For example:\n"
|
||||||
|
" %s doc/source.200kbps.768x320.mp4\n",
|
||||||
|
argv[0], argv[0]);
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
printf("SRS MP4 parser/%d.%d.%d, show the mp4 boxes structure.\n",
|
||||||
|
VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION);
|
||||||
|
|
||||||
|
if (argc < 2) {
|
||||||
|
help(argv);
|
||||||
|
}
|
||||||
|
string mp4_file = argv[1];
|
||||||
|
srs_trace("Parse MP4 file %s", mp4_file.c_str());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2767,7 +2767,7 @@ int SrsRtmpServer::identify_client(int stream_id, SrsRtmpConnType& type, string&
|
||||||
}
|
}
|
||||||
|
|
||||||
// For encoder of Haivision, it always send a _checkbw call message.
|
// For encoder of Haivision, it always send a _checkbw call message.
|
||||||
// @Remark the next message is createStream, so we continue to identify it.
|
// @remark the next message is createStream, so we continue to identify it.
|
||||||
// @see https://github.com/ossrs/srs/issues/844
|
// @see https://github.com/ossrs/srs/issues/844
|
||||||
if (call->command_name == "_checkbw") {
|
if (call->command_name == "_checkbw") {
|
||||||
srs_info("Haivision encoder identified.");
|
srs_info("Haivision encoder identified.");
|
||||||
|
|
|
@ -726,8 +726,8 @@ public:
|
||||||
* @param app, The app to connect at, for example, live.
|
* @param app, The app to connect at, for example, live.
|
||||||
* @param tcUrl, The tcUrl to connect at, for example, rtmp://ossrs.net/live.
|
* @param tcUrl, The tcUrl to connect at, for example, rtmp://ossrs.net/live.
|
||||||
* @param req, the optional req object, use the swfUrl/pageUrl if specified. NULL to ignore.
|
* @param req, the optional req object, use the swfUrl/pageUrl if specified. NULL to ignore.
|
||||||
* @Param dsu, Whether debug SRS upnode. For edge, set to true to send its info to upnode.
|
* @param dsu, Whether debug SRS upnode. For edge, set to true to send its info to upnode.
|
||||||
* @Param si, The server information, retrieve from response of connect app request. NULL to ignore.
|
* @param si, The server information, retrieve from response of connect app request. NULL to ignore.
|
||||||
*/
|
*/
|
||||||
virtual int connect_app(std::string app, std::string tcUrl, SrsRequest* r, bool dsu, SrsServerInfo* si);
|
virtual int connect_app(std::string app, std::string tcUrl, SrsRequest* r, bool dsu, SrsServerInfo* si);
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -76,9 +76,10 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the log header.
|
* Generate the log header.
|
||||||
* @Param dangerous Whether log is warning or error, log the errno if true.
|
* @param dangerous Whether log is warning or error, log the errno if true.
|
||||||
* @Param utc Whether use UTC time format in the log header.
|
* @param utc Whether use UTC time format in the log header.
|
||||||
* @Param psize Output the actual header size.
|
* @param psize Output the actual header size.
|
||||||
|
* @remark It's a internal API.
|
||||||
*/
|
*/
|
||||||
bool srs_log_header(char* buffer, int size, bool utc, bool dangerous, const char* tag, int cid, const char* level, int* psize);
|
bool srs_log_header(char* buffer, int size, bool utc, bool dangerous, const char* tag, int cid, const char* level, int* psize);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue