Refine access specifier for utest.

This commit is contained in:
winlin 2025-10-13 22:26:38 -04:00
parent 31e191e9e3
commit bf7e93140b
105 changed files with 1069 additions and 1006 deletions

View File

@ -301,6 +301,58 @@ code_patterns:
exceptions: "Only applies to SRS-defined classes/structs - do NOT change 3rd party code like llhttp" exceptions: "Only applies to SRS-defined classes/structs - do NOT change 3rd party code like llhttp"
rationale: "Consistent naming convention across SRS codebase for better code readability and maintenance - underscore distinguishes member variables from local variables and parameters" rationale: "Consistent naming convention across SRS codebase for better code readability and maintenance - underscore distinguishes member variables from local variables and parameters"
access_specifiers_for_testing:
- pattern: "SRS_DECLARE_PRIVATE and SRS_DECLARE_PROTECTED macros"
description: "MANDATORY - Always use SRS_DECLARE_PRIVATE instead of 'private' and SRS_DECLARE_PROTECTED instead of 'protected' in class definitions"
purpose: "Enables unit tests to access private and protected members for dependency injection and mocking"
macro_definition: |
#ifdef SRS_FORCE_PUBLIC4UTEST
#define SRS_DECLARE_PRIVATE public
#define SRS_DECLARE_PROTECTED public
#else
#define SRS_DECLARE_PRIVATE private
#define SRS_DECLARE_PROTECTED protected
#endif
usage: |
WRONG: Using standard C++ access specifiers
class SrsBufferCache {
private:
ISrsAppConfig *config_;
ISrsRequest *req_;
protected:
virtual srs_error_t do_start();
public:
srs_error_t start();
};
CORRECT: Using SRS access specifier macros
class SrsBufferCache {
SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_;
ISrsRequest *req_;
SRS_DECLARE_PROTECTED:
virtual srs_error_t do_start();
public:
srs_error_t start();
};
rules:
- "ALWAYS use SRS_DECLARE_PRIVATE instead of 'private' keyword"
- "ALWAYS use SRS_DECLARE_PROTECTED instead of 'protected' keyword"
- "Use standard 'public' keyword for public members (no macro needed)"
- "This applies to ALL production code classes in trunk/src/"
- "When SRS_FORCE_PUBLIC4UTEST is defined, all private/protected members become public for testing"
benefits:
- "Enables unit tests to inject mock dependencies into private member fields"
- "Allows tests to access and verify internal state"
- "Makes classes fully testable without breaking encapsulation in production"
- "Provides clean separation between production and test builds"
rationale: "This pattern allows unit tests to access private/protected members for dependency injection and mocking, while maintaining proper encapsulation in production builds. It's essential for writing comprehensive unit tests that can mock all dependencies."
commenting_style: commenting_style:
- pattern: "C++ style comments" - pattern: "C++ style comments"
description: "MANDATORY - Use C++ style comments (//) instead of C style comments (/* */)" description: "MANDATORY - Use C++ style comments (//) instead of C style comments (/* */)"

View File

@ -53,10 +53,10 @@ public:
// That is, the task is execute/call in async mode. // That is, the task is execute/call in async mode.
class SrsAsyncCallWorker : public ISrsCoroutineHandler, public ISrsAsyncCallWorker class SrsAsyncCallWorker : public ISrsCoroutineHandler, public ISrsAsyncCallWorker
{ {
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
protected: SRS_DECLARE_PROTECTED:
std::vector<ISrsAsyncCallTask *> tasks_; std::vector<ISrsAsyncCallTask *> tasks_;
srs_cond_t wait_; srs_cond_t wait_;
srs_mutex_t lock_; srs_mutex_t lock_;
@ -76,7 +76,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual void flush_tasks(); virtual void flush_tasks();
}; };

View File

@ -49,10 +49,10 @@ public:
// A TCP listener, for flv stream server. // A TCP listener, for flv stream server.
class SrsHttpFlvListener : public ISrsHttpFlvListener class SrsHttpFlvListener : public ISrsHttpFlvListener
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
SrsTcpListener *listener_; SrsTcpListener *listener_;
ISrsAppCasterFlv *caster_; ISrsAppCasterFlv *caster_;
@ -83,10 +83,10 @@ public:
// The stream caster for flv stream over HTTP POST. // The stream caster for flv stream over HTTP POST.
class SrsAppCasterFlv : public ISrsAppCasterFlv class SrsAppCasterFlv : public ISrsAppCasterFlv
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
std::string output_; std::string output_;
SrsHttpServeMux *http_mux_; SrsHttpServeMux *http_mux_;
std::vector<ISrsConnection *> conns_; std::vector<ISrsConnection *> conns_;
@ -135,11 +135,11 @@ public:
// The dynamic http connection, never drop the body. // The dynamic http connection, never drop the body.
class SrsDynamicHttpConn : public ISrsDynamicHttpConn class SrsDynamicHttpConn : public ISrsDynamicHttpConn
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
// The manager object to manage the connection. // The manager object to manage the connection.
ISrsResourceManager *manager_; ISrsResourceManager *manager_;
std::string output_; std::string output_;
@ -148,7 +148,7 @@ private:
ISrsProtocolReadWriter *skt_; ISrsProtocolReadWriter *skt_;
ISrsHttpConn *conn_; ISrsHttpConn *conn_;
private: SRS_DECLARE_PRIVATE:
// The ip and port of client. // The ip and port of client.
std::string ip_; std::string ip_;
int port_; int port_;
@ -160,7 +160,7 @@ public:
public: public:
virtual srs_error_t proxy(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, std::string o); virtual srs_error_t proxy(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, std::string o);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_proxy(ISrsHttpResponseReader *rr, SrsFlvDecoder *dec); virtual srs_error_t do_proxy(ISrsHttpResponseReader *rr, SrsFlvDecoder *dec);
// Extract APIs from SrsTcpConnection. // Extract APIs from SrsTcpConnection.
// Interface ISrsHttpConnOwner. // Interface ISrsHttpConnOwner.
@ -194,7 +194,7 @@ public:
// The http wrapper for file reader, to read http post stream like a file. // The http wrapper for file reader, to read http post stream like a file.
class SrsHttpFileReader : public ISrsHttpFileReader class SrsHttpFileReader : public ISrsHttpFileReader
{ {
private: SRS_DECLARE_PRIVATE:
ISrsHttpResponseReader *http_; ISrsHttpResponseReader *http_;
SrsFileReader *file_reader_; SrsFileReader *file_reader_;

View File

@ -48,7 +48,7 @@ public:
class SrsCircuitBreaker : public ISrsCircuitBreaker, public ISrsFastTimerHandler class SrsCircuitBreaker : public ISrsCircuitBreaker, public ISrsFastTimerHandler
{ {
private: SRS_DECLARE_PRIVATE:
bool enabled_; bool enabled_;
int high_threshold_; int high_threshold_;
int high_pulse_; int high_pulse_;
@ -57,7 +57,7 @@ private:
int dying_threshold_; int dying_threshold_;
int dying_pulse_; int dying_pulse_;
private: SRS_DECLARE_PRIVATE:
int hybrid_high_water_level_; int hybrid_high_water_level_;
int hybrid_critical_water_level_; int hybrid_critical_water_level_;
int hybrid_dying_water_level_; int hybrid_dying_water_level_;
@ -74,7 +74,7 @@ public:
bool hybrid_critical_water_level(); bool hybrid_critical_water_level();
bool hybrid_dying_water_level(); bool hybrid_dying_water_level();
private: SRS_DECLARE_PRIVATE:
srs_error_t on_timer(srs_utime_t interval); srs_error_t on_timer(srs_utime_t interval);
}; };

View File

@ -65,7 +65,7 @@ namespace srs_internal
// The buffer of config content. // The buffer of config content.
class SrsConfigBuffer class SrsConfigBuffer
{ {
protected: SRS_DECLARE_PROTECTED:
// The last available position. // The last available position.
char *last_; char *last_;
// The end of buffer. // The end of buffer.
@ -228,7 +228,7 @@ public:
virtual SrsJsonAny *dumps_arg0_to_number(); virtual SrsJsonAny *dumps_arg0_to_number();
virtual SrsJsonAny *dumps_arg0_to_boolean(); virtual SrsJsonAny *dumps_arg0_to_boolean();
// private parse. // private parse.
private: SRS_DECLARE_PRIVATE:
// The directive parsing context. // The directive parsing context.
enum SrsDirectiveContext { enum SrsDirectiveContext {
// The root directives, parsing file. // The root directives, parsing file.
@ -603,7 +603,7 @@ class SrsConfig : public ISrsAppConfig
{ {
friend class SrsConfDirective; friend class SrsConfDirective;
// user command // user command
private: SRS_DECLARE_PRIVATE:
// Whether show help and exit. // Whether show help and exit.
bool show_help_; bool show_help_;
// Whether test config file and exit. // Whether test config file and exit.
@ -616,27 +616,27 @@ private:
// Set it by argv "-e" or env "SRS_ENV_ONLY=on". // Set it by argv "-e" or env "SRS_ENV_ONLY=on".
bool env_only_; bool env_only_;
// global env variables. // global env variables.
private: SRS_DECLARE_PRIVATE:
// The user parameters, the argc and argv. // The user parameters, the argc and argv.
// The argv is " ".join(argv), where argv is from main(argc, argv). // The argv is " ".join(argv), where argv is from main(argc, argv).
std::string argv_; std::string argv_;
// current working directory. // current working directory.
std::string cwd_; std::string cwd_;
// Config section // Config section
private: SRS_DECLARE_PRIVATE:
// The last parsed config file. // The last parsed config file.
// If reload, reload the config file. // If reload, reload the config file.
std::string config_file_; std::string config_file_;
protected: SRS_DECLARE_PROTECTED:
// The directive root. // The directive root.
SrsConfDirective *root_; SrsConfDirective *root_;
private: SRS_DECLARE_PRIVATE:
// The cache for parsing the config from environment variables. // The cache for parsing the config from environment variables.
SrsConfDirective *env_cache_; SrsConfDirective *env_cache_;
// Reload section // Reload section
private: SRS_DECLARE_PRIVATE:
// The reload subscribers, when reload, callback all handlers. // The reload subscribers, when reload, callback all handlers.
std::vector<ISrsReloadHandler *> subscribes_; std::vector<ISrsReloadHandler *> subscribes_;
@ -654,12 +654,12 @@ public:
// @remark, user can test the config before reload it. // @remark, user can test the config before reload it.
virtual srs_error_t reload(SrsReloadState *pstate); virtual srs_error_t reload(SrsReloadState *pstate);
protected: SRS_DECLARE_PROTECTED:
// Reload from the config. // Reload from the config.
// @remark, use protected for the utest to override with mock. // @remark, use protected for the utest to override with mock.
virtual srs_error_t reload_conf(SrsConfig *conf); virtual srs_error_t reload_conf(SrsConfig *conf);
private: SRS_DECLARE_PRIVATE:
// Parse options and file // Parse options and file
public: public:
// Parse the cli, the main(argc,argv) function. // Parse the cli, the main(argc,argv) function.
@ -670,19 +670,19 @@ public:
// Marshal current config to file. // Marshal current config to file.
virtual srs_error_t persistence(); virtual srs_error_t persistence();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_persistence(SrsFileWriter *fw); virtual srs_error_t do_persistence(SrsFileWriter *fw);
public: public:
// Dumps the http_api sections to json for raw api info. // Dumps the http_api sections to json for raw api info.
virtual srs_error_t raw_to_json(SrsJsonObject *obj); virtual srs_error_t raw_to_json(SrsJsonObject *obj);
private: SRS_DECLARE_PRIVATE:
public: public:
// Get the config file path. // Get the config file path.
virtual std::string config(); virtual std::string config();
private: SRS_DECLARE_PRIVATE:
// Parse each argv. // Parse each argv.
virtual srs_error_t parse_argv(int &i, char **argv); virtual srs_error_t parse_argv(int &i, char **argv);
// Print help and exit. // Print help and exit.
@ -692,7 +692,7 @@ public:
// Parse the config file, which is specified by cli. // Parse the config file, which is specified by cli.
virtual srs_error_t parse_file(const char *filename); virtual srs_error_t parse_file(const char *filename);
private: SRS_DECLARE_PRIVATE:
// Build a buffer from a src, which is string content or filename. // Build a buffer from a src, which is string content or filename.
virtual srs_error_t build_buffer(std::string src, srs_internal::SrsConfigBuffer **pbuffer); virtual srs_error_t build_buffer(std::string src, srs_internal::SrsConfigBuffer **pbuffer);
@ -700,11 +700,11 @@ public:
// Check the parsed config. // Check the parsed config.
virtual srs_error_t check_config(); virtual srs_error_t check_config();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t check_normal_config(); virtual srs_error_t check_normal_config();
virtual srs_error_t check_number_connections(); virtual srs_error_t check_number_connections();
protected: SRS_DECLARE_PROTECTED:
// Parse config from the buffer. // Parse config from the buffer.
// @param buffer, the config buffer, user must delete it. // @param buffer, the config buffer, user must delete it.
// @remark, use protected for the utest to override with mock. // @remark, use protected for the utest to override with mock.
@ -728,7 +728,7 @@ public:
// Whether srs in docker. // Whether srs in docker.
virtual bool get_in_docker(); virtual bool get_in_docker();
private: SRS_DECLARE_PRIVATE:
// Whether user use full.conf // Whether user use full.conf
virtual bool is_full_config(); virtual bool is_full_config();
@ -842,7 +842,7 @@ public:
virtual bool get_rtc_server_black_hole(); virtual bool get_rtc_server_black_hole();
virtual std::string get_rtc_server_black_hole_addr(); virtual std::string get_rtc_server_black_hole_addr();
private: SRS_DECLARE_PRIVATE:
virtual int get_rtc_server_reuseport2(); virtual int get_rtc_server_reuseport2();
public: public:
@ -972,7 +972,7 @@ public:
virtual srs_utime_t get_publish_kickoff_for_idle(std::string vhost); virtual srs_utime_t get_publish_kickoff_for_idle(std::string vhost);
virtual srs_utime_t get_publish_kickoff_for_idle(SrsConfDirective *vhost); virtual srs_utime_t get_publish_kickoff_for_idle(SrsConfDirective *vhost);
private: SRS_DECLARE_PRIVATE:
// Get the global chunk size. // Get the global chunk size.
virtual int get_global_chunk_size(); virtual int get_global_chunk_size();
// forward section // forward section
@ -1025,7 +1025,7 @@ public:
// Get the default streamid when client doesn't provide one. // Get the default streamid when client doesn't provide one.
virtual std::string get_srt_default_streamid(); virtual std::string get_srt_default_streamid();
private: SRS_DECLARE_PRIVATE:
SrsConfDirective *get_srt(std::string vhost); SrsConfDirective *get_srt(std::string vhost);
public: public:
@ -1034,7 +1034,7 @@ public:
bool get_srt_to_rtmp(std::string vhost); bool get_srt_to_rtmp(std::string vhost);
// http_hooks section // http_hooks section
private: SRS_DECLARE_PRIVATE:
// Get the http_hooks directive of vhost. // Get the http_hooks directive of vhost.
virtual SrsConfDirective *get_vhost_http_hooks(std::string vhost); virtual SrsConfDirective *get_vhost_http_hooks(std::string vhost);
@ -1182,7 +1182,7 @@ public:
// @remark, we will use some variable, for instance, [vhost] to substitude with vhost. // @remark, we will use some variable, for instance, [vhost] to substitude with vhost.
virtual std::string get_engine_output(SrsConfDirective *conf); virtual std::string get_engine_output(SrsConfDirective *conf);
// vhost exec secion // vhost exec secion
private: SRS_DECLARE_PRIVATE:
// Get the exec directive of vhost. // Get the exec directive of vhost.
virtual SrsConfDirective *get_exec(std::string vhost); virtual SrsConfDirective *get_exec(std::string vhost);
@ -1223,7 +1223,7 @@ public:
// The ffmpeg log level. // The ffmpeg log level.
virtual std::string get_ff_log_level(); virtual std::string get_ff_log_level();
// The MPEG-DASH section. // The MPEG-DASH section.
private: SRS_DECLARE_PRIVATE:
virtual SrsConfDirective *get_dash(std::string vhost); virtual SrsConfDirective *get_dash(std::string vhost);
public: public:
@ -1247,7 +1247,7 @@ public:
// The timeout in srs_utime_t to dispose the dash. // The timeout in srs_utime_t to dispose the dash.
virtual srs_utime_t get_dash_dispose(std::string vhost); virtual srs_utime_t get_dash_dispose(std::string vhost);
// hls section // hls section
private: SRS_DECLARE_PRIVATE:
// Get the hls directive of vhost. // Get the hls directive of vhost.
virtual SrsConfDirective *get_hls(std::string vhost); virtual SrsConfDirective *get_hls(std::string vhost);
@ -1316,7 +1316,7 @@ public:
// Old fragments are kept. Default is on. // Old fragments are kept. Default is on.
virtual bool get_hls_recover(std::string vhost); virtual bool get_hls_recover(std::string vhost);
// hds section // hds section
private: SRS_DECLARE_PRIVATE:
// Get the hds directive of vhost. // Get the hds directive of vhost.
virtual SrsConfDirective *get_hds(const std::string &vhost); virtual SrsConfDirective *get_hds(const std::string &vhost);
@ -1332,7 +1332,7 @@ public:
// a window is a set of hds fragments. // a window is a set of hds fragments.
virtual srs_utime_t get_hds_window(const std::string &vhost); virtual srs_utime_t get_hds_window(const std::string &vhost);
// dvr section // dvr section
private: SRS_DECLARE_PRIVATE:
// Get the dvr directive. // Get the dvr directive.
virtual SrsConfDirective *get_dvr(std::string vhost); virtual SrsConfDirective *get_dvr(std::string vhost);
@ -1354,7 +1354,7 @@ public:
// Get the time_jitter algorithm for dvr. // Get the time_jitter algorithm for dvr.
virtual int get_dvr_time_jitter(std::string vhost); virtual int get_dvr_time_jitter(std::string vhost);
// http api section // http api section
private: SRS_DECLARE_PRIVATE:
// Whether http api enabled // Whether http api enabled
virtual bool get_http_api_enabled(SrsConfDirective *conf); virtual bool get_http_api_enabled(SrsConfDirective *conf);
@ -1380,7 +1380,7 @@ public:
// Get the http api auth password. // Get the http api auth password.
virtual std::string get_http_api_auth_password(); virtual std::string get_http_api_auth_password();
// https api section // https api section
private: SRS_DECLARE_PRIVATE:
SrsConfDirective *get_https_api(); SrsConfDirective *get_https_api();
public: public:
@ -1389,7 +1389,7 @@ public:
virtual std::string get_https_api_ssl_key(); virtual std::string get_https_api_ssl_key();
virtual std::string get_https_api_ssl_cert(); virtual std::string get_https_api_ssl_cert();
// http stream section // http stream section
private: SRS_DECLARE_PRIVATE:
// Whether http stream enabled. // Whether http stream enabled.
virtual bool get_http_stream_enabled(SrsConfDirective *conf); virtual bool get_http_stream_enabled(SrsConfDirective *conf);
@ -1403,7 +1403,7 @@ public:
// Whether enable crossdomain for http static and stream server. // Whether enable crossdomain for http static and stream server.
virtual bool get_http_stream_crossdomain(); virtual bool get_http_stream_crossdomain();
// https api section // https api section
private: SRS_DECLARE_PRIVATE:
SrsConfDirective *get_https_stream(); SrsConfDirective *get_https_stream();
public: public:
@ -1413,7 +1413,7 @@ public:
virtual std::string get_https_stream_ssl_key(); virtual std::string get_https_stream_ssl_key();
virtual std::string get_https_stream_ssl_cert(); virtual std::string get_https_stream_ssl_cert();
// rtmps section // rtmps section
private: SRS_DECLARE_PRIVATE:
SrsConfDirective *get_rtmps(); SrsConfDirective *get_rtmps();
public: public:
@ -1450,7 +1450,7 @@ public:
// used to generate the flv stream mount path. // used to generate the flv stream mount path.
virtual std::string get_vhost_http_remux_mount(std::string vhost); virtual std::string get_vhost_http_remux_mount(std::string vhost);
// http heartbeat section // http heartbeat section
private: SRS_DECLARE_PRIVATE:
// Get the heartbeat directive. // Get the heartbeat directive.
virtual SrsConfDirective *get_heartbeat(); virtual SrsConfDirective *get_heartbeat();
@ -1467,7 +1467,7 @@ public:
virtual bool get_heartbeat_summaries(); virtual bool get_heartbeat_summaries();
bool get_heartbeat_ports(); bool get_heartbeat_ports();
// stats section // stats section
private: SRS_DECLARE_PRIVATE:
// Get the stats directive. // Get the stats directive.
virtual SrsConfDirective *get_stats(); virtual SrsConfDirective *get_stats();

View File

@ -19,13 +19,13 @@ class SrsLiveSource;
// For origin cluster. // For origin cluster.
class SrsCoWorkers class SrsCoWorkers
{ {
private: SRS_DECLARE_PRIVATE:
static SrsCoWorkers *instance_; static SrsCoWorkers *instance_;
private: SRS_DECLARE_PRIVATE:
std::map<std::string, ISrsRequest *> streams_; std::map<std::string, ISrsRequest *> streams_;
private: SRS_DECLARE_PRIVATE:
SrsCoWorkers(); SrsCoWorkers();
virtual ~SrsCoWorkers(); virtual ~SrsCoWorkers();
@ -35,7 +35,7 @@ public:
public: public:
virtual SrsJsonAny *dumps(std::string vhost, std::string coworker, std::string app, std::string stream); virtual SrsJsonAny *dumps(std::string vhost, std::string coworker, std::string app, std::string stream);
private: SRS_DECLARE_PRIVATE:
virtual ISrsRequest *find_stream_info(std::string vhost, std::string app, std::string stream); virtual ISrsRequest *find_stream_info(std::string vhost, std::string app, std::string stream);
public: public:

View File

@ -49,7 +49,7 @@ public:
// The init mp4 for FMP4. // The init mp4 for FMP4.
class SrsInitMp4 : public ISrsInitMp4 class SrsInitMp4 : public ISrsInitMp4
{ {
private: SRS_DECLARE_PRIVATE:
ISrsFileWriter *fw_; ISrsFileWriter *fw_;
ISrsMp4M2tsInitEncoder *init_; ISrsMp4M2tsInitEncoder *init_;
ISrsFragment *fragment_; ISrsFragment *fragment_;
@ -96,10 +96,10 @@ public:
// The FMP4(Fragmented MP4) for DASH streaming. // The FMP4(Fragmented MP4) for DASH streaming.
class SrsFragmentedMp4 : public ISrsFragmentedMp4 class SrsFragmentedMp4 : public ISrsFragmentedMp4
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
ISrsFileWriter *fw_; ISrsFileWriter *fw_;
ISrsMp4M2tsSegmentEncoder *enc_; ISrsMp4M2tsSegmentEncoder *enc_;
ISrsFragment *fragment_; ISrsFragment *fragment_;
@ -160,14 +160,14 @@ public:
// The writer to write MPD for DASH. // The writer to write MPD for DASH.
class SrsMpdWriter : public ISrsMpdWriter class SrsMpdWriter : public ISrsMpdWriter
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
private: SRS_DECLARE_PRIVATE:
// The duration of fragment in srs_utime_t. // The duration of fragment in srs_utime_t.
srs_utime_t fragment_; srs_utime_t fragment_;
// The period to update the mpd in srs_utime_t. // The period to update the mpd in srs_utime_t.
@ -187,7 +187,7 @@ private:
// The number of current audio segment. // The number of current audio segment.
uint64_t audio_number_; uint64_t audio_number_;
private: SRS_DECLARE_PRIVATE:
// The home for fragment, relative to home. // The home for fragment, relative to home.
std::string fragment_home_; std::string fragment_home_;
@ -235,16 +235,16 @@ public:
// The controller for DASH, control the MPD and FMP4 generating system. // The controller for DASH, control the MPD and FMP4 generating system.
class SrsDashController : public ISrsDashController class SrsDashController : public ISrsDashController
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
SrsFormat *format_; SrsFormat *format_;
ISrsMpdWriter *mpd_; ISrsMpdWriter *mpd_;
private: SRS_DECLARE_PRIVATE:
ISrsFragmentedMp4 *vcurrent_; ISrsFragmentedMp4 *vcurrent_;
ISrsFragmentWindow *vfragments_; ISrsFragmentWindow *vfragments_;
ISrsFragmentedMp4 *acurrent_; ISrsFragmentedMp4 *acurrent_;
@ -258,11 +258,11 @@ private:
// Had the video reaped, use to align audio/video segment's timestamp. // Had the video reaped, use to align audio/video segment's timestamp.
bool video_reaped_; bool video_reaped_;
private: SRS_DECLARE_PRIVATE:
// The fragment duration in srs_utime_t to reap it. // The fragment duration in srs_utime_t to reap it.
srs_utime_t fragment_; srs_utime_t fragment_;
private: SRS_DECLARE_PRIVATE:
std::string home_; std::string home_;
int video_track_id_; int video_track_id_;
int audio_track_id_; int audio_track_id_;
@ -281,7 +281,7 @@ public:
virtual srs_error_t on_audio(SrsMediaPacket *shared_audio, SrsFormat *format); virtual srs_error_t on_audio(SrsMediaPacket *shared_audio, SrsFormat *format);
virtual srs_error_t on_video(SrsMediaPacket *shared_video, SrsFormat *format); virtual srs_error_t on_video(SrsMediaPacket *shared_video, SrsFormat *format);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t refresh_mpd(SrsFormat *format); virtual srs_error_t refresh_mpd(SrsFormat *format);
virtual srs_error_t refresh_init_mp4(SrsMediaPacket *msg, SrsFormat *format); virtual srs_error_t refresh_init_mp4(SrsMediaPacket *msg, SrsFormat *format);
}; };
@ -309,15 +309,15 @@ public:
// The MPEG-DASH encoder, transmux RTMP to DASH. // The MPEG-DASH encoder, transmux RTMP to DASH.
class SrsDash : public ISrsDash class SrsDash : public ISrsDash
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
bool enabled_; bool enabled_;
bool disposable_; bool disposable_;
srs_utime_t last_update_time_; srs_utime_t last_update_time_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
ISrsOriginHub *hub_; ISrsOriginHub *hub_;
ISrsDashController *controller_; ISrsDashController *controller_;

View File

@ -60,10 +60,10 @@ public:
// The segmenter for DVR, to write a segment file in flv/mp4. // The segmenter for DVR, to write a segment file in flv/mp4.
class SrsDvrSegmenter : public ISrsReloadHandler, public ISrsDvrSegmenter class SrsDvrSegmenter : public ISrsReloadHandler, public ISrsDvrSegmenter
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
protected: SRS_DECLARE_PROTECTED:
// The underlayer file object. // The underlayer file object.
ISrsFileWriter *fs_; ISrsFileWriter *fs_;
// Whether wait keyframe to reap segment. // Whether wait keyframe to reap segment.
@ -71,11 +71,11 @@ protected:
// The FLV/MP4 fragment file. // The FLV/MP4 fragment file.
SrsFragment *fragment_; SrsFragment *fragment_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
ISrsDvrPlan *plan_; ISrsDvrPlan *plan_;
private: SRS_DECLARE_PRIVATE:
SrsRtmpJitter *jitter_; SrsRtmpJitter *jitter_;
SrsRtmpJitterAlgorithm jitter_algorithm_; SrsRtmpJitterAlgorithm jitter_algorithm_;
@ -109,14 +109,14 @@ public:
// @remark ignore when already closed. // @remark ignore when already closed.
virtual srs_error_t close(); virtual srs_error_t close();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t open_encoder() = 0; virtual srs_error_t open_encoder() = 0;
virtual srs_error_t encode_metadata(SrsMediaPacket *metadata) = 0; virtual srs_error_t encode_metadata(SrsMediaPacket *metadata) = 0;
virtual srs_error_t encode_audio(SrsMediaPacket *audio, SrsFormat *format) = 0; virtual srs_error_t encode_audio(SrsMediaPacket *audio, SrsFormat *format) = 0;
virtual srs_error_t encode_video(SrsMediaPacket *video, SrsFormat *format) = 0; virtual srs_error_t encode_video(SrsMediaPacket *video, SrsFormat *format) = 0;
virtual srs_error_t close_encoder() = 0; virtual srs_error_t close_encoder() = 0;
private: SRS_DECLARE_PRIVATE:
// Generate the flv segment path. // Generate the flv segment path.
virtual std::string generate_path(); virtual std::string generate_path();
// When update the duration of segment by rtmp msg. // When update the duration of segment by rtmp msg.
@ -126,14 +126,14 @@ private:
// The FLV segmenter to use FLV encoder to write file. // The FLV segmenter to use FLV encoder to write file.
class SrsDvrFlvSegmenter : public SrsDvrSegmenter class SrsDvrFlvSegmenter : public SrsDvrSegmenter
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
// The FLV encoder, for FLV target. // The FLV encoder, for FLV target.
ISrsFlvTransmuxer *enc_; ISrsFlvTransmuxer *enc_;
private: SRS_DECLARE_PRIVATE:
// The offset of file for duration value. // The offset of file for duration value.
// The next 8 bytes is the double value. // The next 8 bytes is the double value.
int64_t duration_offset_; int64_t duration_offset_;
@ -150,7 +150,7 @@ public:
public: public:
virtual srs_error_t refresh_metadata(); virtual srs_error_t refresh_metadata();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t open_encoder(); virtual srs_error_t open_encoder();
virtual srs_error_t encode_metadata(SrsMediaPacket *metadata); virtual srs_error_t encode_metadata(SrsMediaPacket *metadata);
virtual srs_error_t encode_audio(SrsMediaPacket *audio, SrsFormat *format); virtual srs_error_t encode_audio(SrsMediaPacket *audio, SrsFormat *format);
@ -161,10 +161,10 @@ protected:
// The MP4 segmenter to use MP4 encoder to write file. // The MP4 segmenter to use MP4 encoder to write file.
class SrsDvrMp4Segmenter : public SrsDvrSegmenter class SrsDvrMp4Segmenter : public SrsDvrSegmenter
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
// The MP4 encoder, for MP4 target. // The MP4 encoder, for MP4 target.
ISrsMp4Encoder *enc_; ISrsMp4Encoder *enc_;
@ -175,7 +175,7 @@ public:
public: public:
virtual srs_error_t refresh_metadata(); virtual srs_error_t refresh_metadata();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t open_encoder(); virtual srs_error_t open_encoder();
virtual srs_error_t encode_metadata(SrsMediaPacket *metadata); virtual srs_error_t encode_metadata(SrsMediaPacket *metadata);
virtual srs_error_t encode_audio(SrsMediaPacket *audio, SrsFormat *format); virtual srs_error_t encode_audio(SrsMediaPacket *audio, SrsFormat *format);
@ -186,11 +186,11 @@ protected:
// the dvr async call. // the dvr async call.
class SrsDvrAsyncCallOnDvr : public ISrsAsyncCallTask class SrsDvrAsyncCallOnDvr : public ISrsAsyncCallTask
{ {
private: SRS_DECLARE_PRIVATE:
ISrsHttpHooks *hooks_; ISrsHttpHooks *hooks_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
SrsContextId cid_; SrsContextId cid_;
std::string path_; std::string path_;
ISrsRequest *req_; ISrsRequest *req_;
@ -224,14 +224,14 @@ public:
// The DVR plan, when and how to reap segment. // The DVR plan, when and how to reap segment.
class SrsDvrPlan : public ISrsReloadHandler, public ISrsDvrPlan class SrsDvrPlan : public ISrsReloadHandler, public ISrsDvrPlan
{ {
protected: SRS_DECLARE_PROTECTED:
ISrsAsyncCallWorker *async_; ISrsAsyncCallWorker *async_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
public: public:
ISrsRequest *req_; ISrsRequest *req_;
protected: SRS_DECLARE_PROTECTED:
ISrsOriginHub *hub_; ISrsOriginHub *hub_;
ISrsDvrSegmenter *segment_; ISrsDvrSegmenter *segment_;
bool dvr_enabled_; bool dvr_enabled_;
@ -271,7 +271,7 @@ public:
// The DVR segment plan: reap flv when duration exceed. // The DVR segment plan: reap flv when duration exceed.
class SrsDvrSegmentPlan : public SrsDvrPlan class SrsDvrSegmentPlan : public SrsDvrPlan
{ {
private: SRS_DECLARE_PRIVATE:
// in config, in srs_utime_t // in config, in srs_utime_t
srs_utime_t cduration_; srs_utime_t cduration_;
bool wait_keyframe_; bool wait_keyframe_;
@ -289,7 +289,7 @@ public:
virtual srs_error_t on_audio(SrsMediaPacket *shared_audio, SrsFormat *format); virtual srs_error_t on_audio(SrsMediaPacket *shared_audio, SrsFormat *format);
virtual srs_error_t on_video(SrsMediaPacket *shared_video, SrsFormat *format); virtual srs_error_t on_video(SrsMediaPacket *shared_video, SrsFormat *format);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t update_duration(SrsMediaPacket *msg); virtual srs_error_t update_duration(SrsMediaPacket *msg);
}; };
@ -313,16 +313,16 @@ public:
// DVR(Digital Video Recorder) to record RTMP stream to flv/mp4 file. // DVR(Digital Video Recorder) to record RTMP stream to flv/mp4 file.
class SrsDvr : public ISrsReloadHandler, public ISrsDvr class SrsDvr : public ISrsReloadHandler, public ISrsDvr
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
ISrsOriginHub *hub_; ISrsOriginHub *hub_;
ISrsDvrPlan *plan_; ISrsDvrPlan *plan_;
ISrsRequest *req_; ISrsRequest *req_;
private: SRS_DECLARE_PRIVATE:
// whether the dvr is actived by filter, which is specified by dvr_apply. // whether the dvr is actived by filter, which is specified by dvr_apply.
// we always initialize the dvr, which crote plan and segment object, // we always initialize the dvr, which crote plan and segment object,
// but they never create actual piece of file util the apply active it. // but they never create actual piece of file util the apply active it.

View File

@ -87,17 +87,17 @@ public:
// The RTMP upstream of edge. // The RTMP upstream of edge.
class SrsEdgeRtmpUpstream : public ISrsEdgeUpstream class SrsEdgeRtmpUpstream : public ISrsEdgeUpstream
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
// For RTMP 302, if not empty, // For RTMP 302, if not empty,
// use this <ip[:port]> as upstream. // use this <ip[:port]> as upstream.
std::string redirect_; std::string redirect_;
ISrsBasicRtmpClient *sdk_; ISrsBasicRtmpClient *sdk_;
private: SRS_DECLARE_PRIVATE:
// Current selected server, the ip:port. // Current selected server, the ip:port.
std::string selected_ip_; std::string selected_ip_;
int selected_port_; int selected_port_;
@ -122,20 +122,20 @@ public:
// The HTTP FLV upstream of edge. // The HTTP FLV upstream of edge.
class SrsEdgeFlvUpstream : public ISrsEdgeUpstream class SrsEdgeFlvUpstream : public ISrsEdgeUpstream
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
std::string schema_; std::string schema_;
ISrsHttpClient *sdk_; ISrsHttpClient *sdk_;
ISrsHttpMessage *hr_; ISrsHttpMessage *hr_;
private: SRS_DECLARE_PRIVATE:
ISrsFileReader *reader_; ISrsFileReader *reader_;
ISrsFlvDecoder *decoder_; ISrsFlvDecoder *decoder_;
private: SRS_DECLARE_PRIVATE:
// We might modify the request by HTTP redirect. // We might modify the request by HTTP redirect.
ISrsRequest *req_; ISrsRequest *req_;
// Current selected server, the ip:port. // Current selected server, the ip:port.
@ -149,7 +149,7 @@ public:
public: public:
virtual srs_error_t connect(ISrsRequest *r, ISrsLbRoundRobin *lb); virtual srs_error_t connect(ISrsRequest *r, ISrsLbRoundRobin *lb);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_connect(ISrsRequest *r, ISrsLbRoundRobin *lb, int redirect_depth); virtual srs_error_t do_connect(ISrsRequest *r, ISrsLbRoundRobin *lb, int redirect_depth);
public: public:
@ -182,14 +182,14 @@ public:
// The edge used to ingest stream from origin. // The edge used to ingest stream from origin.
class SrsEdgeIngester : public ISrsCoroutineHandler, public ISrsEdgeIngester class SrsEdgeIngester : public ISrsCoroutineHandler, public ISrsEdgeIngester
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
// Because source references to this object, so we should directly use the source ptr. // Because source references to this object, so we should directly use the source ptr.
ISrsLiveSource *source_; ISrsLiveSource *source_;
private: SRS_DECLARE_PRIVATE:
ISrsPlayEdge *edge_; ISrsPlayEdge *edge_;
ISrsRequest *req_; ISrsRequest *req_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
@ -209,10 +209,10 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t ingest(std::string &redirect); virtual srs_error_t ingest(std::string &redirect);
virtual srs_error_t process_publish_message(SrsRtmpCommonMessage *msg, std::string &redirect); virtual srs_error_t process_publish_message(SrsRtmpCommonMessage *msg, std::string &redirect);
}; };
@ -240,14 +240,14 @@ public:
// The edge used to forward stream to origin. // The edge used to forward stream to origin.
class SrsEdgeForwarder : public ISrsCoroutineHandler, public ISrsEdgeForwarder class SrsEdgeForwarder : public ISrsCoroutineHandler, public ISrsEdgeForwarder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
// Because source references to this object, so we should directly use the source ptr. // Because source references to this object, so we should directly use the source ptr.
ISrsLiveSource *source_; ISrsLiveSource *source_;
private: SRS_DECLARE_PRIVATE:
ISrsPublishEdge *edge_; ISrsPublishEdge *edge_;
ISrsRequest *req_; ISrsRequest *req_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
@ -276,7 +276,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
public: public:
@ -298,7 +298,7 @@ public:
// The play edge control service. // The play edge control service.
class SrsPlayEdge : public ISrsPlayEdge class SrsPlayEdge : public ISrsPlayEdge
{ {
private: SRS_DECLARE_PRIVATE:
SrsEdgeState state_; SrsEdgeState state_;
ISrsEdgeIngester *ingester_; ISrsEdgeIngester *ingester_;
@ -334,7 +334,7 @@ public:
// The publish edge control service. // The publish edge control service.
class SrsPublishEdge : public ISrsPublishEdge class SrsPublishEdge : public ISrsPublishEdge
{ {
private: SRS_DECLARE_PRIVATE:
SrsEdgeState state_; SrsEdgeState state_;
ISrsEdgeForwarder *forwarder_; ISrsEdgeForwarder *forwarder_;

View File

@ -38,11 +38,11 @@ public:
// ffmpegs to transcode the specified stream. // ffmpegs to transcode the specified stream.
class SrsEncoder : public ISrsCoroutineHandler, public ISrsMediaEncoder class SrsEncoder : public ISrsCoroutineHandler, public ISrsMediaEncoder
{ {
private: SRS_DECLARE_PRIVATE:
std::string input_stream_name_; std::string input_stream_name_;
std::vector<SrsFFMPEG *> ffmpegs_; std::vector<SrsFFMPEG *> ffmpegs_;
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
SrsPithyPrint *pprint_; SrsPithyPrint *pprint_;
@ -57,10 +57,10 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
private: SRS_DECLARE_PRIVATE:
virtual void clear_engines(); virtual void clear_engines();
virtual SrsFFMPEG *at(int index); virtual SrsFFMPEG *at(int index);
virtual srs_error_t parse_scope_engines(ISrsRequest *req); virtual srs_error_t parse_scope_engines(ISrsRequest *req);

View File

@ -86,7 +86,7 @@ public:
// The factory to create app objects. // The factory to create app objects.
class SrsAppFactory : public ISrsAppFactory class SrsAppFactory : public ISrsAppFactory
{ {
private: SRS_DECLARE_PRIVATE:
ISrsKernelFactory *kernel_factory_; ISrsKernelFactory *kernel_factory_;
public: public:

View File

@ -51,17 +51,17 @@ public:
// A transcode engine: ffmepg, used to transcode a stream to another. // A transcode engine: ffmepg, used to transcode a stream to another.
class SrsFFMPEG : public ISrsFFMPEG class SrsFFMPEG : public ISrsFFMPEG
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
ISrsProcess *process_; ISrsProcess *process_;
std::vector<std::string> params_; std::vector<std::string> params_;
private: SRS_DECLARE_PRIVATE:
std::string log_file_; std::string log_file_;
private: SRS_DECLARE_PRIVATE:
std::string ffmpeg_; std::string ffmpeg_;
std::vector<std::string> iparams_; std::vector<std::string> iparams_;
std::vector<std::string> perfile_; std::vector<std::string> perfile_;

View File

@ -45,19 +45,19 @@ public:
// Forward the stream to other servers. // Forward the stream to other servers.
class SrsForwarder : public ISrsCoroutineHandler, public ISrsForwarder class SrsForwarder : public ISrsCoroutineHandler, public ISrsForwarder
{ {
private: SRS_DECLARE_PRIVATE:
// The ep to forward, server[:port]. // The ep to forward, server[:port].
std::string ep_forward_; std::string ep_forward_;
ISrsRequest *req_; ISrsRequest *req_;
private: SRS_DECLARE_PRIVATE:
// The source or stream context id to bind to. // The source or stream context id to bind to.
SrsContextId source_cid_; SrsContextId source_cid_;
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
private: SRS_DECLARE_PRIVATE:
SrsOriginHub *hub_; SrsOriginHub *hub_;
SrsSimpleRtmpClient *sdk_; SrsSimpleRtmpClient *sdk_;
SrsRtmpJitter *jitter_; SrsRtmpJitter *jitter_;
@ -90,10 +90,10 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t forward(); virtual srs_error_t forward();
}; };

View File

@ -51,7 +51,7 @@ public:
// It's a media file, for example FLV or MP4, with duration. // It's a media file, for example FLV or MP4, with duration.
class SrsFragment : public ISrsFragment class SrsFragment : public ISrsFragment
{ {
private: SRS_DECLARE_PRIVATE:
// The duration in srs_utime_t. // The duration in srs_utime_t.
srs_utime_t dur_; srs_utime_t dur_;
// The full file path of fragment. // The full file path of fragment.
@ -132,7 +132,7 @@ public:
// The fragment window manage a series of fragment. // The fragment window manage a series of fragment.
class SrsFragmentWindow : public ISrsFragmentWindow class SrsFragmentWindow : public ISrsFragmentWindow
{ {
private: SRS_DECLARE_PRIVATE:
std::vector<ISrsFragment *> fragments_; std::vector<ISrsFragment *> fragments_;
// The expired fragments, need to be free in future. // The expired fragments, need to be free in future.
std::vector<ISrsFragment *> expired_fragments_; std::vector<ISrsFragment *> expired_fragments_;

View File

@ -91,12 +91,12 @@ std::string srs_gb_state(SrsGbSessionState ostate, SrsGbSessionState state);
// {"port":9000, "is_tcp": true} // {"port":9000, "is_tcp": true}
class SrsGoApiGbPublish : public ISrsHttpHandler class SrsGoApiGbPublish : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsResourceManager *gb_manager_; ISrsResourceManager *gb_manager_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
SrsConfDirective *conf_; SrsConfDirective *conf_;
public: public:
@ -106,7 +106,7 @@ public:
public: public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsJsonObject *res); virtual srs_error_t do_serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsJsonObject *res);
srs_error_t bind_session(std::string stream, uint64_t ssrc); srs_error_t bind_session(std::string stream, uint64_t ssrc);
}; };
@ -139,26 +139,26 @@ public:
// media objects use directly pointer to session, while session use shared ptr. // media objects use directly pointer to session, while session use shared ptr.
class SrsGbSession : public ISrsGbSession class SrsGbSession : public ISrsGbSession
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
SrsContextId cid_; SrsContextId cid_;
private: SRS_DECLARE_PRIVATE:
// The shared resource which own this object, we should never free it because it's managed by shared ptr. // The shared resource which own this object, we should never free it because it's managed by shared ptr.
SrsSharedResource<ISrsGbSession> *wrapper_; SrsSharedResource<ISrsGbSession> *wrapper_;
// The owner coroutine, allow user to interrupt the loop. // The owner coroutine, allow user to interrupt the loop.
ISrsInterruptable *owner_coroutine_; ISrsInterruptable *owner_coroutine_;
ISrsContextIdSetter *owner_cid_; ISrsContextIdSetter *owner_cid_;
private: SRS_DECLARE_PRIVATE:
SrsGbSessionState state_; SrsGbSessionState state_;
SrsSharedResource<ISrsGbMediaTcpConn> media_; SrsSharedResource<ISrsGbMediaTcpConn> media_;
ISrsGbMuxer *muxer_; ISrsGbMuxer *muxer_;
private: SRS_DECLARE_PRIVATE:
// When wait for media connecting, timeout if exceed. // When wait for media connecting, timeout if exceed.
srs_utime_t connecting_starttime_; srs_utime_t connecting_starttime_;
// The time we enter reinviting state. // The time we enter reinviting state.
@ -166,7 +166,7 @@ private:
// The number of timeout, dispose session if exceed. // The number of timeout, dispose session if exceed.
uint32_t nn_timeout_; uint32_t nn_timeout_;
private: SRS_DECLARE_PRIVATE:
SrsAlonePithyPrint *ppp_; SrsAlonePithyPrint *ppp_;
srs_utime_t startime_; srs_utime_t startime_;
uint64_t total_packs_; uint64_t total_packs_;
@ -175,7 +175,7 @@ private:
uint64_t total_msgs_dropped_; uint64_t total_msgs_dropped_;
uint64_t total_reserved_; uint64_t total_reserved_;
private: SRS_DECLARE_PRIVATE:
uint32_t media_id_; uint32_t media_id_;
srs_utime_t media_starttime_; srs_utime_t media_starttime_;
uint64_t media_msgs_; uint64_t media_msgs_;
@ -213,11 +213,11 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
srs_error_t drive_state(); srs_error_t drive_state();
private: SRS_DECLARE_PRIVATE:
SrsGbSessionState set_state(SrsGbSessionState v); SrsGbSessionState set_state(SrsGbSessionState v);
// Interface ISrsResource // Interface ISrsResource
public: public:
@ -238,13 +238,13 @@ public:
// The Media listener for GB. // The Media listener for GB.
class SrsGbListener : public ISrsGbListener, public ISrsTcpHandler class SrsGbListener : public ISrsGbListener, public ISrsTcpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsApiServerOwner *api_server_owner_; ISrsApiServerOwner *api_server_owner_;
ISrsResourceManager *gb_manager_; ISrsResourceManager *gb_manager_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
SrsConfDirective *conf_; SrsConfDirective *conf_;
ISrsIpListener *media_listener_; ISrsIpListener *media_listener_;
@ -260,7 +260,7 @@ public:
public: public:
virtual srs_error_t on_tcp_client(ISrsListener *listener, srs_netfd_t stfd); virtual srs_error_t on_tcp_client(ISrsListener *listener, srs_netfd_t stfd);
private: SRS_DECLARE_PRIVATE:
srs_error_t listen_api(); srs_error_t listen_api();
}; };
@ -301,16 +301,16 @@ public:
class SrsGbMediaTcpConn : public ISrsGbMediaTcpConn, // It's a resource, coroutine handler, and executor handler. class SrsGbMediaTcpConn : public ISrsGbMediaTcpConn, // It's a resource, coroutine handler, and executor handler.
public ISrsPsPackHandler public ISrsPsPackHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsResourceManager *gb_manager_; ISrsResourceManager *gb_manager_;
private: SRS_DECLARE_PRIVATE:
bool connected_; bool connected_;
// The owner session object, note that we use the raw pointer and should never free it. // The owner session object, note that we use the raw pointer and should never free it.
ISrsGbSession *session_; ISrsGbSession *session_;
uint32_t nn_rtcp_; uint32_t nn_rtcp_;
private: SRS_DECLARE_PRIVATE:
// The shared resource which own this object, we should never free it because it's managed by shared ptr. // The shared resource which own this object, we should never free it because it's managed by shared ptr.
SrsSharedResource<ISrsGbMediaTcpConn> *wrapper_; SrsSharedResource<ISrsGbMediaTcpConn> *wrapper_;
// The owner coroutine, allow user to interrupt the loop. // The owner coroutine, allow user to interrupt the loop.
@ -318,7 +318,7 @@ private:
ISrsContextIdSetter *owner_cid_; ISrsContextIdSetter *owner_cid_;
SrsContextId cid_; SrsContextId cid_;
private: SRS_DECLARE_PRIVATE:
ISrsPackContext *pack_; ISrsPackContext *pack_;
ISrsProtocolReadWriter *conn_; ISrsProtocolReadWriter *conn_;
uint8_t *buffer_; uint8_t *buffer_;
@ -351,13 +351,13 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
// Interface ISrsPsPackHandler // Interface ISrsPsPackHandler
public: public:
virtual srs_error_t on_ps_pack(SrsPsPacket *ps, const std::vector<SrsTsMessage *> &msgs); virtual srs_error_t on_ps_pack(SrsPsPacket *ps, const std::vector<SrsTsMessage *> &msgs);
private: SRS_DECLARE_PRIVATE:
// Create session if no one, or bind to an existed session. // Create session if no one, or bind to an existed session.
srs_error_t bind_session(uint32_t ssrc, ISrsGbSession **psession); srs_error_t bind_session(uint32_t ssrc, ISrsGbSession **psession);
}; };
@ -379,7 +379,7 @@ public:
// we must recalc the timestamp. // we must recalc the timestamp.
class SrsMpegpsQueue : public ISrsMpegpsQueue class SrsMpegpsQueue : public ISrsMpegpsQueue
{ {
private: SRS_DECLARE_PRIVATE:
// The key: dts, value: msg. // The key: dts, value: msg.
std::map<int64_t, SrsMediaPacket *> msgs_; std::map<int64_t, SrsMediaPacket *> msgs_;
int nb_audios_; int nb_audios_;
@ -409,16 +409,16 @@ public:
// Mux GB28181 to RTMP. // Mux GB28181 to RTMP.
class SrsGbMuxer : public ISrsGbMuxer class SrsGbMuxer : public ISrsGbMuxer
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
// The owner session object, note that we use the raw pointer and should never free it. // The owner session object, note that we use the raw pointer and should never free it.
ISrsGbSession *session_; ISrsGbSession *session_;
std::string output_; std::string output_;
ISrsBasicRtmpClient *sdk_; ISrsBasicRtmpClient *sdk_;
private: SRS_DECLARE_PRIVATE:
ISrsRawH264Stream *avc_; ISrsRawH264Stream *avc_;
std::string h264_sps_; std::string h264_sps_;
bool h264_sps_changed_; bool h264_sps_changed_;
@ -433,11 +433,11 @@ private:
std::string h265_pps_; std::string h265_pps_;
bool vps_sps_pps_sent_; bool vps_sps_pps_sent_;
private: SRS_DECLARE_PRIVATE:
ISrsRawAacStream *aac_; ISrsRawAacStream *aac_;
std::string aac_specific_config_; std::string aac_specific_config_;
private: SRS_DECLARE_PRIVATE:
ISrsMpegpsQueue *queue_; ISrsMpegpsQueue *queue_;
ISrsPithyPrint *pprint_; ISrsPithyPrint *pprint_;
@ -449,7 +449,7 @@ public:
void setup(std::string output); void setup(std::string output);
srs_error_t on_ts_message(SrsTsMessage *msg); srs_error_t on_ts_message(SrsTsMessage *msg);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t on_ts_video(SrsTsMessage *msg, SrsBuffer *avs); virtual srs_error_t on_ts_video(SrsTsMessage *msg, SrsBuffer *avs);
virtual srs_error_t mux_h264(SrsTsMessage *msg, SrsBuffer *avs); virtual srs_error_t mux_h264(SrsTsMessage *msg, SrsBuffer *avs);
virtual srs_error_t write_h264_sps_pps(uint32_t dts, uint32_t pts); virtual srs_error_t write_h264_sps_pps(uint32_t dts, uint32_t pts);
@ -461,7 +461,7 @@ private:
virtual srs_error_t write_audio_raw_frame(char *frame, int frame_size, SrsRawAacStreamCodec *codec, uint32_t dts); virtual srs_error_t write_audio_raw_frame(char *frame, int frame_size, SrsRawAacStreamCodec *codec, uint32_t dts);
virtual srs_error_t rtmp_write_packet(char type, uint32_t timestamp, char *data, int size); virtual srs_error_t rtmp_write_packet(char type, uint32_t timestamp, char *data, int size);
private: SRS_DECLARE_PRIVATE:
// Connect to RTMP server. // Connect to RTMP server.
virtual srs_error_t connect(); virtual srs_error_t connect();
// Close the connection to RTMP server. // Close the connection to RTMP server.
@ -484,7 +484,7 @@ class SrsRecoverablePsContext : public ISrsRecoverablePsContext
public: public:
ISrsPsContext *ctx_; ISrsPsContext *ctx_;
private: SRS_DECLARE_PRIVATE:
// If decoding error, enter the recover mode. Drop all left bytes util next pack header. // If decoding error, enter the recover mode. Drop all left bytes util next pack header.
int recover_; int recover_;
@ -497,7 +497,7 @@ public:
// parsed by previous decoding, we should move to the start of payload bytes. // parsed by previous decoding, we should move to the start of payload bytes.
virtual srs_error_t decode_rtp(SrsBuffer *stream, int reserved, ISrsPsMessageHandler *handler); virtual srs_error_t decode_rtp(SrsBuffer *stream, int reserved, ISrsPsMessageHandler *handler);
private: SRS_DECLARE_PRIVATE:
// Decode the RTP payload as PS pack stream. // Decode the RTP payload as PS pack stream.
virtual srs_error_t decode(SrsBuffer *stream, ISrsPsMessageHandler *handler); virtual srs_error_t decode(SrsBuffer *stream, ISrsPsMessageHandler *handler);
// When got error, drop data and enter recover mode. // When got error, drop data and enter recover mode.
@ -530,7 +530,7 @@ public:
// PS pack stream. // PS pack stream.
class SrsPackContext : public ISrsPackContext class SrsPackContext : public ISrsPackContext
{ {
private: SRS_DECLARE_PRIVATE:
// To process a pack of TS/PS messages. // To process a pack of TS/PS messages.
ISrsPsPackHandler *handler_; ISrsPsPackHandler *handler_;
// Note that it might be freed, so never use its fields. // Note that it might be freed, so never use its fields.

View File

@ -45,12 +45,12 @@ public:
srs_error_t on_video(SrsMediaPacket *msg); srs_error_t on_video(SrsMediaPacket *msg);
srs_error_t on_audio(SrsMediaPacket *msg); srs_error_t on_audio(SrsMediaPacket *msg);
private: SRS_DECLARE_PRIVATE:
srs_error_t flush_mainfest(); srs_error_t flush_mainfest();
srs_error_t flush_bootstrap(); srs_error_t flush_bootstrap();
void adjust_windows(); void adjust_windows();
private: SRS_DECLARE_PRIVATE:
std::list<SrsHdsFragment *> fragments_; std::list<SrsHdsFragment *> fragments_;
SrsHdsFragment *currentSegment_; SrsHdsFragment *currentSegment_;
int fragment_index_; int fragment_index_;

View File

@ -19,7 +19,7 @@ public:
public: public:
virtual void heartbeat(); virtual void heartbeat();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_heartbeat(); virtual srs_error_t do_heartbeat();
}; };

View File

@ -73,11 +73,11 @@ public:
class SrsInitMp4Segment : public SrsFragment class SrsInitMp4Segment : public SrsFragment
{ {
private: SRS_DECLARE_PRIVATE:
ISrsFileWriter *fw_; ISrsFileWriter *fw_;
SrsMp4M2tsInitEncoder init_; SrsMp4M2tsInitEncoder init_;
private: SRS_DECLARE_PRIVATE:
// Key ID for encryption // Key ID for encryption
unsigned char kid_[16]; unsigned char kid_[16];
// Constant IV for encryption // Constant IV for encryption
@ -96,14 +96,14 @@ public:
virtual srs_error_t write_video_only(SrsFormat *format, int v_tid); virtual srs_error_t write_video_only(SrsFormat *format, int v_tid);
virtual srs_error_t write_audio_only(SrsFormat *format, int a_tid); virtual srs_error_t write_audio_only(SrsFormat *format, int a_tid);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t init_encoder(); virtual srs_error_t init_encoder();
}; };
// TODO: merge this code with SrsFragmentedMp4 in dash // TODO: merge this code with SrsFragmentedMp4 in dash
class SrsHlsM4sSegment : public SrsFragment class SrsHlsM4sSegment : public SrsFragment
{ {
private: SRS_DECLARE_PRIVATE:
ISrsFileWriter *fw_; ISrsFileWriter *fw_;
SrsFmp4SegmentEncoder enc_; SrsFmp4SegmentEncoder enc_;
@ -130,11 +130,11 @@ public:
// The hls async call: on_hls // The hls async call: on_hls
class SrsDvrAsyncCallOnHls : public ISrsAsyncCallTask class SrsDvrAsyncCallOnHls : public ISrsAsyncCallTask
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsHttpHooks *hooks_; ISrsHttpHooks *hooks_;
private: SRS_DECLARE_PRIVATE:
SrsContextId cid_; SrsContextId cid_;
std::string path_; std::string path_;
std::string ts_url_; std::string ts_url_;
@ -157,11 +157,11 @@ public:
// The hls async call: on_hls_notify // The hls async call: on_hls_notify
class SrsDvrAsyncCallOnHlsNotify : public ISrsAsyncCallTask class SrsDvrAsyncCallOnHlsNotify : public ISrsAsyncCallTask
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsHttpHooks *hooks_; ISrsHttpHooks *hooks_;
private: SRS_DECLARE_PRIVATE:
SrsContextId cid_; SrsContextId cid_;
std::string ts_url_; std::string ts_url_;
ISrsRequest *req_; ISrsRequest *req_;
@ -184,14 +184,14 @@ public:
// TODO: Rename to SrsHlsTsMuxer, for TS file only. // TODO: Rename to SrsHlsTsMuxer, for TS file only.
class SrsHlsMuxer class SrsHlsMuxer
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
private: SRS_DECLARE_PRIVATE:
std::string hls_entry_prefix_; std::string hls_entry_prefix_;
std::string hls_path_; std::string hls_path_;
std::string hls_ts_file_; std::string hls_ts_file_;
@ -204,7 +204,7 @@ private:
srs_utime_t hls_window_; srs_utime_t hls_window_;
SrsAsyncCallWorker *async_; SrsAsyncCallWorker *async_;
private: SRS_DECLARE_PRIVATE:
// Whether use floor algorithm for timestamp. // Whether use floor algorithm for timestamp.
bool hls_ts_floor_; bool hls_ts_floor_;
// The deviation in piece to adjust the fragment to be more // The deviation in piece to adjust the fragment to be more
@ -215,7 +215,7 @@ private:
int64_t accept_floor_ts_; int64_t accept_floor_ts_;
int64_t previous_floor_ts_; int64_t previous_floor_ts_;
private: SRS_DECLARE_PRIVATE:
// Whether encrypted or not // Whether encrypted or not
bool hls_keys_; bool hls_keys_;
int hls_fragments_per_key_; int hls_fragments_per_key_;
@ -231,13 +231,13 @@ private:
// The underlayer file writer. // The underlayer file writer.
ISrsFileWriter *writer_; ISrsFileWriter *writer_;
private: SRS_DECLARE_PRIVATE:
int sequence_no_; int sequence_no_;
srs_utime_t max_td_; srs_utime_t max_td_;
std::string m3u8_; std::string m3u8_;
std::string m3u8_url_; std::string m3u8_url_;
private: SRS_DECLARE_PRIVATE:
// The available cached segments in m3u8. // The available cached segments in m3u8.
SrsFragmentWindow *segments_; SrsFragmentWindow *segments_;
// The current writing segment. // The current writing segment.
@ -245,7 +245,7 @@ private:
// The ts context, to keep cc continous between ts. // The ts context, to keep cc continous between ts.
SrsTsContext *context_; SrsTsContext *context_;
private: SRS_DECLARE_PRIVATE:
// Latest audio codec, parsed from stream. // Latest audio codec, parsed from stream.
SrsAudioCodecId latest_acodec_; SrsAudioCodecId latest_acodec_;
// Latest audio codec, parsed from stream. // Latest audio codec, parsed from stream.
@ -306,7 +306,7 @@ public:
// Close segment(ts). // Close segment(ts).
virtual srs_error_t segment_close(); virtual srs_error_t segment_close();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_segment_close(); virtual srs_error_t do_segment_close();
virtual srs_error_t write_hls_key(); virtual srs_error_t write_hls_key();
virtual srs_error_t refresh_m3u8(); virtual srs_error_t refresh_m3u8();
@ -318,7 +318,7 @@ public:
// HLS recover mode. // HLS recover mode.
srs_error_t recover_hls(); srs_error_t recover_hls();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_recover_hls(); virtual srs_error_t do_recover_hls();
}; };
@ -327,14 +327,14 @@ private:
// to flush video/audio, without any mechenisms. // to flush video/audio, without any mechenisms.
class SrsHlsFmp4Muxer class SrsHlsFmp4Muxer
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
private: SRS_DECLARE_PRIVATE:
std::string hls_entry_prefix_; std::string hls_entry_prefix_;
std::string hls_path_; std::string hls_path_;
std::string hls_m4s_file_; std::string hls_m4s_file_;
@ -347,7 +347,7 @@ private:
srs_utime_t hls_window_; srs_utime_t hls_window_;
SrsAsyncCallWorker *async_; SrsAsyncCallWorker *async_;
private: SRS_DECLARE_PRIVATE:
// Whether use floor algorithm for timestamp. // Whether use floor algorithm for timestamp.
bool hls_ts_floor_; bool hls_ts_floor_;
// The deviation in piece to adjust the fragment to be more // The deviation in piece to adjust the fragment to be more
@ -359,7 +359,7 @@ private:
int64_t previous_floor_ts_; int64_t previous_floor_ts_;
bool init_mp4_ready_; bool init_mp4_ready_;
private: SRS_DECLARE_PRIVATE:
// Whether encrypted or not // Whether encrypted or not
// TODO: fmp4 encryption is not yet implemented. // TODO: fmp4 encryption is not yet implemented.
// fmp4 support four kinds of protection scheme: 'cenc', 'cbc1', 'cens', 'cbcs'. // fmp4 support four kinds of protection scheme: 'cenc', 'cbc1', 'cens', 'cbcs'.
@ -385,7 +385,7 @@ private:
// The underlayer file writer. // The underlayer file writer.
ISrsFileWriter *writer_; ISrsFileWriter *writer_;
private: SRS_DECLARE_PRIVATE:
int sequence_no_; int sequence_no_;
srs_utime_t max_td_; srs_utime_t max_td_;
std::string m3u8_; std::string m3u8_;
@ -395,13 +395,13 @@ private:
int audio_track_id_; int audio_track_id_;
uint64_t video_dts_; uint64_t video_dts_;
private: SRS_DECLARE_PRIVATE:
// The available cached segments in m3u8. // The available cached segments in m3u8.
SrsFragmentWindow *segments_; SrsFragmentWindow *segments_;
// The current writing segment. // The current writing segment.
SrsHlsM4sSegment *current_; SrsHlsM4sSegment *current_;
private: SRS_DECLARE_PRIVATE:
// Latest audio codec, parsed from stream. // Latest audio codec, parsed from stream.
SrsAudioCodecId latest_acodec_; SrsAudioCodecId latest_acodec_;
// Latest audio codec, parsed from stream. // Latest audio codec, parsed from stream.
@ -461,7 +461,7 @@ public:
// Close segment(ts). // Close segment(ts).
virtual srs_error_t segment_close(); virtual srs_error_t segment_close();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_segment_close(); virtual srs_error_t do_segment_close();
virtual srs_error_t write_hls_key(); virtual srs_error_t write_hls_key();
virtual srs_error_t refresh_m3u8(); virtual srs_error_t refresh_m3u8();
@ -513,10 +513,10 @@ public:
// TODO: Rename to SrsHlsTsController, for TS file only. // TODO: Rename to SrsHlsTsController, for TS file only.
class SrsHlsController : public ISrsHlsController class SrsHlsController : public ISrsHlsController
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
// The HLS muxer to reap ts and m3u8. // The HLS muxer to reap ts and m3u8.
// The TS is cached to SrsTsMessageCache then flush to ts segment. // The TS is cached to SrsTsMessageCache then flush to ts segment.
SrsHlsMuxer *muxer_; SrsHlsMuxer *muxer_;
@ -557,7 +557,7 @@ public:
// write video to muxer. // write video to muxer.
virtual srs_error_t write_video(SrsMediaPacket *shared_video, SrsFormat *format); virtual srs_error_t write_video(SrsMediaPacket *shared_video, SrsFormat *format);
private: SRS_DECLARE_PRIVATE:
// Reopen the muxer for a new hls segment, // Reopen the muxer for a new hls segment,
// close current segment, open a new segment, // close current segment, open a new segment,
// then write the key frame to the new segment. // then write the key frame to the new segment.
@ -569,27 +569,27 @@ private:
// Direct sample processing without caching, simpler than TS controller. // Direct sample processing without caching, simpler than TS controller.
class SrsHlsMp4Controller : public ISrsHlsController class SrsHlsMp4Controller : public ISrsHlsController
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
bool has_video_sh_; bool has_video_sh_;
bool has_audio_sh_; bool has_audio_sh_;
private: SRS_DECLARE_PRIVATE:
int video_track_id_; int video_track_id_;
int audio_track_id_; int audio_track_id_;
private: SRS_DECLARE_PRIVATE:
// Current audio dts. // Current audio dts.
uint64_t audio_dts_; uint64_t audio_dts_;
// Current video dts. // Current video dts.
uint64_t video_dts_; uint64_t video_dts_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
private: SRS_DECLARE_PRIVATE:
SrsHlsFmp4Muxer *muxer_; SrsHlsFmp4Muxer *muxer_;
public: public:
@ -637,13 +637,13 @@ public:
// TODO: FIXME: add utest for hls. // TODO: FIXME: add utest for hls.
class SrsHls : public ISrsHls class SrsHls : public ISrsHls
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
ISrsHlsController *controller_; ISrsHlsController *controller_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
// Whether the HLS is enabled. // Whether the HLS is enabled.
bool enabled_; bool enabled_;
@ -657,7 +657,7 @@ private:
// To detect heartbeat and dispose it if configured. // To detect heartbeat and dispose it if configured.
srs_utime_t last_update_time_; srs_utime_t last_update_time_;
private: SRS_DECLARE_PRIVATE:
SrsOriginHub *hub_; SrsOriginHub *hub_;
SrsRtmpJitter *jitter_; SrsRtmpJitter *jitter_;
SrsPithyPrint *pprint_; SrsPithyPrint *pprint_;
@ -669,7 +669,7 @@ public:
public: public:
virtual void async_reload(); virtual void async_reload();
private: SRS_DECLARE_PRIVATE:
srs_error_t reload(); srs_error_t reload();
srs_error_t do_reload(int *reloading, int *reloaded, int *refreshed); srs_error_t do_reload(int *reloading, int *reloaded, int *refreshed);
@ -697,7 +697,7 @@ public:
// TODO: FIXME: Remove param is_sps_pps. // TODO: FIXME: Remove param is_sps_pps.
virtual srs_error_t on_video(SrsMediaPacket *shared_video, SrsFormat *format); virtual srs_error_t on_video(SrsMediaPacket *shared_video, SrsFormat *format);
private: SRS_DECLARE_PRIVATE:
virtual void hls_show_mux_log(); virtual void hls_show_mux_log();
}; };

View File

@ -38,7 +38,7 @@ extern srs_error_t srs_api_response_code(ISrsHttpResponseWriter *w, ISrsHttpMess
// For http root. // For http root.
class SrsGoApiRoot : public ISrsHttpHandler class SrsGoApiRoot : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -51,7 +51,7 @@ public:
class SrsGoApiApi : public ISrsHttpHandler class SrsGoApiApi : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -64,7 +64,7 @@ public:
class SrsGoApiV1 : public ISrsHttpHandler class SrsGoApiV1 : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -77,7 +77,7 @@ public:
class SrsGoApiVersion : public ISrsHttpHandler class SrsGoApiVersion : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -90,7 +90,7 @@ public:
class SrsGoApiSummaries : public ISrsHttpHandler class SrsGoApiSummaries : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -103,7 +103,7 @@ public:
class SrsGoApiRusages : public ISrsHttpHandler class SrsGoApiRusages : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -116,7 +116,7 @@ public:
class SrsGoApiSelfProcStats : public ISrsHttpHandler class SrsGoApiSelfProcStats : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -129,7 +129,7 @@ public:
class SrsGoApiSystemProcStats : public ISrsHttpHandler class SrsGoApiSystemProcStats : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -142,7 +142,7 @@ public:
class SrsGoApiMemInfos : public ISrsHttpHandler class SrsGoApiMemInfos : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -155,7 +155,7 @@ public:
class SrsGoApiAuthors : public ISrsHttpHandler class SrsGoApiAuthors : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -168,7 +168,7 @@ public:
class SrsGoApiFeatures : public ISrsHttpHandler class SrsGoApiFeatures : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -181,7 +181,7 @@ public:
class SrsGoApiRequests : public ISrsHttpHandler class SrsGoApiRequests : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -194,7 +194,7 @@ public:
class SrsGoApiVhosts : public ISrsHttpHandler class SrsGoApiVhosts : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -207,7 +207,7 @@ public:
class SrsGoApiStreams : public ISrsHttpHandler class SrsGoApiStreams : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -220,7 +220,7 @@ public:
class SrsGoApiClients : public ISrsHttpHandler class SrsGoApiClients : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -233,14 +233,14 @@ public:
class SrsGoApiRaw : public ISrsHttpHandler, public ISrsReloadHandler class SrsGoApiRaw : public ISrsHttpHandler, public ISrsReloadHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
ISrsSignalHandler *handler_; ISrsSignalHandler *handler_;
private: SRS_DECLARE_PRIVATE:
bool raw_api_; bool raw_api_;
bool allow_reload_; bool allow_reload_;
bool allow_query_; bool allow_query_;
@ -257,7 +257,7 @@ public:
class SrsGoApiClusters : public ISrsHttpHandler class SrsGoApiClusters : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -270,7 +270,7 @@ public:
class SrsGoApiError : public ISrsHttpHandler class SrsGoApiError : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -284,7 +284,7 @@ public:
#ifdef SRS_GPERF #ifdef SRS_GPERF
class SrsGoApiTcmalloc : public ISrsHttpHandler class SrsGoApiTcmalloc : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -299,10 +299,10 @@ public:
#ifdef SRS_VALGRIND #ifdef SRS_VALGRIND
class SrsGoApiValgrind : public ISrsHttpHandler, public ISrsCoroutineHandler class SrsGoApiValgrind : public ISrsHttpHandler, public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
std::string task_; std::string task_;
@ -321,7 +321,7 @@ public:
#ifdef SRS_SIGNAL_API #ifdef SRS_SIGNAL_API
class SrsGoApiSignal : public ISrsHttpHandler class SrsGoApiSignal : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -335,11 +335,11 @@ public:
class SrsGoApiMetrics : public ISrsHttpHandler class SrsGoApiMetrics : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
bool enabled_; bool enabled_;
std::string label_; std::string label_;
std::string tag_; std::string tag_;

View File

@ -95,17 +95,17 @@ public:
// The http connection which request the static or stream content. // The http connection which request the static or stream content.
class SrsHttpConn : public ISrsHttpConn class SrsHttpConn : public ISrsHttpConn
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
protected: SRS_DECLARE_PROTECTED:
ISrsHttpParser *parser_; ISrsHttpParser *parser_;
ISrsCommonHttpHandler *http_mux_; ISrsCommonHttpHandler *http_mux_;
ISrsHttpCorsMux *cors_; ISrsHttpCorsMux *cors_;
ISrsHttpAuthMux *auth_; ISrsHttpAuthMux *auth_;
ISrsHttpConnOwner *handler_; ISrsHttpConnOwner *handler_;
protected: SRS_DECLARE_PROTECTED:
ISrsProtocolReadWriter *skt_; ISrsProtocolReadWriter *skt_;
// Each connection start a green thread, // Each connection start a green thread,
// when thread stop, the connection will be delete by server. // when thread stop, the connection will be delete by server.
@ -114,7 +114,7 @@ protected:
std::string ip_; std::string ip_;
int port_; int port_;
private: SRS_DECLARE_PRIVATE:
// The delta for statistic. // The delta for statistic.
ISrsNetworkDelta *delta_; ISrsNetworkDelta *delta_;
// The create time in microseconds. // The create time in microseconds.
@ -137,7 +137,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
virtual srs_error_t process_requests(ISrsRequest **preq); virtual srs_error_t process_requests(ISrsRequest **preq);
virtual srs_error_t process_request(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, int rid); virtual srs_error_t process_request(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, int rid);
@ -179,11 +179,11 @@ public:
// Drop body of request, only process the response. // Drop body of request, only process the response.
class SrsHttpxConn : public ISrsHttpxConn class SrsHttpxConn : public ISrsHttpxConn
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsStatistic *stat_; ISrsStatistic *stat_;
private: SRS_DECLARE_PRIVATE:
// The manager object to manage the connection. // The manager object to manage the connection.
ISrsResourceManager *manager_; ISrsResourceManager *manager_;
ISrsProtocolReadWriter *io_; ISrsProtocolReadWriter *io_;
@ -242,7 +242,7 @@ public:
// The http server, use http stream or static server to serve requests. // The http server, use http stream or static server to serve requests.
class SrsHttpServer : public ISrsHttpServer class SrsHttpServer : public ISrsHttpServer
{ {
private: SRS_DECLARE_PRIVATE:
ISrsHttpStaticServer *http_static_; ISrsHttpStaticServer *http_static_;
ISrsHttpStreamServer *http_stream_; ISrsHttpStreamServer *http_stream_;

View File

@ -153,7 +153,7 @@ public:
class SrsHttpHooks : public ISrsHttpHooks class SrsHttpHooks : public ISrsHttpHooks
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppFactory *factory_; ISrsAppFactory *factory_;
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
@ -176,7 +176,7 @@ public:
srs_error_t discover_co_workers(std::string url, std::string &host, int &port); srs_error_t discover_co_workers(std::string url, std::string &host, int &port);
srs_error_t on_forward_backend(std::string url, ISrsRequest *req, std::vector<std::string> &rtmp_urls); srs_error_t on_forward_backend(std::string url, ISrsRequest *req, std::vector<std::string> &rtmp_urls);
private: SRS_DECLARE_PRIVATE:
srs_error_t do_post(ISrsHttpClient *hc, std::string url, std::string req, int &code, std::string &res); srs_error_t do_post(ISrsHttpClient *hc, std::string url, std::string req, int &code, std::string &res);
}; };

View File

@ -35,7 +35,7 @@ public:
// Server HLS streaming. // Server HLS streaming.
class SrsHlsStream : public ISrsFastTimerHandler class SrsHlsStream : public ISrsFastTimerHandler
{ {
private: SRS_DECLARE_PRIVATE:
// The period of validity of the ctx // The period of validity of the ctx
std::map<std::string, SrsHlsVirtualConn *> map_ctx_info_; std::map<std::string, SrsHlsVirtualConn *> map_ctx_info_;
@ -47,7 +47,7 @@ public:
virtual srs_error_t serve_m3u8_ctx(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, ISrsFileReaderFactory *factory, std::string fullpath, ISrsRequest *req, bool *served); virtual srs_error_t serve_m3u8_ctx(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, ISrsFileReaderFactory *factory, std::string fullpath, ISrsRequest *req, bool *served);
virtual void on_serve_ts_ctx(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); virtual void on_serve_ts_ctx(ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
private: SRS_DECLARE_PRIVATE:
srs_error_t serve_new_session(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, ISrsRequest *req, std::string &ctx); srs_error_t serve_new_session(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, ISrsRequest *req, std::string &ctx);
srs_error_t serve_exists_session(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, ISrsFileReaderFactory *factory, std::string fullpath); srs_error_t serve_exists_session(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, ISrsFileReaderFactory *factory, std::string fullpath);
bool ctx_is_exist(std::string ctx); bool ctx_is_exist(std::string ctx);
@ -56,24 +56,24 @@ private:
void http_hooks_on_stop(ISrsRequest *req); void http_hooks_on_stop(ISrsRequest *req);
bool is_interrupt(std::string id); bool is_interrupt(std::string id);
// interface ISrsFastTimerHandler // interface ISrsFastTimerHandler
private: SRS_DECLARE_PRIVATE:
srs_error_t on_timer(srs_utime_t interval); srs_error_t on_timer(srs_utime_t interval);
private: SRS_DECLARE_PRIVATE:
SrsSecurity *security_; SrsSecurity *security_;
}; };
// The Vod streaming, like FLV, MP4 or HLS streaming. // The Vod streaming, like FLV, MP4 or HLS streaming.
class SrsVodStream : public SrsHttpFileServer class SrsVodStream : public SrsHttpFileServer
{ {
private: SRS_DECLARE_PRIVATE:
SrsHlsStream hls_; SrsHlsStream hls_;
public: public:
SrsVodStream(std::string root_dir); SrsVodStream(std::string root_dir);
virtual ~SrsVodStream(); virtual ~SrsVodStream();
protected: SRS_DECLARE_PROTECTED:
// The flv vod stream supports flv?start=offset-bytes. // The flv vod stream supports flv?start=offset-bytes.
// For example, http://server/file.flv?start=10240 // For example, http://server/file.flv?start=10240
// server will write flv header and sequence header, // server will write flv header and sequence header,
@ -103,7 +103,7 @@ public:
// serve http static file and flv/mp4 vod stream. // serve http static file and flv/mp4 vod stream.
class SrsHttpStaticServer : public ISrsHttpStaticServer class SrsHttpStaticServer : public ISrsHttpStaticServer
{ {
private: SRS_DECLARE_PRIVATE:
ISrsHttpServeMux *mux_; ISrsHttpServeMux *mux_;
public: public:
@ -118,7 +118,7 @@ public:
public: public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t mount_vhost(std::string vhost, std::string &pmount); virtual srs_error_t mount_vhost(std::string vhost, std::string &pmount);
}; };

View File

@ -51,14 +51,14 @@ public:
// A cache for HTTP Live Streaming encoder, to make android(weixin) happy. // A cache for HTTP Live Streaming encoder, to make android(weixin) happy.
class SrsBufferCache : public ISrsCoroutineHandler, public ISrsBufferCache class SrsBufferCache : public ISrsCoroutineHandler, public ISrsBufferCache
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsLiveSourceManager *live_sources_; ISrsLiveSourceManager *live_sources_;
private: SRS_DECLARE_PRIVATE:
srs_utime_t fast_cache_; srs_utime_t fast_cache_;
private: SRS_DECLARE_PRIVATE:
ISrsMessageQueue *queue_; ISrsMessageQueue *queue_;
ISrsRequest *req_; ISrsRequest *req_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
@ -107,7 +107,7 @@ public:
// Transmux RTMP to HTTP Live Streaming. // Transmux RTMP to HTTP Live Streaming.
class SrsFlvStreamEncoder : public ISrsBufferEncoder class SrsFlvStreamEncoder : public ISrsBufferEncoder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsFlvTransmuxer *enc_; ISrsFlvTransmuxer *enc_;
bool header_written_; bool header_written_;
bool has_audio_; bool has_audio_;
@ -138,14 +138,14 @@ public:
// Write the tags in a time. // Write the tags in a time.
virtual srs_error_t write_tags(SrsMediaPacket **msgs, int count); virtual srs_error_t write_tags(SrsMediaPacket **msgs, int count);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t write_header(bool has_video, bool has_audio); virtual srs_error_t write_header(bool has_video, bool has_audio);
}; };
// Transmux RTMP to HTTP TS Streaming. // Transmux RTMP to HTTP TS Streaming.
class SrsTsStreamEncoder : public ISrsBufferEncoder class SrsTsStreamEncoder : public ISrsBufferEncoder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsTsTransmuxer *enc_; ISrsTsTransmuxer *enc_;
public: public:
@ -171,7 +171,7 @@ public:
// Transmux RTMP with AAC stream to HTTP AAC Streaming. // Transmux RTMP with AAC stream to HTTP AAC Streaming.
class SrsAacStreamEncoder : public ISrsBufferEncoder class SrsAacStreamEncoder : public ISrsBufferEncoder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAacTransmuxer *enc_; ISrsAacTransmuxer *enc_;
ISrsBufferCache *cache_; ISrsBufferCache *cache_;
@ -193,7 +193,7 @@ public:
// Transmux RTMP with MP3 stream to HTTP MP3 Streaming. // Transmux RTMP with MP3 stream to HTTP MP3 Streaming.
class SrsMp3StreamEncoder : public ISrsBufferEncoder class SrsMp3StreamEncoder : public ISrsBufferEncoder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsMp3Transmuxer *enc_; ISrsMp3Transmuxer *enc_;
ISrsBufferCache *cache_; ISrsBufferCache *cache_;
@ -215,7 +215,7 @@ public:
// Write stream to http response direclty. // Write stream to http response direclty.
class SrsBufferWriter : public SrsFileWriter class SrsBufferWriter : public SrsFileWriter
{ {
private: SRS_DECLARE_PRIVATE:
ISrsHttpResponseWriter *writer_; ISrsHttpResponseWriter *writer_;
public: public:
@ -251,13 +251,13 @@ public:
// TODO: FIXME: Rename to SrsHttpLive // TODO: FIXME: Rename to SrsHttpLive
class SrsLiveStream : public ISrsLiveStream class SrsLiveStream : public ISrsLiveStream
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsLiveSourceManager *live_sources_; ISrsLiveSourceManager *live_sources_;
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsHttpHooks *hooks_; ISrsHttpHooks *hooks_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
ISrsBufferCache *cache_; ISrsBufferCache *cache_;
ISrsSecurity *security_; ISrsSecurity *security_;
@ -274,7 +274,7 @@ public:
public: public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
private: SRS_DECLARE_PRIVATE:
srs_error_t serve_http_impl(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); srs_error_t serve_http_impl(ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
public: public:
@ -283,7 +283,7 @@ public:
public: public:
virtual void expire(); virtual void expire();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_serve_http(SrsLiveSource *source, ISrsLiveConsumer *consumer, ISrsHttpResponseWriter *w, ISrsHttpMessage *r); virtual srs_error_t do_serve_http(SrsLiveSource *source, ISrsLiveConsumer *consumer, ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
virtual srs_error_t http_hooks_on_play(ISrsHttpMessage *r); virtual srs_error_t http_hooks_on_play(ISrsHttpMessage *r);
virtual void http_hooks_on_stop(ISrsHttpMessage *r); virtual void http_hooks_on_stop(ISrsHttpMessage *r);
@ -292,7 +292,7 @@ private:
// The Live Entry, to handle HTTP Live Streaming. // The Live Entry, to handle HTTP Live Streaming.
struct SrsLiveEntry { struct SrsLiveEntry {
private: SRS_DECLARE_PRIVATE:
bool is_flv_; bool is_flv_;
bool is_ts_; bool is_ts_;
bool is_aac_; bool is_aac_;
@ -342,11 +342,11 @@ public:
// TODO: Support multiple stream. // TODO: Support multiple stream.
class SrsHttpStreamServer : public ISrsHttpStreamServer class SrsHttpStreamServer : public ISrsHttpStreamServer
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsHttpServeMux *mux_; ISrsHttpServeMux *mux_;
private: SRS_DECLARE_PRIVATE:
ISrsAsyncCallWorker *async_; ISrsAsyncCallWorker *async_;
public: public:
@ -373,14 +373,14 @@ public:
public: public:
virtual srs_error_t dynamic_match(ISrsHttpMessage *request, ISrsHttpHandler **ph); virtual srs_error_t dynamic_match(ISrsHttpMessage *request, ISrsHttpHandler **ph);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t initialize_flv_streaming(); virtual srs_error_t initialize_flv_streaming();
virtual srs_error_t initialize_flv_entry(std::string vhost); virtual srs_error_t initialize_flv_entry(std::string vhost);
}; };
class SrsHttpStreamDestroy : public ISrsAsyncCallTask class SrsHttpStreamDestroy : public ISrsAsyncCallTask
{ {
private: SRS_DECLARE_PRIVATE:
std::string sid_; std::string sid_;
std::map<std::string, SrsLiveEntry *> *streamHandlers_; std::map<std::string, SrsLiveEntry *> *streamHandlers_;
ISrsHttpServeMux *mux_; ISrsHttpServeMux *mux_;

View File

@ -49,7 +49,7 @@ public:
// Ingester ffmpeg object. // Ingester ffmpeg object.
class SrsIngesterFFMPEG : public ISrsIngesterFFMPEG class SrsIngesterFFMPEG : public ISrsIngesterFFMPEG
{ {
private: SRS_DECLARE_PRIVATE:
std::string vhost_; std::string vhost_;
std::string id_; std::string id_;
ISrsFFMPEG *ffmpeg_; ISrsFFMPEG *ffmpeg_;
@ -91,14 +91,14 @@ public:
// push to SRS(or any RTMP server) over RTMP. // push to SRS(or any RTMP server) over RTMP.
class SrsIngester : public ISrsIngester, public ISrsCoroutineHandler class SrsIngester : public ISrsIngester, public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
std::vector<ISrsIngesterFFMPEG *> ingesters_; std::vector<ISrsIngesterFFMPEG *> ingesters_;
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
ISrsPithyPrint *pprint_; ISrsPithyPrint *pprint_;
// Whether the ingesters are expired, for example, the listen port changed, // Whether the ingesters are expired, for example, the listen port changed,
@ -118,7 +118,7 @@ public:
virtual srs_error_t start(); virtual srs_error_t start();
virtual void stop(); virtual void stop();
private: SRS_DECLARE_PRIVATE:
// Notify FFMPEG to fast stop. // Notify FFMPEG to fast stop.
virtual void fast_stop(); virtual void fast_stop();
// When SRS quit, directly kill FFMPEG after fast stop. // When SRS quit, directly kill FFMPEG after fast stop.
@ -127,10 +127,10 @@ private:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
private: SRS_DECLARE_PRIVATE:
virtual void clear_engines(); virtual void clear_engines();
virtual srs_error_t parse(); virtual srs_error_t parse();
virtual srs_error_t parse_ingesters(SrsConfDirective *vhost); virtual srs_error_t parse_ingesters(SrsConfDirective *vhost);

View File

@ -19,12 +19,12 @@
class SrsLatestVersion : public ISrsCoroutineHandler class SrsLatestVersion : public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
std::string server_id_; std::string server_id_;
std::string session_id_; std::string session_id_;
private: SRS_DECLARE_PRIVATE:
std::string match_version_; std::string match_version_;
std::string stable_version_; std::string stable_version_;
@ -38,7 +38,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
srs_error_t query_latest_version(std::string &url); srs_error_t query_latest_version(std::string &url);
}; };

View File

@ -94,19 +94,19 @@ public:
// Bind udp port, start thread to recv packet and handler it. // Bind udp port, start thread to recv packet and handler it.
class SrsUdpListener : public ISrsCoroutineHandler, public ISrsIpListener class SrsUdpListener : public ISrsCoroutineHandler, public ISrsIpListener
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppFactory *factory_; ISrsAppFactory *factory_;
protected: SRS_DECLARE_PROTECTED:
std::string label_; std::string label_;
srs_netfd_t lfd_; srs_netfd_t lfd_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
protected: SRS_DECLARE_PROTECTED:
char *buf_; char *buf_;
int nb_buf_; int nb_buf_;
protected: SRS_DECLARE_PROTECTED:
ISrsUdpHandler *handler_; ISrsUdpHandler *handler_;
std::string ip_; std::string ip_;
int port_; int port_;
@ -119,11 +119,11 @@ public:
ISrsListener *set_label(const std::string &label); ISrsListener *set_label(const std::string &label);
ISrsListener *set_endpoint(const std::string &i, int p); ISrsListener *set_endpoint(const std::string &i, int p);
private: SRS_DECLARE_PRIVATE:
virtual int fd(); virtual int fd();
virtual srs_netfd_t stfd(); virtual srs_netfd_t stfd();
private: SRS_DECLARE_PRIVATE:
void set_socket_buffer(); void set_socket_buffer();
public: public:
@ -133,22 +133,22 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
srs_error_t do_cycle(); srs_error_t do_cycle();
}; };
// Bind and listen tcp port, use handler to process the client. // Bind and listen tcp port, use handler to process the client.
class SrsTcpListener : public ISrsCoroutineHandler, public ISrsIpListener class SrsTcpListener : public ISrsCoroutineHandler, public ISrsIpListener
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppFactory *factory_; ISrsAppFactory *factory_;
private: SRS_DECLARE_PRIVATE:
std::string label_; std::string label_;
srs_netfd_t lfd_; srs_netfd_t lfd_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
private: SRS_DECLARE_PRIVATE:
ISrsTcpHandler *handler_; ISrsTcpHandler *handler_;
std::string ip_; std::string ip_;
int port_; int port_;
@ -170,17 +170,17 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
srs_error_t do_cycle(); srs_error_t do_cycle();
}; };
// Bind and listen tcp port, use handler to process the client. // Bind and listen tcp port, use handler to process the client.
class SrsMultipleTcpListeners : public ISrsIpListener, public ISrsTcpHandler class SrsMultipleTcpListeners : public ISrsIpListener, public ISrsTcpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppFactory *factory_; ISrsAppFactory *factory_;
private: SRS_DECLARE_PRIVATE:
ISrsTcpHandler *handler_; ISrsTcpHandler *handler_;
std::vector<ISrsIpListener *> listeners_; std::vector<ISrsIpListener *> listeners_;
@ -223,13 +223,13 @@ public:
// TODO: FIXME: Rename it. Refine it for performance issue. // TODO: FIXME: Rename it. Refine it for performance issue.
class SrsUdpMuxSocket : public ISrsUdpMuxSocket class SrsUdpMuxSocket : public ISrsUdpMuxSocket
{ {
private: SRS_DECLARE_PRIVATE:
// For sender yield only. // For sender yield only.
uint32_t nn_msgs_for_yield_; uint32_t nn_msgs_for_yield_;
std::map<uint32_t, std::string> cache_; std::map<uint32_t, std::string> cache_;
SrsBuffer *cache_buffer_; SrsBuffer *cache_buffer_;
private: SRS_DECLARE_PRIVATE:
char *buf_; char *buf_;
int nb_buf_; int nb_buf_;
int nread_; int nread_;
@ -237,11 +237,11 @@ private:
sockaddr_storage from_; sockaddr_storage from_;
int fromlen_; int fromlen_;
private: SRS_DECLARE_PRIVATE:
std::string peer_ip_; std::string peer_ip_;
int peer_port_; int peer_port_;
private: SRS_DECLARE_PRIVATE:
// Cache for peer id. // Cache for peer id.
std::string peer_id_; std::string peer_id_;
// If the address changed, we should generate the peer_id. // If the address changed, we should generate the peer_id.
@ -271,19 +271,19 @@ public:
class SrsUdpMuxListener : public ISrsCoroutineHandler class SrsUdpMuxListener : public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppFactory *factory_; ISrsAppFactory *factory_;
private: SRS_DECLARE_PRIVATE:
srs_netfd_t lfd_; srs_netfd_t lfd_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
SrsContextId cid_; SrsContextId cid_;
private: SRS_DECLARE_PRIVATE:
char *buf_; char *buf_;
int nb_buf_; int nb_buf_;
private: SRS_DECLARE_PRIVATE:
ISrsUdpMuxHandler *handler_; ISrsUdpMuxHandler *handler_;
std::string ip_; std::string ip_;
int port_; int port_;
@ -302,7 +302,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
void set_socket_buffer(); void set_socket_buffer();
}; };

View File

@ -20,11 +20,11 @@
// when you want to use different level, override this classs, set the protected _level. // when you want to use different level, override this classs, set the protected _level.
class SrsFileLog : public ISrsLog, public ISrsReloadHandler class SrsFileLog : public ISrsLog, public ISrsReloadHandler
{ {
private: SRS_DECLARE_PRIVATE:
// Defined in SrsLogLevel. // Defined in SrsLogLevel.
SrsLogLevel level_; SrsLogLevel level_;
private: SRS_DECLARE_PRIVATE:
char *log_data_; char *log_data_;
// Log to file if specified srs_log_file // Log to file if specified srs_log_file
int fd_; int fd_;
@ -42,7 +42,7 @@ public:
virtual void reopen(); virtual void reopen();
virtual void log(SrsLogLevel level, const char *tag, const SrsContextId &context_id, const char *fmt, va_list args); virtual void log(SrsLogLevel level, const char *tag, const SrsContextId &context_id, const char *fmt, va_list args);
private: SRS_DECLARE_PRIVATE:
virtual void write_log(int &fd, char *str_log, int size, int level); virtual void write_log(int &fd, char *str_log, int size, int level);
virtual void open_log_file(); virtual void open_log_file();
}; };

View File

@ -44,10 +44,10 @@ class ISrsAppFactory;
// A UDP listener, for udp stream caster server. // A UDP listener, for udp stream caster server.
class SrsUdpCasterListener : public ISrsListener class SrsUdpCasterListener : public ISrsListener
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
ISrsIpListener *listener_; ISrsIpListener *listener_;
ISrsMpegtsOverUdp *caster_; ISrsMpegtsOverUdp *caster_;
@ -78,7 +78,7 @@ public:
// we must recalc the timestamp. // we must recalc the timestamp.
class SrsMpegtsQueue : public ISrsMpegtsQueue class SrsMpegtsQueue : public ISrsMpegtsQueue
{ {
private: SRS_DECLARE_PRIVATE:
// The key: dts, value: msg. // The key: dts, value: msg.
std::map<int64_t, SrsMediaPacket *> msgs_; std::map<int64_t, SrsMediaPacket *> msgs_;
int nb_audios_; int nb_audios_;
@ -107,19 +107,19 @@ public:
// The mpegts over udp stream caster. // The mpegts over udp stream caster.
class SrsMpegtsOverUdp : public ISrsMpegtsOverUdp class SrsMpegtsOverUdp : public ISrsMpegtsOverUdp
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
ISrsTsContext *context_; ISrsTsContext *context_;
SrsSimpleStream *buffer_; SrsSimpleStream *buffer_;
std::string output_; std::string output_;
private: SRS_DECLARE_PRIVATE:
ISrsBasicRtmpClient *sdk_; ISrsBasicRtmpClient *sdk_;
private: SRS_DECLARE_PRIVATE:
ISrsRawH264Stream *avc_; ISrsRawH264Stream *avc_;
std::string h264_sps_; std::string h264_sps_;
bool h264_sps_changed_; bool h264_sps_changed_;
@ -127,11 +127,11 @@ private:
bool h264_pps_changed_; bool h264_pps_changed_;
bool h264_sps_pps_sent_; bool h264_sps_pps_sent_;
private: SRS_DECLARE_PRIVATE:
ISrsRawAacStream *aac_; ISrsRawAacStream *aac_;
std::string aac_specific_config_; std::string aac_specific_config_;
private: SRS_DECLARE_PRIVATE:
ISrsMpegtsQueue *queue_; ISrsMpegtsQueue *queue_;
ISrsPithyPrint *pprint_; ISrsPithyPrint *pprint_;
@ -145,23 +145,23 @@ public:
public: public:
virtual srs_error_t on_udp_packet(const sockaddr *from, const int fromlen, char *buf, int nb_buf); virtual srs_error_t on_udp_packet(const sockaddr *from, const int fromlen, char *buf, int nb_buf);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t on_udp_bytes(std::string host, int port, char *buf, int nb_buf); virtual srs_error_t on_udp_bytes(std::string host, int port, char *buf, int nb_buf);
// Interface ISrsTsHandler // Interface ISrsTsHandler
public: public:
virtual srs_error_t on_ts_message(SrsTsMessage *msg); virtual srs_error_t on_ts_message(SrsTsMessage *msg);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t on_ts_video(SrsTsMessage *msg, SrsBuffer *avs); virtual srs_error_t on_ts_video(SrsTsMessage *msg, SrsBuffer *avs);
virtual srs_error_t write_h264_sps_pps(uint32_t dts, uint32_t pts); virtual srs_error_t write_h264_sps_pps(uint32_t dts, uint32_t pts);
virtual srs_error_t write_h264_ipb_frame(char *frame, int frame_size, uint32_t dts, uint32_t pts); virtual srs_error_t write_h264_ipb_frame(char *frame, int frame_size, uint32_t dts, uint32_t pts);
virtual srs_error_t on_ts_audio(SrsTsMessage *msg, SrsBuffer *avs); virtual srs_error_t on_ts_audio(SrsTsMessage *msg, SrsBuffer *avs);
virtual srs_error_t write_audio_raw_frame(char *frame, int frame_size, SrsRawAacStreamCodec *codec, uint32_t dts); virtual srs_error_t write_audio_raw_frame(char *frame, int frame_size, SrsRawAacStreamCodec *codec, uint32_t dts);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t rtmp_write_packet(char type, uint32_t timestamp, char *data, int size); virtual srs_error_t rtmp_write_packet(char type, uint32_t timestamp, char *data, int size);
private: SRS_DECLARE_PRIVATE:
// Connect to RTMP server. // Connect to RTMP server.
virtual srs_error_t connect(); virtual srs_error_t connect();
// Close the connection to RTMP server. // Close the connection to RTMP server.

View File

@ -36,7 +36,7 @@ public:
// @see https://github.com/ossrs/srs/issues/367 // @see https://github.com/ossrs/srs/issues/367
class SrsNgExec : public ISrsCoroutineHandler, public ISrsNgExec class SrsNgExec : public ISrsCoroutineHandler, public ISrsNgExec
{ {
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
SrsPithyPrint *pprint_; SrsPithyPrint *pprint_;
std::string input_stream_name_; std::string input_stream_name_;
@ -53,10 +53,10 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t parse_exec_publish(ISrsRequest *req); virtual srs_error_t parse_exec_publish(ISrsRequest *req);
virtual void clear_exec_publish(); virtual void clear_exec_publish();
virtual void show_exec_log_message(); virtual void show_exec_log_message();

View File

@ -57,13 +57,13 @@ public:
// process->stop(); // process->stop();
class SrsProcess : public ISrsProcess class SrsProcess : public ISrsProcess
{ {
private: SRS_DECLARE_PRIVATE:
bool is_started_; bool is_started_;
// Whether SIGTERM send but need to wait or SIGKILL. // Whether SIGTERM send but need to wait or SIGKILL.
bool fast_stopped_; bool fast_stopped_;
pid_t pid_; pid_t pid_;
private: SRS_DECLARE_PRIVATE:
std::string bin_; std::string bin_;
std::string stdout_file_; std::string stdout_file_;
std::string stderr_file_; std::string stderr_file_;
@ -87,7 +87,7 @@ public:
// @remark the argv[0] must be the binary. // @remark the argv[0] must be the binary.
virtual srs_error_t initialize(std::string binary, std::vector<std::string> argv); virtual srs_error_t initialize(std::string binary, std::vector<std::string> argv);
private: SRS_DECLARE_PRIVATE:
// Redirect standard I/O. // Redirect standard I/O.
virtual srs_error_t redirect_io(); virtual srs_error_t redirect_io();

View File

@ -80,7 +80,7 @@ public:
// The recv thread, use message handler to handle each received message. // The recv thread, use message handler to handle each received message.
class SrsRecvThread : public ISrsRecvThread class SrsRecvThread : public ISrsRecvThread
{ {
protected: SRS_DECLARE_PROTECTED:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
ISrsMessagePumper *pumper_; ISrsMessagePumper *pumper_;
ISrsRtmpServer *rtmp_; ISrsRtmpServer *rtmp_;
@ -105,7 +105,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
}; };
@ -125,7 +125,7 @@ public:
// @see: https://github.com/ossrs/srs/issues/217 // @see: https://github.com/ossrs/srs/issues/217
class SrsQueueRecvThread : public ISrsQueueRecvThread class SrsQueueRecvThread : public ISrsQueueRecvThread
{ {
private: SRS_DECLARE_PRIVATE:
std::vector<SrsRtmpCommonMessage *> queue_; std::vector<SrsRtmpCommonMessage *> queue_;
ISrsRecvThread *trd_; ISrsRecvThread *trd_;
ISrsRtmpServer *rtmp_; ISrsRtmpServer *rtmp_;
@ -173,10 +173,10 @@ public:
// @see: https://github.com/ossrs/srs/issues/237 // @see: https://github.com/ossrs/srs/issues/237
class SrsPublishRecvThread : public ISrsPublishRecvThread class SrsPublishRecvThread : public ISrsPublishRecvThread
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
uint32_t nn_msgs_for_yield_; uint32_t nn_msgs_for_yield_;
ISrsRecvThread *trd_; ISrsRecvThread *trd_;
ISrsRtmpServer *rtmp_; ISrsRtmpServer *rtmp_;
@ -234,7 +234,7 @@ public:
virtual void on_read(ssize_t nread); virtual void on_read(ssize_t nread);
#endif #endif
private: SRS_DECLARE_PRIVATE:
virtual void set_socket_buffer(srs_utime_t sleep_v); virtual void set_socket_buffer(srs_utime_t sleep_v);
}; };
@ -254,7 +254,7 @@ public:
// @see https://github.com/ossrs/srs/issues/636#issuecomment-298208427 // @see https://github.com/ossrs/srs/issues/636#issuecomment-298208427
class SrsHttpRecvThread : public ISrsHttpRecvThread class SrsHttpRecvThread : public ISrsHttpRecvThread
{ {
private: SRS_DECLARE_PRIVATE:
SrsHttpxConn *conn_; SrsHttpxConn *conn_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;

View File

@ -25,7 +25,7 @@ public:
// @param refer the refer in config. // @param refer the refer in config.
virtual srs_error_t check(std::string page_url, SrsConfDirective *refer); virtual srs_error_t check(std::string page_url, SrsConfDirective *refer);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t check_single_refer(std::string page_url, std::string refer); virtual srs_error_t check_single_refer(std::string page_url, std::string refer);
}; };

View File

@ -25,14 +25,14 @@ class ISrsHttpHooks;
class SrsGoApiRtcPlay : public ISrsHttpHandler class SrsGoApiRtcPlay : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsRtcSourceManager *rtc_sources_; ISrsRtcSourceManager *rtc_sources_;
ISrsLiveSourceManager *live_sources_; ISrsLiveSourceManager *live_sources_;
ISrsHttpHooks *hooks_; ISrsHttpHooks *hooks_;
private: SRS_DECLARE_PRIVATE:
ISrsRtcApiServer *server_; ISrsRtcApiServer *server_;
ISrsSecurity *security_; ISrsSecurity *security_;
@ -43,27 +43,27 @@ public:
public: public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsJsonObject *res); virtual srs_error_t do_serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsJsonObject *res);
public: public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsRtcUserConfig *ruc); virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsRtcUserConfig *ruc);
private: SRS_DECLARE_PRIVATE:
srs_error_t check_remote_sdp(const SrsSdp &remote_sdp); srs_error_t check_remote_sdp(const SrsSdp &remote_sdp);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t http_hooks_on_play(ISrsRequest *req); virtual srs_error_t http_hooks_on_play(ISrsRequest *req);
}; };
class SrsGoApiRtcPublish : public ISrsHttpHandler class SrsGoApiRtcPublish : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsHttpHooks *hooks_; ISrsHttpHooks *hooks_;
private: SRS_DECLARE_PRIVATE:
ISrsRtcApiServer *server_; ISrsRtcApiServer *server_;
ISrsSecurity *security_; ISrsSecurity *security_;
@ -74,26 +74,26 @@ public:
public: public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsJsonObject *res); virtual srs_error_t do_serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsJsonObject *res);
public: public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsRtcUserConfig *ruc); virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsRtcUserConfig *ruc);
private: SRS_DECLARE_PRIVATE:
srs_error_t check_remote_sdp(const SrsSdp &remote_sdp); srs_error_t check_remote_sdp(const SrsSdp &remote_sdp);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t http_hooks_on_publish(ISrsRequest *req); virtual srs_error_t http_hooks_on_publish(ISrsRequest *req);
}; };
// See https://datatracker.ietf.org/doc/draft-ietf-wish-whip/ // See https://datatracker.ietf.org/doc/draft-ietf-wish-whip/
class SrsGoApiRtcWhip : public ISrsHttpHandler class SrsGoApiRtcWhip : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
ISrsRtcApiServer *server_; ISrsRtcApiServer *server_;
SrsGoApiRtcPublish *publish_; SrsGoApiRtcPublish *publish_;
SrsGoApiRtcPlay *play_; SrsGoApiRtcPlay *play_;
@ -105,13 +105,13 @@ public:
public: public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsRtcUserConfig *ruc); virtual srs_error_t do_serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsRtcUserConfig *ruc);
}; };
class SrsGoApiRtcNACK : public ISrsHttpHandler class SrsGoApiRtcNACK : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsRtcApiServer *server_; ISrsRtcApiServer *server_;
public: public:
@ -121,7 +121,7 @@ public:
public: public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsJsonObject *res); virtual srs_error_t do_serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, SrsJsonObject *res);
}; };

View File

@ -58,7 +58,7 @@ public:
// The audio transcoder, transcode audio from one codec to another. // The audio transcoder, transcode audio from one codec to another.
class SrsAudioTranscoder : public ISrsAudioTranscoder class SrsAudioTranscoder : public ISrsAudioTranscoder
{ {
private: SRS_DECLARE_PRIVATE:
AVCodecContext *dec_; AVCodecContext *dec_;
AVFrame *dec_frame_; AVFrame *dec_frame_;
AVPacket *dec_packet_; AVPacket *dec_packet_;
@ -95,7 +95,7 @@ public:
// @remark User should never free the data, it's managed by this transcoder. // @remark User should never free the data, it's managed by this transcoder.
void aac_codec_header(uint8_t **data, int *len); void aac_codec_header(uint8_t **data, int *len);
private: SRS_DECLARE_PRIVATE:
srs_error_t init_dec(SrsAudioCodecId from); srs_error_t init_dec(SrsAudioCodecId from);
srs_error_t init_enc(SrsAudioCodecId to, int channels, int samplerate, int bit_rate); srs_error_t init_enc(SrsAudioCodecId to, int channels, int samplerate, int bit_rate);
srs_error_t init_swr(AVCodecContext *decoder); srs_error_t init_swr(AVCodecContext *decoder);

View File

@ -103,7 +103,7 @@ public:
// The security transport, use DTLS/SRTP to protect the data. // The security transport, use DTLS/SRTP to protect the data.
class SrsSecurityTransport : public ISrsRtcTransport class SrsSecurityTransport : public ISrsRtcTransport
{ {
private: SRS_DECLARE_PRIVATE:
ISrsRtcNetwork *network_; ISrsRtcNetwork *network_;
ISrsDtls *dtls_; ISrsDtls *dtls_;
ISrsSRTP *srtp_; ISrsSRTP *srtp_;
@ -134,7 +134,7 @@ public:
virtual srs_error_t on_dtls_application_data(const char *data, const int len); virtual srs_error_t on_dtls_application_data(const char *data, const int len);
virtual srs_error_t write_dtls_data(void *data, int size); virtual srs_error_t write_dtls_data(void *data, int size);
private: SRS_DECLARE_PRIVATE:
srs_error_t srtp_initialize(); srs_error_t srtp_initialize();
}; };
@ -155,7 +155,7 @@ public:
// Plaintext transport, without DTLS or SRTP. // Plaintext transport, without DTLS or SRTP.
class SrsPlaintextTransport : public ISrsRtcTransport class SrsPlaintextTransport : public ISrsRtcTransport
{ {
private: SRS_DECLARE_PRIVATE:
ISrsRtcNetwork *network_; ISrsRtcNetwork *network_;
public: public:
@ -192,12 +192,12 @@ public:
// A worker coroutine to request the PLI. // A worker coroutine to request the PLI.
class SrsRtcPliWorker : public ISrsCoroutineHandler class SrsRtcPliWorker : public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
ISrsCond *wait_; ISrsCond *wait_;
ISrsRtcPliWorkerHandler *handler_; ISrsRtcPliWorkerHandler *handler_;
private: SRS_DECLARE_PRIVATE:
// Key is SSRC, value is the CID of subscriber which requests PLI. // Key is SSRC, value is the CID of subscriber which requests PLI.
std::map<uint32_t, SrsContextId> plis_; std::map<uint32_t, SrsContextId> plis_;
@ -216,7 +216,7 @@ public:
// the rtc on_stop async call. // the rtc on_stop async call.
class SrsRtcAsyncCallOnStop : public ISrsAsyncCallTask class SrsRtcAsyncCallOnStop : public ISrsAsyncCallTask
{ {
private: SRS_DECLARE_PRIVATE:
SrsContextId cid_; SrsContextId cid_;
ISrsRequest *req_; ISrsRequest *req_;
ISrsHttpHooks *hooks_; ISrsHttpHooks *hooks_;
@ -235,22 +235,22 @@ public:
// A RTC play stream, client pull and play stream from SRS. // A RTC play stream, client pull and play stream from SRS.
class SrsRtcPlayStream : public ISrsCoroutineHandler, public ISrsReloadHandler, public ISrsRtcPliWorkerHandler, public ISrsRtcSourceChangeCallback class SrsRtcPlayStream : public ISrsCoroutineHandler, public ISrsReloadHandler, public ISrsRtcPliWorkerHandler, public ISrsRtcSourceChangeCallback
{ {
private: SRS_DECLARE_PRIVATE:
ISrsExecRtcAsyncTask *exec_; ISrsExecRtcAsyncTask *exec_;
ISrsExpire *expire_; ISrsExpire *expire_;
ISrsRtcPacketSender *sender_; ISrsRtcPacketSender *sender_;
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsRtcSourceManager *rtc_sources_; ISrsRtcSourceManager *rtc_sources_;
ISrsStatistic *stat_; ISrsStatistic *stat_;
private: SRS_DECLARE_PRIVATE:
SrsContextId cid_; SrsContextId cid_;
SrsFastCoroutine *trd_; SrsFastCoroutine *trd_;
SrsRtcPliWorker *pli_worker_; SrsRtcPliWorker *pli_worker_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
SrsSharedPtr<SrsRtcSource> source_; SrsSharedPtr<SrsRtcSource> source_;
// key: publish_ssrc, value: send track to process rtp/rtcp // key: publish_ssrc, value: send track to process rtp/rtcp
@ -259,7 +259,7 @@ private:
// The pithy print for special stage. // The pithy print for special stage.
SrsErrorPithyPrint *nack_epp_; SrsErrorPithyPrint *nack_epp_;
private: SRS_DECLARE_PRIVATE:
// Fast cache for tracks. // Fast cache for tracks.
uint32_t cache_ssrc0_; uint32_t cache_ssrc0_;
uint32_t cache_ssrc1_; uint32_t cache_ssrc1_;
@ -268,7 +268,7 @@ private:
SrsRtcSendTrack *cache_track1_; SrsRtcSendTrack *cache_track1_;
SrsRtcSendTrack *cache_track2_; SrsRtcSendTrack *cache_track2_;
private: SRS_DECLARE_PRIVATE:
// For merged-write messages. // For merged-write messages.
int mw_msgs_; int mw_msgs_;
bool realtime_; bool realtime_;
@ -276,7 +276,7 @@ private:
bool nack_enabled_; bool nack_enabled_;
bool nack_no_copy_; bool nack_no_copy_;
private: SRS_DECLARE_PRIVATE:
// Whether player started. // Whether player started.
bool is_started_; bool is_started_;
@ -300,7 +300,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
srs_error_t send_packet(SrsRtpPacket *&pkt); srs_error_t send_packet(SrsRtpPacket *&pkt);
public: public:
@ -310,7 +310,7 @@ public:
public: public:
srs_error_t on_rtcp(SrsRtcpCommon *rtcp); srs_error_t on_rtcp(SrsRtcpCommon *rtcp);
private: SRS_DECLARE_PRIVATE:
srs_error_t on_rtcp_xr(SrsRtcpXr *rtcp); srs_error_t on_rtcp_xr(SrsRtcpXr *rtcp);
srs_error_t on_rtcp_nack(SrsRtcpNack *rtcp); srs_error_t on_rtcp_nack(SrsRtcpNack *rtcp);
srs_error_t on_rtcp_ps_feedback(SrsRtcpFbCommon *rtcp); srs_error_t on_rtcp_ps_feedback(SrsRtcpFbCommon *rtcp);
@ -341,7 +341,7 @@ public:
// A fast timer for publish stream, for RTCP feedback. // A fast timer for publish stream, for RTCP feedback.
class SrsRtcPublishRtcpTimer : public ISrsFastTimerHandler class SrsRtcPublishRtcpTimer : public ISrsFastTimerHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsRtcRtcpSender *sender_; ISrsRtcRtcpSender *sender_;
srs_mutex_t lock_; srs_mutex_t lock_;
@ -349,17 +349,17 @@ public:
SrsRtcPublishRtcpTimer(ISrsRtcRtcpSender *sender); SrsRtcPublishRtcpTimer(ISrsRtcRtcpSender *sender);
virtual ~SrsRtcPublishRtcpTimer(); virtual ~SrsRtcPublishRtcpTimer();
// interface ISrsFastTimerHandler // interface ISrsFastTimerHandler
private: SRS_DECLARE_PRIVATE:
srs_error_t on_timer(srs_utime_t interval); srs_error_t on_timer(srs_utime_t interval);
}; };
// A fast timer for publish stream, for TWCC feedback. // A fast timer for publish stream, for TWCC feedback.
class SrsRtcPublishTwccTimer : public ISrsFastTimerHandler class SrsRtcPublishTwccTimer : public ISrsFastTimerHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsCircuitBreaker *circuit_breaker_; ISrsCircuitBreaker *circuit_breaker_;
private: SRS_DECLARE_PRIVATE:
ISrsRtcRtcpSender *sender_; ISrsRtcRtcpSender *sender_;
srs_mutex_t lock_; srs_mutex_t lock_;
@ -367,18 +367,18 @@ public:
SrsRtcPublishTwccTimer(ISrsRtcRtcpSender *sender); SrsRtcPublishTwccTimer(ISrsRtcRtcpSender *sender);
virtual ~SrsRtcPublishTwccTimer(); virtual ~SrsRtcPublishTwccTimer();
// interface ISrsFastTimerHandler // interface ISrsFastTimerHandler
private: SRS_DECLARE_PRIVATE:
srs_error_t on_timer(srs_utime_t interval); srs_error_t on_timer(srs_utime_t interval);
}; };
// the rtc on_unpublish async call. // the rtc on_unpublish async call.
class SrsRtcAsyncCallOnUnpublish : public ISrsAsyncCallTask class SrsRtcAsyncCallOnUnpublish : public ISrsAsyncCallTask
{ {
private: SRS_DECLARE_PRIVATE:
ISrsHttpHooks *hooks_; ISrsHttpHooks *hooks_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
SrsContextId cid_; SrsContextId cid_;
ISrsRequest *req_; ISrsRequest *req_;
@ -394,54 +394,54 @@ public:
// A RTC publish stream, client push and publish stream to SRS. // A RTC publish stream, client push and publish stream to SRS.
class SrsRtcPublishStream : public ISrsRtpPacketDecodeHandler, public ISrsRtcPublishStream, public ISrsRtcPliWorkerHandler, public ISrsRtcRtcpSender class SrsRtcPublishStream : public ISrsRtpPacketDecodeHandler, public ISrsRtcPublishStream, public ISrsRtcPliWorkerHandler, public ISrsRtcRtcpSender
{ {
private: SRS_DECLARE_PRIVATE:
ISrsExecRtcAsyncTask *exec_; ISrsExecRtcAsyncTask *exec_;
ISrsExpire *expire_; ISrsExpire *expire_;
ISrsRtcPacketReceiver *receiver_; ISrsRtcPacketReceiver *receiver_;
ISrsCircuitBreaker *circuit_breaker_; ISrsCircuitBreaker *circuit_breaker_;
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsRtcSourceManager *rtc_sources_; ISrsRtcSourceManager *rtc_sources_;
ISrsLiveSourceManager *live_sources_; ISrsLiveSourceManager *live_sources_;
ISrsSrtSourceManager *srt_sources_; ISrsSrtSourceManager *srt_sources_;
private: SRS_DECLARE_PRIVATE:
friend class SrsRtcPublishRtcpTimer; friend class SrsRtcPublishRtcpTimer;
friend class SrsRtcPublishTwccTimer; friend class SrsRtcPublishTwccTimer;
SrsRtcPublishRtcpTimer *timer_rtcp_; SrsRtcPublishRtcpTimer *timer_rtcp_;
SrsRtcPublishTwccTimer *timer_twcc_; SrsRtcPublishTwccTimer *timer_twcc_;
private: SRS_DECLARE_PRIVATE:
SrsContextId cid_; SrsContextId cid_;
uint64_t nn_audio_frames_; uint64_t nn_audio_frames_;
SrsRtcPliWorker *pli_worker_; SrsRtcPliWorker *pli_worker_;
SrsErrorPithyPrint *twcc_epp_; SrsErrorPithyPrint *twcc_epp_;
private: SRS_DECLARE_PRIVATE:
uint16_t pt_to_drop_; uint16_t pt_to_drop_;
// Whether enabled nack. // Whether enabled nack.
bool nack_enabled_; bool nack_enabled_;
bool nack_no_copy_; bool nack_no_copy_;
bool twcc_enabled_; bool twcc_enabled_;
private: SRS_DECLARE_PRIVATE:
bool request_keyframe_; bool request_keyframe_;
SrsErrorPithyPrint *pli_epp_; SrsErrorPithyPrint *pli_epp_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
SrsSharedPtr<SrsRtcSource> source_; SrsSharedPtr<SrsRtcSource> source_;
// Simulators. // Simulators.
int nn_simulate_nack_drop_; int nn_simulate_nack_drop_;
private: SRS_DECLARE_PRIVATE:
// track vector // track vector
std::vector<SrsRtcAudioRecvTrack *> audio_tracks_; std::vector<SrsRtcAudioRecvTrack *> audio_tracks_;
std::vector<SrsRtcVideoRecvTrack *> video_tracks_; std::vector<SrsRtcVideoRecvTrack *> video_tracks_;
private: SRS_DECLARE_PRIVATE:
int twcc_id_; int twcc_id_;
uint8_t twcc_fb_count_; uint8_t twcc_fb_count_;
SrsRtcpTWCC rtcp_twcc_; SrsRtcpTWCC rtcp_twcc_;
@ -460,7 +460,7 @@ public:
void set_all_tracks_status(bool status); void set_all_tracks_status(bool status);
virtual const SrsContextId &context_id(); virtual const SrsContextId &context_id();
private: SRS_DECLARE_PRIVATE:
bool is_sender_started(); bool is_sender_started();
bool is_sender_twcc_enabled(); bool is_sender_twcc_enabled();
srs_error_t send_rtcp_rr(); srs_error_t send_rtcp_rr();
@ -470,7 +470,7 @@ public:
srs_error_t on_rtp_cipher(char *buf, int nb_buf); srs_error_t on_rtp_cipher(char *buf, int nb_buf);
srs_error_t on_rtp_plaintext(char *buf, int nb_buf); srs_error_t on_rtp_plaintext(char *buf, int nb_buf);
private: SRS_DECLARE_PRIVATE:
srs_error_t do_on_rtp_plaintext(SrsRtpPacket *&pkt, SrsBuffer *buf); srs_error_t do_on_rtp_plaintext(SrsRtpPacket *&pkt, SrsBuffer *buf);
public: public:
@ -479,13 +479,13 @@ public:
public: public:
virtual void on_before_decode_payload(SrsRtpPacket *pkt, SrsBuffer *buf, ISrsRtpPayloader **ppayload, SrsRtpPacketPayloadType *ppt); virtual void on_before_decode_payload(SrsRtpPacket *pkt, SrsBuffer *buf, ISrsRtpPayloader **ppayload, SrsRtpPacketPayloadType *ppt);
private: SRS_DECLARE_PRIVATE:
srs_error_t send_periodic_twcc(); srs_error_t send_periodic_twcc();
public: public:
srs_error_t on_rtcp(SrsRtcpCommon *rtcp); srs_error_t on_rtcp(SrsRtcpCommon *rtcp);
private: SRS_DECLARE_PRIVATE:
srs_error_t on_rtcp_sr(SrsRtcpSR *rtcp); srs_error_t on_rtcp_sr(SrsRtcpSR *rtcp);
srs_error_t on_rtcp_xr(SrsRtcpXr *rtcp); srs_error_t on_rtcp_xr(SrsRtcpXr *rtcp);
@ -496,10 +496,10 @@ public:
public: public:
void simulate_nack_drop(int nn); void simulate_nack_drop(int nn);
private: SRS_DECLARE_PRIVATE:
void simulate_drop_packet(SrsRtpHeader *h, int nn_bytes); void simulate_drop_packet(SrsRtpHeader *h, int nn_bytes);
private: SRS_DECLARE_PRIVATE:
srs_error_t on_twcc(uint16_t sn); srs_error_t on_twcc(uint16_t sn);
SrsRtcAudioRecvTrack *get_audio_track(uint32_t ssrc); SrsRtcAudioRecvTrack *get_audio_track(uint32_t ssrc);
SrsRtcVideoRecvTrack *get_video_track(uint32_t ssrc); SrsRtcVideoRecvTrack *get_video_track(uint32_t ssrc);
@ -521,11 +521,11 @@ public:
// A fast timer for conntion, for NACK feedback. // A fast timer for conntion, for NACK feedback.
class SrsRtcConnectionNackTimer : public ISrsFastTimerHandler class SrsRtcConnectionNackTimer : public ISrsFastTimerHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsSharedTimer *shared_timer_; ISrsSharedTimer *shared_timer_;
ISrsCircuitBreaker *circuit_breaker_; ISrsCircuitBreaker *circuit_breaker_;
private: SRS_DECLARE_PRIVATE:
ISrsRtcConnectionNackTimerHandler *handler_; ISrsRtcConnectionNackTimerHandler *handler_;
srs_mutex_t lock_; srs_mutex_t lock_;
@ -537,7 +537,7 @@ public:
virtual srs_error_t initialize(); virtual srs_error_t initialize();
// interface ISrsFastTimerHandler // interface ISrsFastTimerHandler
private: SRS_DECLARE_PRIVATE:
srs_error_t on_timer(srs_utime_t interval); srs_error_t on_timer(srs_utime_t interval);
}; };
@ -609,13 +609,13 @@ class SrsRtcConnection : public ISrsRtcConnection
{ {
friend class SrsSecurityTransport; friend class SrsSecurityTransport;
private: SRS_DECLARE_PRIVATE:
ISrsCircuitBreaker *circuit_breaker_; ISrsCircuitBreaker *circuit_breaker_;
ISrsResourceManager *conn_manager_; ISrsResourceManager *conn_manager_;
ISrsRtcSourceManager *rtc_sources_; ISrsRtcSourceManager *rtc_sources_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
SrsRtcConnectionNackTimer *timer_nack_; SrsRtcConnectionNackTimer *timer_nack_;
ISrsExecRtcAsyncTask *exec_; ISrsExecRtcAsyncTask *exec_;
SrsRtcPublisherNegotiator *publisher_negotiator_; SrsRtcPublisherNegotiator *publisher_negotiator_;
@ -624,11 +624,11 @@ private:
public: public:
bool disposing_; bool disposing_;
private: SRS_DECLARE_PRIVATE:
iovec *cache_iov_; iovec *cache_iov_;
SrsBuffer *cache_buffer_; SrsBuffer *cache_buffer_;
private: SRS_DECLARE_PRIVATE:
// key: stream id // key: stream id
std::map<std::string, SrsRtcPlayStream *> players_; std::map<std::string, SrsRtcPlayStream *> players_;
// key: player track's ssrc // key: player track's ssrc
@ -638,7 +638,7 @@ private:
// key: publisher track's ssrc // key: publisher track's ssrc
std::map<uint32_t, SrsRtcPublishStream *> publishers_ssrc_map_; std::map<uint32_t, SrsRtcPublishStream *> publishers_ssrc_map_;
private: SRS_DECLARE_PRIVATE:
// The local:remote username, such as m5x0n128:jvOm where local name is m5x0n128. // The local:remote username, such as m5x0n128:jvOm where local name is m5x0n128.
std::string username_; std::string username_;
// The random token to verify the WHIP DELETE request etc. // The random token to verify the WHIP DELETE request etc.
@ -646,14 +646,14 @@ private:
// A group of networks, each has its own DTLS and SRTP context. // A group of networks, each has its own DTLS and SRTP context.
SrsRtcNetworks *networks_; SrsRtcNetworks *networks_;
private: SRS_DECLARE_PRIVATE:
// TODO: FIXME: Rename it. // TODO: FIXME: Rename it.
// The timeout of session, keep alive by STUN ping pong. // The timeout of session, keep alive by STUN ping pong.
srs_utime_t session_timeout_; srs_utime_t session_timeout_;
// TODO: FIXME: Rename it. // TODO: FIXME: Rename it.
srs_utime_t last_stun_time_; srs_utime_t last_stun_time_;
private: SRS_DECLARE_PRIVATE:
// For each RTC session, we use a specified cid for debugging logs. // For each RTC session, we use a specified cid for debugging logs.
SrsContextId cid_; SrsContextId cid_;
ISrsRequest *req_; ISrsRequest *req_;
@ -661,7 +661,7 @@ private:
SrsSdp local_sdp_; SrsSdp local_sdp_;
SrsSharedPtr<SrsStreamPublishToken> publish_token_; SrsSharedPtr<SrsStreamPublishToken> publish_token_;
private: SRS_DECLARE_PRIVATE:
// twcc handler // twcc handler
int twcc_id_; int twcc_id_;
// Simulators. // Simulators.
@ -669,7 +669,7 @@ private:
// Pithy print for PLI request. // Pithy print for PLI request.
SrsErrorPithyPrint *pli_epp_; SrsErrorPithyPrint *pli_epp_;
private: SRS_DECLARE_PRIVATE:
bool nack_enabled_; bool nack_enabled_;
public: public:
@ -721,14 +721,14 @@ public:
srs_error_t on_rtp_cipher(char *data, int nb_data); srs_error_t on_rtp_cipher(char *data, int nb_data);
srs_error_t on_rtp_plaintext(char *data, int nb_data); srs_error_t on_rtp_plaintext(char *data, int nb_data);
private: SRS_DECLARE_PRIVATE:
// Decode the RTP header from buf, find the publisher by SSRC. // Decode the RTP header from buf, find the publisher by SSRC.
srs_error_t find_publisher(char *buf, int size, SrsRtcPublishStream **ppublisher); srs_error_t find_publisher(char *buf, int size, SrsRtcPublishStream **ppublisher);
public: public:
srs_error_t on_rtcp(char *data, int nb_data); srs_error_t on_rtcp(char *data, int nb_data);
private: SRS_DECLARE_PRIVATE:
srs_error_t dispatch_rtcp(SrsRtcpCommon *rtcp); srs_error_t dispatch_rtcp(SrsRtcpCommon *rtcp);
public: public:
@ -770,7 +770,7 @@ public:
// Notify by specified network. // Notify by specified network.
srs_error_t on_binding_request(SrsStunPacket *r, std::string &ice_pwd); srs_error_t on_binding_request(SrsStunPacket *r, std::string &ice_pwd);
private: SRS_DECLARE_PRIVATE:
srs_error_t create_player(ISrsRequest *request, std::map<uint32_t, SrsRtcTrackDescription *> sub_relations); srs_error_t create_player(ISrsRequest *request, std::map<uint32_t, SrsRtcTrackDescription *> sub_relations);
srs_error_t create_publisher(ISrsRequest *request, SrsRtcSourceDescription *stream_desc); srs_error_t create_publisher(ISrsRequest *request, SrsRtcSourceDescription *stream_desc);
}; };
@ -778,7 +778,7 @@ private:
// Negotiate via SDP exchange for WebRTC publisher. // Negotiate via SDP exchange for WebRTC publisher.
class SrsRtcPublisherNegotiator class SrsRtcPublisherNegotiator
{ {
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
@ -798,7 +798,7 @@ public:
// Negotiate via SDP exchange for WebRTC player. // Negotiate via SDP exchange for WebRTC player.
class SrsRtcPlayerNegotiator class SrsRtcPlayerNegotiator
{ {
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsRtcSourceManager *rtc_sources_; ISrsRtcSourceManager *rtc_sources_;

View File

@ -34,7 +34,7 @@ public:
// The DTLS certificate. // The DTLS certificate.
class SrsDtlsCertificate : public ISrsDtlsCertificate class SrsDtlsCertificate : public ISrsDtlsCertificate
{ {
private: SRS_DECLARE_PRIVATE:
std::string fingerprint_; std::string fingerprint_;
bool ecdsa_mode_; bool ecdsa_mode_;
X509 *dtls_cert_; X509 *dtls_cert_;
@ -104,7 +104,7 @@ enum SrsDtlsState {
class SrsDtlsImpl class SrsDtlsImpl
{ {
protected: SRS_DECLARE_PROTECTED:
SSL_CTX *dtls_ctx_; SSL_CTX *dtls_ctx_;
SSL *dtls_; SSL *dtls_;
BIO *bio_in_; BIO *bio_in_;
@ -113,7 +113,7 @@ protected:
// @remark: dtls_version_ default value is SrsDtlsVersionAuto. // @remark: dtls_version_ default value is SrsDtlsVersionAuto.
SrsDtlsVersion version_; SrsDtlsVersion version_;
protected: SRS_DECLARE_PROTECTED:
// Whether the handshake is done, for us only. // Whether the handshake is done, for us only.
// @remark For us only, means peer maybe not done, we also need to handle the DTLS packet. // @remark For us only, means peer maybe not done, we also need to handle the DTLS packet.
bool handshake_done_for_us_; bool handshake_done_for_us_;
@ -135,7 +135,7 @@ public:
virtual srs_error_t start_active_handshake(); virtual srs_error_t start_active_handshake();
virtual srs_error_t on_dtls(char *data, int nb_data); virtual srs_error_t on_dtls(char *data, int nb_data);
protected: SRS_DECLARE_PROTECTED:
srs_error_t do_on_dtls(char *data, int nb_data); srs_error_t do_on_dtls(char *data, int nb_data);
void state_trace(uint8_t *data, int length, bool incoming, int r0); void state_trace(uint8_t *data, int length, bool incoming, int r0);
@ -143,7 +143,7 @@ public:
srs_error_t get_srtp_key(std::string &recv_key, std::string &send_key); srs_error_t get_srtp_key(std::string &recv_key, std::string &send_key);
void callback_by_ssl(std::string type, std::string desc); void callback_by_ssl(std::string type, std::string desc);
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t on_handshake_done() = 0; virtual srs_error_t on_handshake_done() = 0;
virtual bool is_dtls_client() = 0; virtual bool is_dtls_client() = 0;
virtual srs_error_t start_arq() = 0; virtual srs_error_t start_arq() = 0;
@ -151,7 +151,7 @@ protected:
class SrsDtlsClientImpl : public SrsDtlsImpl, public ISrsCoroutineHandler class SrsDtlsClientImpl : public SrsDtlsImpl, public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
// ARQ thread, for role active(DTLS client). // ARQ thread, for role active(DTLS client).
// @note If passive(DTLS server), the ARQ is driven by DTLS client. // @note If passive(DTLS server), the ARQ is driven by DTLS client.
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
@ -167,11 +167,11 @@ public:
public: public:
virtual srs_error_t initialize(std::string version, std::string role); virtual srs_error_t initialize(std::string version, std::string role);
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t on_handshake_done(); virtual srs_error_t on_handshake_done();
virtual bool is_dtls_client(); virtual bool is_dtls_client();
protected: SRS_DECLARE_PROTECTED:
srs_error_t start_arq(); srs_error_t start_arq();
void stop_arq(); void stop_arq();
@ -188,7 +188,7 @@ public:
public: public:
virtual srs_error_t initialize(std::string version, std::string role); virtual srs_error_t initialize(std::string version, std::string role);
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t on_handshake_done(); virtual srs_error_t on_handshake_done();
virtual bool is_dtls_client(); virtual bool is_dtls_client();
srs_error_t start_arq(); srs_error_t start_arq();
@ -208,7 +208,7 @@ public:
srs_error_t get_srtp_key(std::string &recv_key, std::string &send_key); srs_error_t get_srtp_key(std::string &recv_key, std::string &send_key);
void callback_by_ssl(std::string type, std::string desc); void callback_by_ssl(std::string type, std::string desc);
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t on_handshake_done(); virtual srs_error_t on_handshake_done();
virtual bool is_dtls_client(); virtual bool is_dtls_client();
virtual srs_error_t start_arq(); virtual srs_error_t start_arq();
@ -231,7 +231,7 @@ public:
// The DTLS transport. // The DTLS transport.
class SrsDtls : public ISrsDtls class SrsDtls : public ISrsDtls
{ {
private: SRS_DECLARE_PRIVATE:
SrsDtlsImpl *impl_; SrsDtlsImpl *impl_;
ISrsDtlsCallback *callback_; ISrsDtlsCallback *callback_;
@ -271,7 +271,7 @@ public:
// The SRTP transport. // The SRTP transport.
class SrsSRTP : public ISrsSRTP class SrsSRTP : public ISrsSRTP
{ {
private: SRS_DECLARE_PRIVATE:
srtp_t recv_ctx_; srtp_t recv_ctx_;
srtp_t send_ctx_; srtp_t send_ctx_;

View File

@ -62,7 +62,7 @@ public:
// A group of networks, each has its own DTLS and SRTP context. // A group of networks, each has its own DTLS and SRTP context.
class SrsRtcNetworks : public ISrsRtcNetworks class SrsRtcNetworks : public ISrsRtcNetworks
{ {
private: SRS_DECLARE_PRIVATE:
// Network over UDP. // Network over UDP.
ISrsRtcNetwork *udp_; ISrsRtcNetwork *udp_;
// Network over TCP // Network over TCP
@ -70,7 +70,7 @@ private:
// Network over dummy // Network over dummy
ISrsRtcNetwork *dummy_; ISrsRtcNetwork *dummy_;
private: SRS_DECLARE_PRIVATE:
// WebRTC session object. // WebRTC session object.
ISrsRtcConnection *conn_; ISrsRtcConnection *conn_;
// Delta object for statistics. // Delta object for statistics.
@ -170,17 +170,17 @@ public:
// The WebRTC over UDP network. // The WebRTC over UDP network.
class SrsRtcUdpNetwork : public ISrsRtcNetwork class SrsRtcUdpNetwork : public ISrsRtcNetwork
{ {
private: SRS_DECLARE_PRIVATE:
ISrsResourceManager *conn_manager_; ISrsResourceManager *conn_manager_;
private: SRS_DECLARE_PRIVATE:
// WebRTC session object. // WebRTC session object.
ISrsRtcConnection *conn_; ISrsRtcConnection *conn_;
// Delta object for statistics. // Delta object for statistics.
ISrsEphemeralDelta *delta_; ISrsEphemeralDelta *delta_;
SrsRtcNetworkState state_; SrsRtcNetworkState state_;
private: SRS_DECLARE_PRIVATE:
// Pithy print for address change, use port as error code. // Pithy print for address change, use port as error code.
SrsErrorPithyPrint *pp_address_change_; SrsErrorPithyPrint *pp_address_change_;
// The peer address, client maybe use more than one address, it's the current selected one. // The peer address, client maybe use more than one address, it's the current selected one.
@ -200,7 +200,7 @@ public:
// When got STUN ping message. The peer address may change, we can identify that by STUN messages. // When got STUN ping message. The peer address may change, we can identify that by STUN messages.
srs_error_t on_stun(SrsStunPacket *r, char *data, int nb_data); srs_error_t on_stun(SrsStunPacket *r, char *data, int nb_data);
private: SRS_DECLARE_PRIVATE:
srs_error_t on_binding_request(SrsStunPacket *r, std::string ice_pwd); srs_error_t on_binding_request(SrsStunPacket *r, std::string ice_pwd);
// DTLS transport functions. // DTLS transport functions.
public: public:
@ -229,17 +229,17 @@ public:
class SrsRtcTcpNetwork : public ISrsRtcNetwork class SrsRtcTcpNetwork : public ISrsRtcNetwork
{ {
private: SRS_DECLARE_PRIVATE:
ISrsRtcConnection *conn_; ISrsRtcConnection *conn_;
ISrsEphemeralDelta *delta_; ISrsEphemeralDelta *delta_;
ISrsProtocolReadWriter *sendonly_skt_; ISrsProtocolReadWriter *sendonly_skt_;
private: SRS_DECLARE_PRIVATE:
// The DTLS transport over this network. // The DTLS transport over this network.
ISrsRtcTransport *transport_; ISrsRtcTransport *transport_;
SrsSharedResource<ISrsRtcTcpConn> owner_; SrsSharedResource<ISrsRtcTcpConn> owner_;
private: SRS_DECLARE_PRIVATE:
std::string peer_ip_; std::string peer_ip_;
int peer_port_; int peer_port_;
SrsRtcNetworkState state_; SrsRtcNetworkState state_;
@ -266,7 +266,7 @@ public:
// When got STUN ping message. The peer address may change, we can identify that by STUN messages. // When got STUN ping message. The peer address may change, we can identify that by STUN messages.
srs_error_t on_stun(SrsStunPacket *r, char *data, int nb_data); srs_error_t on_stun(SrsStunPacket *r, char *data, int nb_data);
private: SRS_DECLARE_PRIVATE:
srs_error_t on_binding_request(SrsStunPacket *r, std::string ice_pwd); srs_error_t on_binding_request(SrsStunPacket *r, std::string ice_pwd);
// DTLS transport functions. // DTLS transport functions.
public: public:
@ -308,15 +308,15 @@ public:
// For WebRTC over TCP. // For WebRTC over TCP.
class SrsRtcTcpConn : public ISrsRtcTcpConn class SrsRtcTcpConn : public ISrsRtcTcpConn
{ {
private: SRS_DECLARE_PRIVATE:
ISrsResourceManager *conn_manager_; ISrsResourceManager *conn_manager_;
ISrsStatistic *stat_; ISrsStatistic *stat_;
private: SRS_DECLARE_PRIVATE:
// Because session references to this object, so we should directly use the session ptr. // Because session references to this object, so we should directly use the session ptr.
ISrsRtcConnection *session_; ISrsRtcConnection *session_;
private: SRS_DECLARE_PRIVATE:
// The ip and port of client. // The ip and port of client.
std::string ip_; std::string ip_;
int port_; int port_;
@ -326,7 +326,7 @@ private:
// Packet cache. // Packet cache.
char *pkt_; char *pkt_;
private: SRS_DECLARE_PRIVATE:
// The shared resource which own this object, we should never free it because it's managed by shared ptr. // The shared resource which own this object, we should never free it because it's managed by shared ptr.
SrsSharedResource<ISrsRtcTcpConn> *wrapper_; SrsSharedResource<ISrsRtcTcpConn> *wrapper_;
// The owner coroutine, allow user to interrupt the loop. // The owner coroutine, allow user to interrupt the loop.
@ -334,7 +334,7 @@ private:
ISrsContextIdSetter *owner_cid_; ISrsContextIdSetter *owner_cid_;
SrsContextId cid_; SrsContextId cid_;
private: SRS_DECLARE_PRIVATE:
void setup(); void setup();
public: public:
@ -364,7 +364,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
srs_error_t handshake(); srs_error_t handshake();
srs_error_t read_packet(char *pkt, int *nb_pkt); srs_error_t read_packet(char *pkt, int *nb_pkt);

View File

@ -45,7 +45,7 @@ class SrsRtcBlackhole
public: public:
bool blackhole_; bool blackhole_;
private: SRS_DECLARE_PRIVATE:
sockaddr_in *blackhole_addr_; sockaddr_in *blackhole_addr_;
srs_netfd_t blackhole_stfd_; srs_netfd_t blackhole_stfd_;
@ -100,7 +100,7 @@ extern std::string srs_dns_resolve(std::string host, int &family);
// RTC session manager to handle WebRTC session lifecycle and management. // RTC session manager to handle WebRTC session lifecycle and management.
class SrsRtcSessionManager : public ISrsExecRtcAsyncTask class SrsRtcSessionManager : public ISrsExecRtcAsyncTask
{ {
private: SRS_DECLARE_PRIVATE:
ISrsResourceManager *conn_manager_; ISrsResourceManager *conn_manager_;
ISrsStreamPublishTokenManager *stream_publish_tokens_; ISrsStreamPublishTokenManager *stream_publish_tokens_;
ISrsRtcSourceManager *rtc_sources_; ISrsRtcSourceManager *rtc_sources_;
@ -108,7 +108,7 @@ private:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
// WebRTC async call worker for non-blocking operations. // WebRTC async call worker for non-blocking operations.
SrsAsyncCallWorker *rtc_async_; SrsAsyncCallWorker *rtc_async_;
@ -123,7 +123,7 @@ public:
virtual ISrsRtcConnection *find_rtc_session_by_username(const std::string &ufrag); virtual ISrsRtcConnection *find_rtc_session_by_username(const std::string &ufrag);
virtual srs_error_t create_rtc_session(SrsRtcUserConfig *ruc, SrsSdp &local_sdp, ISrsRtcConnection **psession); virtual srs_error_t create_rtc_session(SrsRtcUserConfig *ruc, SrsSdp &local_sdp, ISrsRtcConnection **psession);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_create_rtc_session(SrsRtcUserConfig *ruc, SrsSdp &local_sdp, ISrsRtcConnection *session); virtual srs_error_t do_create_rtc_session(SrsRtcUserConfig *ruc, SrsSdp &local_sdp, ISrsRtcConnection *session);
public: public:

View File

@ -119,11 +119,11 @@ public:
// The RTC stream consumer, consume packets from RTC stream source. // The RTC stream consumer, consume packets from RTC stream source.
class SrsRtcConsumer : public ISrsRtcConsumer class SrsRtcConsumer : public ISrsRtcConsumer
{ {
private: SRS_DECLARE_PRIVATE:
// Because source references to this object, so we should directly use the source ptr. // Because source references to this object, so we should directly use the source ptr.
ISrsRtcSourceForConsumer *source_; ISrsRtcSourceForConsumer *source_;
private: SRS_DECLARE_PRIVATE:
std::vector<SrsRtpPacket *> queue_; std::vector<SrsRtpPacket *> queue_;
// when source id changed, notice all consumers // when source id changed, notice all consumers
bool should_update_source_id_; bool should_update_source_id_;
@ -132,7 +132,7 @@ private:
bool mw_waiting_; bool mw_waiting_;
int mw_min_msgs_; int mw_min_msgs_;
private: SRS_DECLARE_PRIVATE:
// The callback for stream change event. // The callback for stream change event.
ISrsRtcSourceChangeCallback *handler_; ISrsRtcSourceChangeCallback *handler_;
@ -172,7 +172,7 @@ public:
// The RTC source manager. // The RTC source manager.
class SrsRtcSourceManager : public ISrsRtcSourceManager, public ISrsHourGlassHandler class SrsRtcSourceManager : public ISrsRtcSourceManager, public ISrsHourGlassHandler
{ {
private: SRS_DECLARE_PRIVATE:
srs_mutex_t lock_; srs_mutex_t lock_;
std::map<std::string, SrsSharedPtr<SrsRtcSource> > pool_; std::map<std::string, SrsSharedPtr<SrsRtcSource> > pool_;
SrsHourGlass *timer_; SrsHourGlass *timer_;
@ -184,7 +184,7 @@ public:
public: public:
virtual srs_error_t initialize(); virtual srs_error_t initialize();
// interface ISrsHourGlassHandler // interface ISrsHourGlassHandler
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t setup_ticks(); virtual srs_error_t setup_ticks();
virtual srs_error_t notify(int event, srs_utime_t interval, srs_utime_t tick); virtual srs_error_t notify(int event, srs_utime_t interval, srs_utime_t tick);
@ -233,11 +233,11 @@ public:
// A Source is a stream, to publish and to play with, binding to SrsRtcPublishStream and SrsRtcPlayStream. // A Source is a stream, to publish and to play with, binding to SrsRtcPublishStream and SrsRtcPlayStream.
class SrsRtcSource : public ISrsRtpTarget, public ISrsFastTimerHandler, public ISrsRtcSourceForConsumer class SrsRtcSource : public ISrsRtpTarget, public ISrsFastTimerHandler, public ISrsRtcSourceForConsumer
{ {
private: SRS_DECLARE_PRIVATE:
// The RTP bridge, convert RTP packets to other protocols. // The RTP bridge, convert RTP packets to other protocols.
ISrsRtcBridge *rtc_bridge_; ISrsRtcBridge *rtc_bridge_;
private: SRS_DECLARE_PRIVATE:
// Circuit breaker for protecting server resources. // Circuit breaker for protecting server resources.
ISrsCircuitBreaker *circuit_breaker_; ISrsCircuitBreaker *circuit_breaker_;
// For publish, it's the publish client id. // For publish, it's the publish client id.
@ -252,7 +252,7 @@ private:
// Steam description for this steam. // Steam description for this steam.
SrsRtcSourceDescription *stream_desc_; SrsRtcSourceDescription *stream_desc_;
private: SRS_DECLARE_PRIVATE:
// To delivery stream to clients. // To delivery stream to clients.
std::vector<ISrsRtcConsumer *> consumers_; std::vector<ISrsRtcConsumer *> consumers_;
// Whether stream is created, that is, SDP is done. // Whether stream is created, that is, SDP is done.
@ -262,12 +262,12 @@ private:
// Notify stream event to event handler // Notify stream event to event handler
std::vector<ISrsRtcSourceEventHandler *> event_handlers_; std::vector<ISrsRtcSourceEventHandler *> event_handlers_;
private: SRS_DECLARE_PRIVATE:
// The PLI for RTC2RTMP. // The PLI for RTC2RTMP.
srs_utime_t pli_for_rtmp_; srs_utime_t pli_for_rtmp_;
srs_utime_t pli_elapsed_; srs_utime_t pli_elapsed_;
private: SRS_DECLARE_PRIVATE:
// The last die time, while die means neither publishers nor players. // The last die time, while die means neither publishers nor players.
srs_utime_t stream_die_at_; srs_utime_t stream_die_at_;
@ -282,14 +282,14 @@ public:
// Whether stream is dead, which is no publisher or player. // Whether stream is dead, which is no publisher or player.
virtual bool stream_is_dead(); virtual bool stream_is_dead();
private: SRS_DECLARE_PRIVATE:
void init_for_play_before_publishing(); void init_for_play_before_publishing();
public: public:
// Update the authentication information in request. // Update the authentication information in request.
virtual void update_auth(ISrsRequest *r); virtual void update_auth(ISrsRequest *r);
private: SRS_DECLARE_PRIVATE:
// The stream source changed. // The stream source changed.
virtual srs_error_t on_source_changed(); virtual srs_error_t on_source_changed();
@ -337,7 +337,7 @@ public:
virtual void set_stream_desc(SrsRtcSourceDescription *stream_desc); virtual void set_stream_desc(SrsRtcSourceDescription *stream_desc);
virtual std::vector<SrsRtcTrackDescription *> get_track_desc(std::string type, std::string media_type); virtual std::vector<SrsRtcTrackDescription *> get_track_desc(std::string type, std::string media_type);
// interface ISrsFastTimerHandler // interface ISrsFastTimerHandler
private: SRS_DECLARE_PRIVATE:
srs_error_t on_timer(srs_utime_t interval); srs_error_t on_timer(srs_utime_t interval);
}; };
@ -346,7 +346,7 @@ private:
// Convert AV frame to RTC RTP packets. // Convert AV frame to RTC RTP packets.
class SrsRtcRtpBuilder class SrsRtcRtpBuilder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
ISrsRtpTarget *rtp_target_; ISrsRtpTarget *rtp_target_;
// The format, codec information. // The format, codec information.
@ -356,7 +356,7 @@ private:
// The video builder, convert frame to RTP packets. // The video builder, convert frame to RTP packets.
SrsRtpVideoBuilder *video_builder_; SrsRtpVideoBuilder *video_builder_;
private: SRS_DECLARE_PRIVATE:
SrsAudioCodecId latest_codec_; SrsAudioCodecId latest_codec_;
ISrsAudioTranscoder *codec_; ISrsAudioTranscoder *codec_;
bool keep_bframe_; bool keep_bframe_;
@ -364,11 +364,11 @@ private:
bool merge_nalus_; bool merge_nalus_;
uint16_t audio_sequence_; uint16_t audio_sequence_;
private: SRS_DECLARE_PRIVATE:
uint32_t audio_ssrc_; uint32_t audio_ssrc_;
uint8_t audio_payload_type_; uint8_t audio_payload_type_;
private: SRS_DECLARE_PRIVATE:
SrsSharedPtr<SrsRtcSource> source_; SrsSharedPtr<SrsRtcSource> source_;
// Lazy initialization flags // Lazy initialization flags
bool audio_initialized_; bool audio_initialized_;
@ -378,7 +378,7 @@ public:
SrsRtcRtpBuilder(ISrsRtpTarget *target, SrsSharedPtr<SrsRtcSource> source); SrsRtcRtpBuilder(ISrsRtpTarget *target, SrsSharedPtr<SrsRtcSource> source);
virtual ~SrsRtcRtpBuilder(); virtual ~SrsRtcRtpBuilder();
private: SRS_DECLARE_PRIVATE:
// Lazy initialization methods // Lazy initialization methods
srs_error_t initialize_audio_track(SrsAudioCodecId codec); srs_error_t initialize_audio_track(SrsAudioCodecId codec);
srs_error_t initialize_video_track(SrsVideoCodecId codec); srs_error_t initialize_video_track(SrsVideoCodecId codec);
@ -389,18 +389,18 @@ public:
virtual void on_unpublish(); virtual void on_unpublish();
virtual srs_error_t on_frame(SrsMediaPacket *frame); virtual srs_error_t on_frame(SrsMediaPacket *frame);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t on_audio(SrsMediaPacket *msg); virtual srs_error_t on_audio(SrsMediaPacket *msg);
private: SRS_DECLARE_PRIVATE:
srs_error_t init_codec(SrsAudioCodecId codec); srs_error_t init_codec(SrsAudioCodecId codec);
srs_error_t transcode(SrsParsedAudioPacket *audio); srs_error_t transcode(SrsParsedAudioPacket *audio);
srs_error_t package_opus(SrsParsedAudioPacket *audio, SrsRtpPacket *pkt); srs_error_t package_opus(SrsParsedAudioPacket *audio, SrsRtpPacket *pkt);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t on_video(SrsMediaPacket *msg); virtual srs_error_t on_video(SrsMediaPacket *msg);
private: SRS_DECLARE_PRIVATE:
srs_error_t filter(SrsMediaPacket *msg, SrsFormat *format, bool &has_idr, std::vector<SrsNaluSample *> &samples); srs_error_t filter(SrsMediaPacket *msg, SrsFormat *format, bool &has_idr, std::vector<SrsNaluSample *> &samples);
srs_error_t package_stap_a(SrsMediaPacket *msg, SrsRtpPacket *pkt); srs_error_t package_stap_a(SrsMediaPacket *msg, SrsRtpPacket *pkt);
srs_error_t package_nalus(SrsMediaPacket *msg, const std::vector<SrsNaluSample *> &samples, std::vector<SrsRtpPacket *> &pkts); srs_error_t package_nalus(SrsMediaPacket *msg, const std::vector<SrsNaluSample *> &samples, std::vector<SrsRtpPacket *> &pkts);
@ -413,7 +413,7 @@ private:
// TODO: Maybe should use SrsRtpRingBuffer? // TODO: Maybe should use SrsRtpRingBuffer?
class SrsRtcFrameBuilderVideoPacketCache class SrsRtcFrameBuilderVideoPacketCache
{ {
private: SRS_DECLARE_PRIVATE:
const static uint16_t cache_size_ = 512; const static uint16_t cache_size_ = 512;
struct RtcPacketCache { struct RtcPacketCache {
bool in_use_; bool in_use_;
@ -441,7 +441,7 @@ public:
// Check if frame is complete by verifying FU-A start/end fragment counts match // Check if frame is complete by verifying FU-A start/end fragment counts match
bool check_frame_complete(const uint16_t start, const uint16_t end); bool check_frame_complete(const uint16_t start, const uint16_t end);
private: SRS_DECLARE_PRIVATE:
bool is_slot_in_use(uint16_t sequence_number); bool is_slot_in_use(uint16_t sequence_number);
uint32_t get_rtp_timestamp(uint16_t sequence_number); uint32_t get_rtp_timestamp(uint16_t sequence_number);
inline uint16_t cache_index(uint16_t sequence_number) inline uint16_t cache_index(uint16_t sequence_number)
@ -453,7 +453,7 @@ private:
// Video frame detector for managing frame boundaries and packet loss detection // Video frame detector for managing frame boundaries and packet loss detection
class SrsRtcFrameBuilderVideoFrameDetector class SrsRtcFrameBuilderVideoFrameDetector
{ {
private: SRS_DECLARE_PRIVATE:
SrsRtcFrameBuilderVideoPacketCache *video_cache_; SrsRtcFrameBuilderVideoPacketCache *video_cache_;
uint16_t header_sn_; uint16_t header_sn_;
uint16_t lost_sn_; uint16_t lost_sn_;
@ -474,7 +474,7 @@ public:
// Audio packet cache for RTP packet jitter buffer management // Audio packet cache for RTP packet jitter buffer management
class SrsRtcFrameBuilderAudioPacketCache class SrsRtcFrameBuilderAudioPacketCache
{ {
private: SRS_DECLARE_PRIVATE:
// Audio jitter buffer, map sequence number to packet // Audio jitter buffer, map sequence number to packet
std::map<uint16_t, SrsRtpPacket *> audio_buffer_; std::map<uint16_t, SrsRtpPacket *> audio_buffer_;
// Last processed sequence number // Last processed sequence number
@ -503,24 +503,24 @@ public:
// Collect and build WebRTC RTP packets to AV frames. // Collect and build WebRTC RTP packets to AV frames.
class SrsRtcFrameBuilder class SrsRtcFrameBuilder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsFrameTarget *frame_target_; ISrsFrameTarget *frame_target_;
private: SRS_DECLARE_PRIVATE:
bool is_first_audio_; bool is_first_audio_;
ISrsAudioTranscoder *audio_transcoder_; ISrsAudioTranscoder *audio_transcoder_;
SrsVideoCodecId video_codec_; SrsVideoCodecId video_codec_;
private: SRS_DECLARE_PRIVATE:
SrsRtcFrameBuilderAudioPacketCache *audio_cache_; SrsRtcFrameBuilderAudioPacketCache *audio_cache_;
SrsRtcFrameBuilderVideoPacketCache *video_cache_; SrsRtcFrameBuilderVideoPacketCache *video_cache_;
SrsRtcFrameBuilderVideoFrameDetector *frame_detector_; SrsRtcFrameBuilderVideoFrameDetector *frame_detector_;
private: SRS_DECLARE_PRIVATE:
// The state for timestamp sync state. -1 for init. 0 not sync. 1 sync. // The state for timestamp sync state. -1 for init. 0 not sync. 1 sync.
int sync_state_; int sync_state_;
private: SRS_DECLARE_PRIVATE:
// For OBS WHIP, send (VPS/)SPS/PPS in dedicated RTP packet. // For OBS WHIP, send (VPS/)SPS/PPS in dedicated RTP packet.
SrsRtpPacket *obs_whip_vps_; SrsRtpPacket *obs_whip_vps_;
SrsRtpPacket *obs_whip_sps_; SrsRtpPacket *obs_whip_sps_;
@ -536,12 +536,12 @@ public:
virtual void on_unpublish(); virtual void on_unpublish();
virtual srs_error_t on_rtp(SrsRtpPacket *pkt); virtual srs_error_t on_rtp(SrsRtpPacket *pkt);
private: SRS_DECLARE_PRIVATE:
srs_error_t packet_audio(SrsRtpPacket *pkt); srs_error_t packet_audio(SrsRtpPacket *pkt);
srs_error_t transcode_audio(SrsRtpPacket *pkt); srs_error_t transcode_audio(SrsRtpPacket *pkt);
void packet_aac(SrsRtmpCommonMessage *audio, char *data, int len, uint32_t pts, bool is_header); void packet_aac(SrsRtmpCommonMessage *audio, char *data, int len, uint32_t pts, bool is_header);
private: SRS_DECLARE_PRIVATE:
srs_error_t packet_video(SrsRtpPacket *pkt); srs_error_t packet_video(SrsRtpPacket *pkt);
srs_error_t packet_video_key_frame(SrsRtpPacket *pkt); srs_error_t packet_video_key_frame(SrsRtpPacket *pkt);
srs_error_t packet_sequence_header_avc(SrsRtpPacket *pkt); srs_error_t packet_sequence_header_avc(SrsRtpPacket *pkt);
@ -549,7 +549,7 @@ private:
srs_error_t packet_sequence_header_hevc(SrsRtpPacket *pkt); srs_error_t packet_sequence_header_hevc(SrsRtpPacket *pkt);
srs_error_t do_packet_sequence_header_hevc(SrsRtpPacket *pkt, SrsNaluSample *vps, SrsNaluSample *sps, SrsNaluSample *pps); srs_error_t do_packet_sequence_header_hevc(SrsRtpPacket *pkt, SrsNaluSample *vps, SrsNaluSample *sps, SrsNaluSample *pps);
private: SRS_DECLARE_PRIVATE:
srs_error_t packet_video_rtmp(const uint16_t start, const uint16_t end); srs_error_t packet_video_rtmp(const uint16_t start, const uint16_t end);
int calculate_packet_payload_size(SrsRtpPacket *pkt); int calculate_packet_payload_size(SrsRtpPacket *pkt);
void write_packet_payload_to_buffer(SrsRtpPacket *pkt, SrsBuffer &payload, int &nalu_len); void write_packet_payload_to_buffer(SrsRtpPacket *pkt, SrsBuffer &payload, int &nalu_len);
@ -571,7 +571,7 @@ public:
std::vector<std::string> rtcp_fbs_; std::vector<std::string> rtcp_fbs_;
private: SRS_DECLARE_PRIVATE:
// The cached codec ID, corresponding to name_. // The cached codec ID, corresponding to name_.
// For video, you can convert it to type SrsVideoCodecId // For video, you can convert it to type SrsVideoCodecId
// For audio, you can convert it to type SrsAudioCodecId // For audio, you can convert it to type SrsAudioCodecId
@ -777,19 +777,19 @@ public:
// The RTC receive track. // The RTC receive track.
class SrsRtcRecvTrack class SrsRtcRecvTrack
{ {
protected: SRS_DECLARE_PROTECTED:
SrsRtcTrackDescription *track_desc_; SrsRtcTrackDescription *track_desc_;
protected: SRS_DECLARE_PROTECTED:
ISrsRtcPacketReceiver *receiver_; ISrsRtcPacketReceiver *receiver_;
SrsRtpRingBuffer *rtp_queue_; SrsRtpRingBuffer *rtp_queue_;
SrsRtpNackForReceiver *nack_receiver_; SrsRtpNackForReceiver *nack_receiver_;
private: SRS_DECLARE_PRIVATE:
// By config, whether no copy. // By config, whether no copy.
bool nack_no_copy_; bool nack_no_copy_;
protected: SRS_DECLARE_PROTECTED:
// Latest sender report ntp and rtp time. // Latest sender report ntp and rtp time.
SrsNtp last_sender_report_ntp_; SrsNtp last_sender_report_ntp_;
int64_t last_sender_report_rtp_time_; int64_t last_sender_report_rtp_time_;
@ -828,7 +828,7 @@ public:
virtual srs_error_t on_rtp(SrsSharedPtr<SrsRtcSource> &source, SrsRtpPacket *pkt) = 0; virtual srs_error_t on_rtp(SrsSharedPtr<SrsRtcSource> &source, SrsRtpPacket *pkt) = 0;
virtual srs_error_t check_send_nacks() = 0; virtual srs_error_t check_send_nacks() = 0;
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t do_check_send_nacks(uint32_t &timeout_nacks); virtual srs_error_t do_check_send_nacks(uint32_t &timeout_nacks);
}; };
@ -864,12 +864,12 @@ public:
template <typename T, typename ST> template <typename T, typename ST>
class SrsRtcJitter class SrsRtcJitter
{ {
private: SRS_DECLARE_PRIVATE:
ST threshold_; ST threshold_;
typedef ST (*PFN)(const T &, const T &); typedef ST (*PFN)(const T &, const T &);
PFN distance_; PFN distance_;
private: SRS_DECLARE_PRIVATE:
// The value about packet. // The value about packet.
T pkt_base_; T pkt_base_;
T pkt_last_; T pkt_last_;
@ -926,7 +926,7 @@ public:
// For RTC timestamp jitter. // For RTC timestamp jitter.
class SrsRtcTsJitter class SrsRtcTsJitter
{ {
private: SRS_DECLARE_PRIVATE:
SrsRtcJitter<uint32_t, int32_t> *jitter_; SrsRtcJitter<uint32_t, int32_t> *jitter_;
public: public:
@ -940,7 +940,7 @@ public:
// For RTC sequence jitter. // For RTC sequence jitter.
class SrsRtcSeqJitter class SrsRtcSeqJitter
{ {
private: SRS_DECLARE_PRIVATE:
SrsRtcJitter<uint16_t, int16_t> *jitter_; SrsRtcJitter<uint16_t, int16_t> *jitter_;
public: public:
@ -968,18 +968,18 @@ public:
// send track description // send track description
SrsRtcTrackDescription *track_desc_; SrsRtcTrackDescription *track_desc_;
protected: SRS_DECLARE_PROTECTED:
// The owner connection for this track. // The owner connection for this track.
ISrsRtcPacketSender *sender_; ISrsRtcPacketSender *sender_;
// NACK ARQ ring buffer. // NACK ARQ ring buffer.
SrsRtpRingBuffer *rtp_queue_; SrsRtpRingBuffer *rtp_queue_;
protected: SRS_DECLARE_PROTECTED:
// The jitter to correct ts and sequence number. // The jitter to correct ts and sequence number.
SrsRtcTsJitter *jitter_ts_; SrsRtcTsJitter *jitter_ts_;
SrsRtcSeqJitter *jitter_seq_; SrsRtcSeqJitter *jitter_seq_;
private: SRS_DECLARE_PRIVATE:
// By config, whether no copy. // By config, whether no copy.
bool nack_no_copy_; bool nack_no_copy_;
// The pithy print for special stage. // The pithy print for special stage.
@ -998,7 +998,7 @@ public:
bool get_track_status(); bool get_track_status();
std::string get_track_id(); std::string get_track_id();
protected: SRS_DECLARE_PROTECTED:
void rebuild_packet(SrsRtpPacket *pkt); void rebuild_packet(SrsRtpPacket *pkt);
public: public:
@ -1036,13 +1036,13 @@ public:
class SrsRtcSSRCGenerator class SrsRtcSSRCGenerator
{ {
private: SRS_DECLARE_PRIVATE:
static SrsRtcSSRCGenerator *instance_; static SrsRtcSSRCGenerator *instance_;
private: SRS_DECLARE_PRIVATE:
uint32_t ssrc_num_; uint32_t ssrc_num_;
private: SRS_DECLARE_PRIVATE:
SrsRtcSSRCGenerator(); SrsRtcSSRCGenerator();
virtual ~SrsRtcSSRCGenerator(); virtual ~SrsRtcSSRCGenerator();

View File

@ -56,14 +56,14 @@ class ISrsSecurity;
// The simple rtmp client for SRS. // The simple rtmp client for SRS.
class SrsSimpleRtmpClient : public SrsBasicRtmpClient class SrsSimpleRtmpClient : public SrsBasicRtmpClient
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
public: public:
SrsSimpleRtmpClient(std::string u, srs_utime_t ctm, srs_utime_t stm); SrsSimpleRtmpClient(std::string u, srs_utime_t ctm, srs_utime_t stm);
virtual ~SrsSimpleRtmpClient(); virtual ~SrsSimpleRtmpClient();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t connect_app(); virtual srs_error_t connect_app();
}; };
@ -106,7 +106,7 @@ public:
// The base transport layer for RTMP connections over plain TCP. // The base transport layer for RTMP connections over plain TCP.
class SrsRtmpTransport : public ISrsRtmpTransport class SrsRtmpTransport : public ISrsRtmpTransport
{ {
protected: SRS_DECLARE_PROTECTED:
srs_netfd_t stfd_; srs_netfd_t stfd_;
SrsTcpConnection *skt_; SrsTcpConnection *skt_;
@ -135,10 +135,10 @@ public:
// The SSL/TLS transport layer for RTMPS connections. // The SSL/TLS transport layer for RTMPS connections.
class SrsRtmpsTransport : public SrsRtmpTransport class SrsRtmpsTransport : public SrsRtmpTransport
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
SrsSslConnection *ssl_; SrsSslConnection *ssl_;
public: public:
@ -164,7 +164,7 @@ class SrsRtmpConn : public ISrsConnection, // It's a resource.
// For the thread to directly access any field of connection. // For the thread to directly access any field of connection.
friend class SrsPublishRecvThread; friend class SrsPublishRecvThread;
private: SRS_DECLARE_PRIVATE:
ISrsResourceManager *manager_; ISrsResourceManager *manager_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsStreamPublishTokenManager *stream_publish_tokens_; ISrsStreamPublishTokenManager *stream_publish_tokens_;
@ -177,7 +177,7 @@ private:
ISrsRtspSourceManager *rtsp_sources_; ISrsRtspSourceManager *rtsp_sources_;
#endif #endif
private: SRS_DECLARE_PRIVATE:
ISrsRtmpServer *rtmp_; ISrsRtmpServer *rtmp_;
SrsRefer *refer_; SrsRefer *refer_;
SrsBandwidth *bandwidth_; SrsBandwidth *bandwidth_;
@ -205,7 +205,7 @@ private:
// About the rtmp client. // About the rtmp client.
SrsClientInfo *info_; SrsClientInfo *info_;
private: SRS_DECLARE_PRIVATE:
ISrsRtmpTransport *transport_; ISrsRtmpTransport *transport_;
// Each connection start a green thread, // Each connection start a green thread,
// when thread stop, the connection will be delete by server. // when thread stop, the connection will be delete by server.
@ -228,13 +228,13 @@ public:
public: public:
virtual std::string desc(); virtual std::string desc();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
public: public:
virtual ISrsKbpsDelta *delta(); virtual ISrsKbpsDelta *delta();
private: SRS_DECLARE_PRIVATE:
// When valid and connected to vhost/app, service the client. // When valid and connected to vhost/app, service the client.
virtual srs_error_t service_cycle(); virtual srs_error_t service_cycle();
// The stream(play/publish) service cycle, identify client first. // The stream(play/publish) service cycle, identify client first.
@ -251,16 +251,16 @@ private:
virtual srs_error_t process_play_control_msg(SrsLiveConsumer *consumer, SrsRtmpCommonMessage *msg); virtual srs_error_t process_play_control_msg(SrsLiveConsumer *consumer, SrsRtmpCommonMessage *msg);
virtual void set_sock_options(); virtual void set_sock_options();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t check_edge_token_traverse_auth(); virtual srs_error_t check_edge_token_traverse_auth();
virtual srs_error_t do_token_traverse_auth(SrsRtmpClient *client); virtual srs_error_t do_token_traverse_auth(SrsRtmpClient *client);
private: SRS_DECLARE_PRIVATE:
// When the connection disconnect, call this method. // When the connection disconnect, call this method.
// e.g. log msg of connection and report to other system. // e.g. log msg of connection and report to other system.
virtual srs_error_t on_disconnect(); virtual srs_error_t on_disconnect();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t http_hooks_on_connect(); virtual srs_error_t http_hooks_on_connect();
virtual void http_hooks_on_close(); virtual void http_hooks_on_close();
virtual srs_error_t http_hooks_on_publish(); virtual srs_error_t http_hooks_on_publish();

View File

@ -77,7 +77,7 @@ int srs_time_jitter_string2int(std::string time_jitter);
// Time jitter detect and correct, to ensure the rtmp stream is monotonically. // Time jitter detect and correct, to ensure the rtmp stream is monotonically.
class SrsRtmpJitter class SrsRtmpJitter
{ {
private: SRS_DECLARE_PRIVATE:
int64_t last_pkt_time_; int64_t last_pkt_time_;
int64_t last_pkt_correct_time_; int64_t last_pkt_correct_time_;
@ -97,7 +97,7 @@ public:
// To alloc and increase fixed space, fast remove and insert for msgs sender. // To alloc and increase fixed space, fast remove and insert for msgs sender.
class SrsFastVector class SrsFastVector
{ {
private: SRS_DECLARE_PRIVATE:
SrsMediaPacket **msgs_; SrsMediaPacket **msgs_;
int nb_msgs_; int nb_msgs_;
int count_; int count_;
@ -140,12 +140,12 @@ public:
// We limit the size in seconds, drop old messages(the whole gop) if full. // We limit the size in seconds, drop old messages(the whole gop) if full.
class SrsMessageQueue : public ISrsMessageQueue class SrsMessageQueue : public ISrsMessageQueue
{ {
private: SRS_DECLARE_PRIVATE:
// The start and end time. // The start and end time.
srs_utime_t av_start_time_; srs_utime_t av_start_time_;
srs_utime_t av_end_time_; srs_utime_t av_end_time_;
private: SRS_DECLARE_PRIVATE:
// Whether do logging when shrinking. // Whether do logging when shrinking.
bool _ignore_shrink; bool _ignore_shrink;
// The max queue size, shrink if exceed it. // The max queue size, shrink if exceed it.
@ -182,7 +182,7 @@ public:
// @remark the atc/tba/tbv/ag are same to SrsLiveConsumer.enqueue(). // @remark the atc/tba/tbv/ag are same to SrsLiveConsumer.enqueue().
virtual srs_error_t dump_packets(ISrsLiveConsumer *consumer, bool atc, SrsRtmpJitterAlgorithm ag); virtual srs_error_t dump_packets(ISrsLiveConsumer *consumer, bool atc, SrsRtmpJitterAlgorithm ag);
private: SRS_DECLARE_PRIVATE:
// Remove a gop from the front. // Remove a gop from the front.
// if no iframe found, clear it. // if no iframe found, clear it.
virtual void shrink(); virtual void shrink();
@ -224,11 +224,11 @@ public:
// The consumer for SrsLiveSource, that is a play client. // The consumer for SrsLiveSource, that is a play client.
class SrsLiveConsumer : public ISrsWakable, public ISrsLiveConsumer class SrsLiveConsumer : public ISrsWakable, public ISrsLiveConsumer
{ {
private: SRS_DECLARE_PRIVATE:
// Because source references to this object, so we should directly use the source ptr. // Because source references to this object, so we should directly use the source ptr.
ISrsLiveSource *source_; ISrsLiveSource *source_;
private: SRS_DECLARE_PRIVATE:
SrsRtmpJitter *jitter_; SrsRtmpJitter *jitter_;
SrsMessageQueue *queue_; SrsMessageQueue *queue_;
bool paused_; bool paused_;
@ -285,7 +285,7 @@ public:
// To enable it to fast startup. // To enable it to fast startup.
class SrsGopCache class SrsGopCache
{ {
private: SRS_DECLARE_PRIVATE:
// if disabled the gop cache, // if disabled the gop cache,
// The client will wait for the next keyframe for h264, // The client will wait for the next keyframe for h264,
// and will be black-screen. // and will be black-screen.
@ -360,7 +360,7 @@ public:
// The mix queue to correct the timestamp for mix_correct algorithm. // The mix queue to correct the timestamp for mix_correct algorithm.
class SrsMixQueue class SrsMixQueue
{ {
private: SRS_DECLARE_PRIVATE:
uint32_t nb_videos_; uint32_t nb_videos_;
uint32_t nb_audios_; uint32_t nb_audios_;
std::multimap<int64_t, SrsMediaPacket *> msgs_; std::multimap<int64_t, SrsMediaPacket *> msgs_;
@ -411,20 +411,20 @@ public:
// they are meanless for edge server. // they are meanless for edge server.
class SrsOriginHub : public ISrsReloadHandler, public ISrsOriginHub class SrsOriginHub : public ISrsReloadHandler, public ISrsOriginHub
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsHttpHooks *hooks_; ISrsHttpHooks *hooks_;
private: SRS_DECLARE_PRIVATE:
// Because source references to this object, so we should directly use the source ptr. // Because source references to this object, so we should directly use the source ptr.
ISrsLiveSource *source_; ISrsLiveSource *source_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
bool is_active_; bool is_active_;
private: SRS_DECLARE_PRIVATE:
// hls handler. // hls handler.
ISrsHls *hls_; ISrsHls *hls_;
// The DASH encoder. // The DASH encoder.
@ -484,7 +484,7 @@ public:
// For the SrsHls to callback to request the sequence headers. // For the SrsHls to callback to request the sequence headers.
virtual srs_error_t on_hls_request_sh(); virtual srs_error_t on_hls_request_sh();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t create_forwarders(); virtual srs_error_t create_forwarders();
virtual srs_error_t create_backend_forwarders(bool &applied); virtual srs_error_t create_backend_forwarders(bool &applied);
virtual void destroy_forwarders(); virtual void destroy_forwarders();
@ -494,7 +494,7 @@ private:
// This class cache and update the meta. // This class cache and update the meta.
class SrsMetaCache class SrsMetaCache
{ {
private: SRS_DECLARE_PRIVATE:
// The cached metadata, FLV script data tag. // The cached metadata, FLV script data tag.
SrsMediaPacket *meta_; SrsMediaPacket *meta_;
// The cached video sequence header, for example, sps/pps for h.264. // The cached video sequence header, for example, sps/pps for h.264.
@ -572,10 +572,10 @@ public:
// The source manager to create and refresh all stream sources. // The source manager to create and refresh all stream sources.
class SrsLiveSourceManager : public ISrsHourGlassHandler, public ISrsLiveSourceManager class SrsLiveSourceManager : public ISrsHourGlassHandler, public ISrsLiveSourceManager
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
srs_mutex_t lock_; srs_mutex_t lock_;
std::map<std::string, SrsSharedPtr<SrsLiveSource> > pool_; std::map<std::string, SrsSharedPtr<SrsLiveSource> > pool_;
ISrsHourGlass *timer_; ISrsHourGlass *timer_;
@ -600,7 +600,7 @@ public:
// dispose and cycle all sources. // dispose and cycle all sources.
virtual void dispose(); virtual void dispose();
// interface ISrsHourGlassHandler // interface ISrsHourGlassHandler
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t setup_ticks(); virtual srs_error_t setup_ticks();
virtual srs_error_t notify(int event, srs_utime_t interval, srs_utime_t tick); virtual srs_error_t notify(int event, srs_utime_t interval, srs_utime_t tick);
@ -641,13 +641,13 @@ public:
// The live streaming source. // The live streaming source.
class SrsLiveSource : public ISrsReloadHandler, public ISrsFrameTarget, public ISrsLiveSource class SrsLiveSource : public ISrsReloadHandler, public ISrsFrameTarget, public ISrsLiveSource
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsLiveSourceHandler *handler_; ISrsLiveSourceHandler *handler_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
// For publish, it's the publish client id. // For publish, it's the publish client id.
// For edge, it's the edge ingest id. // For edge, it's the edge ingest id.
// when source id changed, for example, the edge reconnect, // when source id changed, for example, the edge reconnect,
@ -688,7 +688,7 @@ private:
// The format, codec information. // The format, codec information.
SrsRtmpFormat *format_; SrsRtmpFormat *format_;
private: SRS_DECLARE_PRIVATE:
// Whether source is avaiable for publishing. // Whether source is avaiable for publishing.
bool can_publish_; bool can_publish_;
// The last die time, while die means neither publishers nor players. // The last die time, while die means neither publishers nor players.
@ -738,14 +738,14 @@ public:
virtual srs_error_t on_audio(SrsRtmpCommonMessage *audio); virtual srs_error_t on_audio(SrsRtmpCommonMessage *audio);
srs_error_t on_frame(SrsMediaPacket *msg); srs_error_t on_frame(SrsMediaPacket *msg);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t on_audio_imp(SrsMediaPacket *audio); virtual srs_error_t on_audio_imp(SrsMediaPacket *audio);
public: public:
// TODO: FIXME: Use SrsMediaPacket instead. // TODO: FIXME: Use SrsMediaPacket instead.
virtual srs_error_t on_video(SrsRtmpCommonMessage *video); virtual srs_error_t on_video(SrsRtmpCommonMessage *video);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t on_video_imp(SrsMediaPacket *video); virtual srs_error_t on_video_imp(SrsMediaPacket *video);
public: public:

View File

@ -60,24 +60,24 @@ public:
// A RTSP play stream, client pull and play stream from SRS. // A RTSP play stream, client pull and play stream from SRS.
class SrsRtspPlayStream : public ISrsRtspPlayStream, public ISrsCoroutineHandler, public ISrsRtcSourceChangeCallback class SrsRtspPlayStream : public ISrsRtspPlayStream, public ISrsCoroutineHandler, public ISrsRtcSourceChangeCallback
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsRtspSourceManager *rtsp_sources_; ISrsRtspSourceManager *rtsp_sources_;
private: SRS_DECLARE_PRIVATE:
SrsContextId cid_; SrsContextId cid_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
ISrsRtspConnection *session_; ISrsRtspConnection *session_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
SrsSharedPtr<SrsRtspSource> source_; SrsSharedPtr<SrsRtspSource> source_;
// key: publish_ssrc, value: send track to process rtp/rtcp // key: publish_ssrc, value: send track to process rtp/rtcp
std::map<uint32_t, ISrsRtspSendTrack *> audio_tracks_; std::map<uint32_t, ISrsRtspSendTrack *> audio_tracks_;
std::map<uint32_t, ISrsRtspSendTrack *> video_tracks_; std::map<uint32_t, ISrsRtspSendTrack *> video_tracks_;
private: SRS_DECLARE_PRIVATE:
// Fast cache for tracks. // Fast cache for tracks.
uint32_t cache_ssrc0_; uint32_t cache_ssrc0_;
uint32_t cache_ssrc1_; uint32_t cache_ssrc1_;
@ -86,7 +86,7 @@ private:
ISrsRtspSendTrack *cache_track1_; ISrsRtspSendTrack *cache_track1_;
ISrsRtspSendTrack *cache_track2_; ISrsRtspSendTrack *cache_track2_;
private: SRS_DECLARE_PRIVATE:
// Whether player started. // Whether player started.
bool is_started; bool is_started;
@ -110,7 +110,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
srs_error_t send_packet(SrsRtpPacket *&pkt); srs_error_t send_packet(SrsRtpPacket *&pkt);
public: public:
@ -136,17 +136,17 @@ class SrsRtspConnection : public ISrsResource, // It's a resource.
public ISrsStartable, public ISrsStartable,
public ISrsRtspConnection public ISrsRtspConnection
{ {
private: SRS_DECLARE_PRIVATE:
ISrsRtspSourceManager *rtsp_sources_; ISrsRtspSourceManager *rtsp_sources_;
ISrsResourceManager *rtsp_manager_; ISrsResourceManager *rtsp_manager_;
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsHttpHooks *hooks_; ISrsHttpHooks *hooks_;
private: SRS_DECLARE_PRIVATE:
bool disposing_; bool disposing_;
private: SRS_DECLARE_PRIVATE:
// TODO: FIXME: Rename it. // TODO: FIXME: Rename it.
// The timeout of session, keep alive by STUN ping pong. // The timeout of session, keep alive by STUN ping pong.
srs_utime_t session_timeout; srs_utime_t session_timeout;
@ -191,7 +191,7 @@ public:
public: public:
ISrsKbpsDelta *delta(); ISrsKbpsDelta *delta();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_describe(SrsRtspRequest *req, std::string &sdp); virtual srs_error_t do_describe(SrsRtspRequest *req, std::string &sdp);
virtual srs_error_t do_setup(SrsRtspRequest *req, uint32_t *ssrc); virtual srs_error_t do_setup(SrsRtspRequest *req, uint32_t *ssrc);
virtual srs_error_t do_play(SrsRtspRequest *req, SrsRtspConnection *conn); virtual srs_error_t do_play(SrsRtspRequest *req, SrsRtspConnection *conn);
@ -217,7 +217,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
srs_error_t do_cycle(); srs_error_t do_cycle();
srs_error_t on_rtsp_request(SrsRtspRequest *req_raw); srs_error_t on_rtsp_request(SrsRtspRequest *req_raw);
@ -233,14 +233,14 @@ public:
bool is_alive(); bool is_alive();
void alive(); void alive();
private: SRS_DECLARE_PRIVATE:
srs_error_t http_hooks_on_play(ISrsRequest *req); srs_error_t http_hooks_on_play(ISrsRequest *req);
srs_error_t get_ssrc_by_stream_id(uint32_t stream_id, uint32_t *ssrc); srs_error_t get_ssrc_by_stream_id(uint32_t stream_id, uint32_t *ssrc);
}; };
class SrsRtspTcpNetwork : public ISrsStreamWriter class SrsRtspTcpNetwork : public ISrsStreamWriter
{ {
private: SRS_DECLARE_PRIVATE:
ISrsProtocolReadWriter *skt_; ISrsProtocolReadWriter *skt_;
int channel_; int channel_;

View File

@ -34,11 +34,11 @@ class ISrsRtspConnection;
// The RTSP stream consumer, consume packets from RTSP stream source. // The RTSP stream consumer, consume packets from RTSP stream source.
class SrsRtspConsumer class SrsRtspConsumer
{ {
private: SRS_DECLARE_PRIVATE:
// Because source references to this object, so we should directly use the source ptr. // Because source references to this object, so we should directly use the source ptr.
SrsRtspSource *source_; SrsRtspSource *source_;
private: SRS_DECLARE_PRIVATE:
std::vector<SrsRtpPacket *> queue_; std::vector<SrsRtpPacket *> queue_;
// when source id changed, notice all consumers // when source id changed, notice all consumers
bool should_update_source_id_; bool should_update_source_id_;
@ -47,7 +47,7 @@ private:
bool mw_waiting_; bool mw_waiting_;
int mw_min_msgs_; int mw_min_msgs_;
private: SRS_DECLARE_PRIVATE:
// The callback for stream change event. // The callback for stream change event.
ISrsRtcSourceChangeCallback *handler_; ISrsRtcSourceChangeCallback *handler_;
@ -87,7 +87,7 @@ public:
// The RTSP source manager. // The RTSP source manager.
class SrsRtspSourceManager : public ISrsHourGlassHandler, public ISrsRtspSourceManager class SrsRtspSourceManager : public ISrsHourGlassHandler, public ISrsRtspSourceManager
{ {
private: SRS_DECLARE_PRIVATE:
srs_mutex_t lock_; srs_mutex_t lock_;
std::map<std::string, SrsSharedPtr<SrsRtspSource> > pool_; std::map<std::string, SrsSharedPtr<SrsRtspSource> > pool_;
SrsHourGlass *timer_; SrsHourGlass *timer_;
@ -99,7 +99,7 @@ public:
public: public:
virtual srs_error_t initialize(); virtual srs_error_t initialize();
// interface ISrsHourGlassHandler // interface ISrsHourGlassHandler
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t setup_ticks(); virtual srs_error_t setup_ticks();
virtual srs_error_t notify(int event, srs_utime_t interval, srs_utime_t tick); virtual srs_error_t notify(int event, srs_utime_t interval, srs_utime_t tick);
@ -122,11 +122,11 @@ extern SrsResourceManager *_srs_rtsp_manager;
// A Source is a stream, to publish and to play with, binding to SrsRtspPlayStream. // A Source is a stream, to publish and to play with, binding to SrsRtspPlayStream.
class SrsRtspSource : public ISrsRtpTarget class SrsRtspSource : public ISrsRtpTarget
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsCircuitBreaker *circuit_breaker_; ISrsCircuitBreaker *circuit_breaker_;
private: SRS_DECLARE_PRIVATE:
// For publish, it's the publish client id. // For publish, it's the publish client id.
// For edge, it's the edge ingest id. // For edge, it's the edge ingest id.
// when source id changed, for example, the edge reconnect, // when source id changed, for example, the edge reconnect,
@ -139,7 +139,7 @@ private:
SrsRtcTrackDescription *audio_desc_; SrsRtcTrackDescription *audio_desc_;
SrsRtcTrackDescription *video_desc_; SrsRtcTrackDescription *video_desc_;
private: SRS_DECLARE_PRIVATE:
// To delivery stream to clients. // To delivery stream to clients.
std::vector<SrsRtspConsumer *> consumers_; std::vector<SrsRtspConsumer *> consumers_;
// Whether stream is created, that is, SDP is done. // Whether stream is created, that is, SDP is done.
@ -147,7 +147,7 @@ private:
// Whether stream is delivering data, that is, DTLS is done. // Whether stream is delivering data, that is, DTLS is done.
bool is_delivering_packets_; bool is_delivering_packets_;
private: SRS_DECLARE_PRIVATE:
// The last die time, while die means neither publishers nor players. // The last die time, while die means neither publishers nor players.
srs_utime_t stream_die_at_; srs_utime_t stream_die_at_;
@ -166,7 +166,7 @@ public:
// Update the authentication information in request. // Update the authentication information in request.
virtual void update_auth(ISrsRequest *r); virtual void update_auth(ISrsRequest *r);
private: SRS_DECLARE_PRIVATE:
// The stream source changed. // The stream source changed.
virtual srs_error_t on_source_changed(); virtual srs_error_t on_source_changed();
@ -209,10 +209,10 @@ public:
// Convert AV frame to RTSP RTP packets. // Convert AV frame to RTSP RTP packets.
class SrsRtspRtpBuilder class SrsRtspRtpBuilder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
ISrsRtpTarget *rtp_target_; ISrsRtpTarget *rtp_target_;
// The format, codec information. // The format, codec information.
@ -222,13 +222,13 @@ private:
// The video builder, convert frame to RTP packets. // The video builder, convert frame to RTP packets.
SrsRtpVideoBuilder *video_builder_; SrsRtpVideoBuilder *video_builder_;
private: SRS_DECLARE_PRIVATE:
uint16_t audio_sequence_; uint16_t audio_sequence_;
uint32_t audio_ssrc_; uint32_t audio_ssrc_;
uint8_t audio_payload_type_; uint8_t audio_payload_type_;
int audio_sample_rate_; int audio_sample_rate_;
private: SRS_DECLARE_PRIVATE:
SrsSharedPtr<SrsRtspSource> source_; SrsSharedPtr<SrsRtspSource> source_;
// Lazy initialization flags // Lazy initialization flags
bool audio_initialized_; bool audio_initialized_;
@ -238,7 +238,7 @@ public:
SrsRtspRtpBuilder(ISrsRtpTarget *target, SrsSharedPtr<SrsRtspSource> source); SrsRtspRtpBuilder(ISrsRtpTarget *target, SrsSharedPtr<SrsRtspSource> source);
virtual ~SrsRtspRtpBuilder(); virtual ~SrsRtspRtpBuilder();
private: SRS_DECLARE_PRIVATE:
// Lazy initialization methods // Lazy initialization methods
srs_error_t initialize_audio_track(SrsAudioCodecId codec); srs_error_t initialize_audio_track(SrsAudioCodecId codec);
srs_error_t initialize_video_track(SrsVideoCodecId codec); srs_error_t initialize_video_track(SrsVideoCodecId codec);
@ -249,16 +249,16 @@ public:
virtual void on_unpublish(); virtual void on_unpublish();
virtual srs_error_t on_frame(SrsMediaPacket *frame); virtual srs_error_t on_frame(SrsMediaPacket *frame);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t on_audio(SrsMediaPacket *msg); virtual srs_error_t on_audio(SrsMediaPacket *msg);
private: SRS_DECLARE_PRIVATE:
srs_error_t package_aac(SrsParsedAudioPacket *audio, SrsRtpPacket *pkt); srs_error_t package_aac(SrsParsedAudioPacket *audio, SrsRtpPacket *pkt);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t on_video(SrsMediaPacket *msg); virtual srs_error_t on_video(SrsMediaPacket *msg);
private: SRS_DECLARE_PRIVATE:
srs_error_t filter(SrsMediaPacket *msg, SrsFormat *format, bool &has_idr, std::vector<SrsNaluSample *> &samples); srs_error_t filter(SrsMediaPacket *msg, SrsFormat *format, bool &has_idr, std::vector<SrsNaluSample *> &samples);
srs_error_t package_stap_a(SrsMediaPacket *msg, SrsRtpPacket *pkt); srs_error_t package_stap_a(SrsMediaPacket *msg, SrsRtpPacket *pkt);
srs_error_t package_nalus(SrsMediaPacket *msg, const std::vector<SrsNaluSample *> &samples, std::vector<SrsRtpPacket *> &pkts); srs_error_t package_nalus(SrsMediaPacket *msg, const std::vector<SrsNaluSample *> &samples, std::vector<SrsRtpPacket *> &pkts);
@ -286,7 +286,7 @@ public:
// send track description // send track description
SrsRtcTrackDescription *track_desc_; SrsRtcTrackDescription *track_desc_;
protected: SRS_DECLARE_PROTECTED:
// The owner connection for this track. // The owner connection for this track.
ISrsRtspConnection *session_; ISrsRtspConnection *session_;

View File

@ -41,7 +41,7 @@ public:
// @param req the request object of client. // @param req the request object of client.
virtual srs_error_t check(SrsRtmpConnType type, std::string ip, ISrsRequest *req); virtual srs_error_t check(SrsRtmpConnType type, std::string ip, ISrsRequest *req);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_check(SrsConfDirective *rules, SrsRtmpConnType type, std::string ip, ISrsRequest *req); virtual srs_error_t do_check(SrsConfDirective *rules, SrsRtmpConnType type, std::string ip, ISrsRequest *req);
virtual srs_error_t allow_check(SrsConfDirective *rules, SrsRtmpConnType type, std::string ip); virtual srs_error_t allow_check(SrsConfDirective *rules, SrsRtmpConnType type, std::string ip);
virtual srs_error_t deny_check(SrsConfDirective *rules, SrsRtmpConnType type, std::string ip); virtual srs_error_t deny_check(SrsConfDirective *rules, SrsRtmpConnType type, std::string ip);

View File

@ -122,7 +122,7 @@ class SrsServer : public ISrsReloadHandler, // Reload framework for permormance
public ISrsApiServerOwner, public ISrsApiServerOwner,
public ISrsRtcApiServer public ISrsRtcApiServer
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsLiveSourceManager *live_sources_; ISrsLiveSourceManager *live_sources_;
ISrsResourceManager *conn_manager_; ISrsResourceManager *conn_manager_;
@ -141,20 +141,20 @@ private:
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsAppFactory *app_factory_; ISrsAppFactory *app_factory_;
private: SRS_DECLARE_PRIVATE:
ISrsCommonHttpHandler *http_api_mux_; ISrsCommonHttpHandler *http_api_mux_;
SrsHttpServer *http_server_; SrsHttpServer *http_server_;
private: SRS_DECLARE_PRIVATE:
SrsHttpHeartbeat *http_heartbeat_; SrsHttpHeartbeat *http_heartbeat_;
SrsIngester *ingester_; SrsIngester *ingester_;
ISrsHourGlass *timer_; ISrsHourGlass *timer_;
private: SRS_DECLARE_PRIVATE:
// PID file manager for process identification and locking. // PID file manager for process identification and locking.
SrsPidFileLocker *pid_file_locker_; SrsPidFileLocker *pid_file_locker_;
private: SRS_DECLARE_PRIVATE:
// If reusing, HTTP API use the same port of HTTP server. // If reusing, HTTP API use the same port of HTTP server.
bool reuse_api_over_server_; bool reuse_api_over_server_;
// If reusing, WebRTC TCP use the same port of HTTP server. // If reusing, WebRTC TCP use the same port of HTTP server.
@ -191,17 +191,17 @@ private:
SrsGbListener *stream_caster_gb28181_; SrsGbListener *stream_caster_gb28181_;
#endif #endif
private: SRS_DECLARE_PRIVATE:
// SRT acceptors for MPEG-TS over SRT. // SRT acceptors for MPEG-TS over SRT.
std::vector<SrsSrtAcceptor *> srt_acceptors_; std::vector<SrsSrtAcceptor *> srt_acceptors_;
private: SRS_DECLARE_PRIVATE:
// WebRTC UDP listeners for RTC server functionality. // WebRTC UDP listeners for RTC server functionality.
std::vector<SrsUdpMuxListener *> rtc_listeners_; std::vector<SrsUdpMuxListener *> rtc_listeners_;
// WebRTC session manager. // WebRTC session manager.
SrsRtcSessionManager *rtc_session_manager_; SrsRtcSessionManager *rtc_session_manager_;
private: SRS_DECLARE_PRIVATE:
// Signal manager which convert gignal to io message. // Signal manager which convert gignal to io message.
SrsSignalManager *signal_manager_; SrsSignalManager *signal_manager_;
// To query the latest available version of SRS. // To query the latest available version of SRS.
@ -219,7 +219,7 @@ public:
SrsServer(); SrsServer();
virtual ~SrsServer(); virtual ~SrsServer();
private: SRS_DECLARE_PRIVATE:
// When SIGTERM, SRS should do cleanup, for example, // When SIGTERM, SRS should do cleanup, for example,
// to stop all ingesters, cleanup HLS and dvr. // to stop all ingesters, cleanup HLS and dvr.
virtual void dispose(); virtual void dispose();
@ -240,7 +240,7 @@ public:
public: public:
srs_error_t run(); srs_error_t run();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t initialize_st(); virtual srs_error_t initialize_st();
virtual srs_error_t initialize_signal(); virtual srs_error_t initialize_signal();
virtual srs_error_t listen(); virtual srs_error_t listen();
@ -252,7 +252,7 @@ public:
void stop(); void stop();
// interface ISrsCoroutineHandler // interface ISrsCoroutineHandler
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
// server utilities. // server utilities.
@ -272,7 +272,7 @@ public:
// @remark, maybe the HTTP RAW API will trigger the on_signal() also. // @remark, maybe the HTTP RAW API will trigger the on_signal() also.
virtual void on_signal(int signo); virtual void on_signal(int signo);
private: SRS_DECLARE_PRIVATE:
// The server thread main cycle, // The server thread main cycle,
// update the global static data, for instance, the current time, // update the global static data, for instance, the current time,
// the cpu/mem/network statistic. // the cpu/mem/network statistic.
@ -280,11 +280,11 @@ private:
virtual srs_error_t do2_cycle(); virtual srs_error_t do2_cycle();
// interface ISrsHourGlassHandler // interface ISrsHourGlassHandler
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t setup_ticks(); virtual srs_error_t setup_ticks();
virtual srs_error_t notify(int event, srs_utime_t interval, srs_utime_t tick); virtual srs_error_t notify(int event, srs_utime_t interval, srs_utime_t tick);
private: SRS_DECLARE_PRIVATE:
// Resample the server kbs. // Resample the server kbs.
virtual void resample_kbps(); virtual void resample_kbps();
@ -294,7 +294,7 @@ private:
virtual srs_error_t accept_srt_client(srs_srt_t srt_fd); virtual srs_error_t accept_srt_client(srs_srt_t srt_fd);
virtual srs_error_t srt_fd_to_resource(srs_srt_t srt_fd, ISrsResource **pr); virtual srs_error_t srt_fd_to_resource(srs_srt_t srt_fd, ISrsResource **pr);
private: SRS_DECLARE_PRIVATE:
// WebRTC-related methods // WebRTC-related methods
virtual srs_error_t listen_rtc_udp(); virtual srs_error_t listen_rtc_udp();
@ -302,21 +302,21 @@ private:
public: public:
virtual srs_error_t on_udp_packet(ISrsUdpMuxSocket *skt); virtual srs_error_t on_udp_packet(ISrsUdpMuxSocket *skt);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t listen_rtc_api(); virtual srs_error_t listen_rtc_api();
public: public:
virtual ISrsRtcConnection *find_rtc_session_by_username(const std::string &ufrag); virtual ISrsRtcConnection *find_rtc_session_by_username(const std::string &ufrag);
virtual srs_error_t create_rtc_session(SrsRtcUserConfig *ruc, SrsSdp &local_sdp, ISrsRtcConnection **psession); virtual srs_error_t create_rtc_session(SrsRtcUserConfig *ruc, SrsSdp &local_sdp, ISrsRtcConnection **psession);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t srs_update_server_statistics(); virtual srs_error_t srs_update_server_statistics();
// Interface ISrsTcpHandler // Interface ISrsTcpHandler
public: public:
virtual srs_error_t on_tcp_client(ISrsListener *listener, srs_netfd_t stfd); virtual srs_error_t on_tcp_client(ISrsListener *listener, srs_netfd_t stfd);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_on_tcp_client(ISrsListener *listener, srs_netfd_t &stfd); virtual srs_error_t do_on_tcp_client(ISrsListener *listener, srs_netfd_t &stfd);
virtual srs_error_t on_before_connection(const char *label, int fd, const std::string &ip, int port); virtual srs_error_t on_before_connection(const char *label, int fd, const std::string &ip, int port);
@ -333,13 +333,13 @@ extern SrsServer *_srs_server;
// @see: st-1.9/docs/notes.html // @see: st-1.9/docs/notes.html
class SrsSignalManager : public ISrsCoroutineHandler class SrsSignalManager : public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
// Per-process pipe which is used as a signal queue. // Per-process pipe which is used as a signal queue.
// Up to PIPE_BUF/sizeof(int) signals can be queued up. // Up to PIPE_BUF/sizeof(int) signals can be queued up.
int sig_pipe_[2]; int sig_pipe_[2];
srs_netfd_t signal_read_stfd_; srs_netfd_t signal_read_stfd_;
private: SRS_DECLARE_PRIVATE:
SrsServer *server_; SrsServer *server_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
@ -354,7 +354,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
// Global singleton instance // Global singleton instance
static SrsSignalManager *instance; static SrsSignalManager *instance;
// Signal catching function. // Signal catching function.
@ -366,10 +366,10 @@ private:
// @see https://github.com/ossrs/srs/issues/1635 // @see https://github.com/ossrs/srs/issues/1635
class SrsInotifyWorker : public ISrsCoroutineHandler class SrsInotifyWorker : public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
SrsServer *server_; SrsServer *server_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
srs_netfd_t inotify_fd_; srs_netfd_t inotify_fd_;
@ -388,10 +388,10 @@ public:
// PID file manager for process identification and locking. // PID file manager for process identification and locking.
class SrsPidFileLocker class SrsPidFileLocker
{ {
private: SRS_DECLARE_PRIVATE:
ISrsAppConfig *config_; ISrsAppConfig *config_;
private: SRS_DECLARE_PRIVATE:
int pid_fd_; int pid_fd_;
std::string pid_file_; std::string pid_file_;
@ -403,7 +403,7 @@ public:
// Acquire the PID file for the whole process. // Acquire the PID file for the whole process.
virtual srs_error_t acquire(); virtual srs_error_t acquire();
private: SRS_DECLARE_PRIVATE:
// Close the PID file descriptor. // Close the PID file descriptor.
virtual void close(); virtual void close();
}; };

View File

@ -59,7 +59,7 @@ public:
virtual srs_error_t write(void *buf, size_t size, ssize_t *nwrite); virtual srs_error_t write(void *buf, size_t size, ssize_t *nwrite);
virtual srs_error_t writev(const iovec *iov, int iov_size, ssize_t *nwrite); virtual srs_error_t writev(const iovec *iov, int iov_size, ssize_t *nwrite);
private: SRS_DECLARE_PRIVATE:
// The underlayer srt fd handler. // The underlayer srt fd handler.
srs_srt_t srt_fd_; srs_srt_t srt_fd_;
// The underlayer srt socket. // The underlayer srt socket.
@ -86,14 +86,14 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
srs_error_t do_cycle(); srs_error_t do_cycle();
public: public:
srs_error_t start(); srs_error_t start();
srs_error_t get_recv_err(); srs_error_t get_recv_err();
private: SRS_DECLARE_PRIVATE:
ISrsProtocolReadWriter *srt_conn_; ISrsProtocolReadWriter *srt_conn_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
srs_error_t recv_err_; srs_error_t recv_err_;
@ -115,7 +115,7 @@ public:
// The SRT connection, for client to publish or play stream. // The SRT connection, for client to publish or play stream.
class SrsMpegtsSrtConn : public ISrsMpegtsSrtConnection class SrsMpegtsSrtConn : public ISrsMpegtsSrtConnection
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
ISrsAppConfig *config_; ISrsAppConfig *config_;
ISrsStreamPublishTokenManager *stream_publish_tokens_; ISrsStreamPublishTokenManager *stream_publish_tokens_;
@ -147,10 +147,10 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t do_cycle(); virtual srs_error_t do_cycle();
private: SRS_DECLARE_PRIVATE:
srs_error_t publishing(); srs_error_t publishing();
srs_error_t playing(); srs_error_t playing();
srs_error_t acquire_publish(); srs_error_t acquire_publish();
@ -158,10 +158,10 @@ private:
srs_error_t do_publishing(); srs_error_t do_publishing();
srs_error_t do_playing(); srs_error_t do_playing();
private: SRS_DECLARE_PRIVATE:
srs_error_t on_srt_packet(char *buf, int nb_buf); srs_error_t on_srt_packet(char *buf, int nb_buf);
private: SRS_DECLARE_PRIVATE:
srs_error_t http_hooks_on_connect(); srs_error_t http_hooks_on_connect();
void http_hooks_on_close(); void http_hooks_on_close();
srs_error_t http_hooks_on_publish(); srs_error_t http_hooks_on_publish();
@ -169,7 +169,7 @@ private:
srs_error_t http_hooks_on_play(); srs_error_t http_hooks_on_play();
void http_hooks_on_stop(); void http_hooks_on_stop();
private: SRS_DECLARE_PRIVATE:
ISrsResourceManager *resource_manager_; ISrsResourceManager *resource_manager_;
srs_srt_t srt_fd_; srs_srt_t srt_fd_;
ISrsProtocolReadWriter *srt_conn_; ISrsProtocolReadWriter *srt_conn_;

View File

@ -28,12 +28,12 @@ public:
// Bind and listen SRT(udp) port, use handler to process the client. // Bind and listen SRT(udp) port, use handler to process the client.
class SrsSrtListener : public ISrsCoroutineHandler class SrsSrtListener : public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
srs_srt_t lfd_; srs_srt_t lfd_;
SrsSrtSocket *srt_skt_; SrsSrtSocket *srt_skt_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
private: SRS_DECLARE_PRIVATE:
ISrsSrtHandler *handler_; ISrsSrtHandler *handler_;
std::string ip_; std::string ip_;
int port_; int port_;

View File

@ -30,12 +30,12 @@ public:
// A common srt acceptor, for SRT server. // A common srt acceptor, for SRT server.
class SrsSrtAcceptor : public ISrsSrtHandler class SrsSrtAcceptor : public ISrsSrtHandler
{ {
private: SRS_DECLARE_PRIVATE:
std::string ip_; std::string ip_;
int port_; int port_;
ISrsSrtClientHandler *srt_handler_; ISrsSrtClientHandler *srt_handler_;
private: SRS_DECLARE_PRIVATE:
SrsSrtListener *listener_; SrsSrtListener *listener_;
public: public:
@ -45,7 +45,7 @@ public:
public: public:
virtual srs_error_t listen(std::string ip, int port); virtual srs_error_t listen(std::string ip, int port);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t set_srt_opt(); virtual srs_error_t set_srt_opt();
// Interface ISrsSrtHandler // Interface ISrsSrtHandler
public: public:
@ -69,7 +69,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
ISrsSrtPoller *srt_poller_; ISrsSrtPoller *srt_poller_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
}; };

View File

@ -48,7 +48,7 @@ public:
char *data(); char *data();
int size(); int size();
private: SRS_DECLARE_PRIVATE:
SrsMediaPacket *shared_buffer_; SrsMediaPacket *shared_buffer_;
// The size of SRT packet or SRT payload. // The size of SRT packet or SRT payload.
int actual_buffer_size_; int actual_buffer_size_;
@ -70,7 +70,7 @@ public:
// The SRT source manager. // The SRT source manager.
class SrsSrtSourceManager : public ISrsHourGlassHandler, public ISrsSrtSourceManager class SrsSrtSourceManager : public ISrsHourGlassHandler, public ISrsSrtSourceManager
{ {
private: SRS_DECLARE_PRIVATE:
srs_mutex_t lock_; srs_mutex_t lock_;
std::map<std::string, SrsSharedPtr<SrsSrtSource> > pool_; std::map<std::string, SrsSharedPtr<SrsSrtSource> > pool_;
SrsHourGlass *timer_; SrsHourGlass *timer_;
@ -82,7 +82,7 @@ public:
public: public:
virtual srs_error_t initialize(); virtual srs_error_t initialize();
// interface ISrsHourGlassHandler // interface ISrsHourGlassHandler
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t setup_ticks(); virtual srs_error_t setup_ticks();
virtual srs_error_t notify(int event, srs_utime_t interval, srs_utime_t tick); virtual srs_error_t notify(int event, srs_utime_t interval, srs_utime_t tick);
@ -116,7 +116,7 @@ public:
// The SRT consumer, consume packets from SRT stream source. // The SRT consumer, consume packets from SRT stream source.
class SrsSrtConsumer : public ISrsSrtConsumer class SrsSrtConsumer : public ISrsSrtConsumer
{ {
private: SRS_DECLARE_PRIVATE:
// Because source references to this object, so we should directly use the source ptr. // Because source references to this object, so we should directly use the source ptr.
ISrsSrtSource *source_; ISrsSrtSource *source_;
@ -124,7 +124,7 @@ public:
SrsSrtConsumer(ISrsSrtSource *source); SrsSrtConsumer(ISrsSrtSource *source);
virtual ~SrsSrtConsumer(); virtual ~SrsSrtConsumer();
private: SRS_DECLARE_PRIVATE:
std::vector<SrsSrtPacket *> queue_; std::vector<SrsSrtPacket *> queue_;
// when source id changed, notice all consumers // when source id changed, notice all consumers
bool should_update_source_id_; bool should_update_source_id_;
@ -162,7 +162,7 @@ public:
public: public:
virtual srs_error_t on_ts_message(SrsTsMessage *msg); virtual srs_error_t on_ts_message(SrsTsMessage *msg);
private: SRS_DECLARE_PRIVATE:
srs_error_t on_ts_video_avc(SrsTsMessage *msg, SrsBuffer *avs); srs_error_t on_ts_video_avc(SrsTsMessage *msg, SrsBuffer *avs);
srs_error_t on_ts_audio(SrsTsMessage *msg, SrsBuffer *avs); srs_error_t on_ts_audio(SrsTsMessage *msg, SrsBuffer *avs);
srs_error_t check_sps_pps_change(SrsTsMessage *msg); srs_error_t check_sps_pps_change(SrsTsMessage *msg);
@ -173,10 +173,10 @@ private:
srs_error_t check_vps_sps_pps_change(SrsTsMessage *msg); srs_error_t check_vps_sps_pps_change(SrsTsMessage *msg);
srs_error_t on_hevc_frame(SrsTsMessage *msg, std::vector<std::pair<char *, int> > &ipb_frames); srs_error_t on_hevc_frame(SrsTsMessage *msg, std::vector<std::pair<char *, int> > &ipb_frames);
private: SRS_DECLARE_PRIVATE:
ISrsFrameTarget *frame_target_; ISrsFrameTarget *frame_target_;
private: SRS_DECLARE_PRIVATE:
SrsTsContext *ts_ctx_; SrsTsContext *ts_ctx_;
// Record sps/pps had changed, if change, need to generate new video sh frame. // Record sps/pps had changed, if change, need to generate new video sh frame.
bool sps_pps_change_; bool sps_pps_change_;
@ -190,10 +190,10 @@ private:
bool audio_sh_change_; bool audio_sh_change_;
std::string audio_sh_; std::string audio_sh_;
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
private: SRS_DECLARE_PRIVATE:
// SRT to rtmp, video stream id. // SRT to rtmp, video stream id.
int video_streamid_; int video_streamid_;
// SRT to rtmp, audio stream id. // SRT to rtmp, audio stream id.
@ -218,7 +218,7 @@ public:
// A SRT source is a stream, to publish and to play with. // A SRT source is a stream, to publish and to play with.
class SrsSrtSource : public ISrsSrtSource class SrsSrtSource : public ISrsSrtSource
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStatistic *stat_; ISrsStatistic *stat_;
public: public:
@ -261,7 +261,7 @@ public:
public: public:
srs_error_t on_packet(SrsSrtPacket *packet); srs_error_t on_packet(SrsSrtPacket *packet);
private: SRS_DECLARE_PRIVATE:
// Source id. // Source id.
SrsContextId _source_id; SrsContextId _source_id;
// previous source id. // previous source id.
@ -273,7 +273,7 @@ private:
// The last die time, while die means neither publishers nor players. // The last die time, while die means neither publishers nor players.
srs_utime_t stream_die_at_; srs_utime_t stream_die_at_;
private: SRS_DECLARE_PRIVATE:
ISrsSrtBridge *srt_bridge_; ISrsSrtBridge *srt_bridge_;
}; };

View File

@ -25,7 +25,7 @@ class SrsExecutorCoroutine;
// @see https://github.com/ossrs/srs/pull/908 // @see https://github.com/ossrs/srs/pull/908
class SrsDummyCoroutine : public ISrsCoroutine class SrsDummyCoroutine : public ISrsCoroutine
{ {
private: SRS_DECLARE_PRIVATE:
SrsContextId cid_; SrsContextId cid_;
public: public:
@ -55,7 +55,7 @@ public:
// Please read https://github.com/ossrs/srs/issues/78 // Please read https://github.com/ossrs/srs/issues/78
class SrsSTCoroutine : public ISrsCoroutine class SrsSTCoroutine : public ISrsCoroutine
{ {
private: SRS_DECLARE_PRIVATE:
SrsFastCoroutine *impl_; SrsFastCoroutine *impl_;
public: public:
@ -96,24 +96,24 @@ public:
// High performance coroutine. // High performance coroutine.
class SrsFastCoroutine : public ISrsCoroutine class SrsFastCoroutine : public ISrsCoroutine
{ {
private: SRS_DECLARE_PRIVATE:
std::string name_; std::string name_;
int stack_size_; int stack_size_;
ISrsCoroutineHandler *handler_; ISrsCoroutineHandler *handler_;
private: SRS_DECLARE_PRIVATE:
srs_thread_t trd_; srs_thread_t trd_;
SrsContextId cid_; SrsContextId cid_;
srs_error_t trd_err_; srs_error_t trd_err_;
private: SRS_DECLARE_PRIVATE:
bool started_; bool started_;
bool interrupted_; bool interrupted_;
bool disposed_; bool disposed_;
// Cycle done, no need to interrupt it. // Cycle done, no need to interrupt it.
bool cycle_done_; bool cycle_done_;
private: SRS_DECLARE_PRIVATE:
// Sub state in disposed, we need to wait for thread to quit. // Sub state in disposed, we need to wait for thread to quit.
bool stopping_; bool stopping_;
SrsContextId stopping_cid_; SrsContextId stopping_cid_;
@ -140,7 +140,7 @@ public:
const SrsContextId &cid(); const SrsContextId &cid();
virtual void set_cid(const SrsContextId &cid); virtual void set_cid(const SrsContextId &cid);
private: SRS_DECLARE_PRIVATE:
srs_error_t cycle(); srs_error_t cycle();
static void *pfn(void *arg); static void *pfn(void *arg);
}; };
@ -148,7 +148,7 @@ private:
// Like goroutine sync.WaitGroup. // Like goroutine sync.WaitGroup.
class SrsWaitGroup class SrsWaitGroup
{ {
private: SRS_DECLARE_PRIVATE:
int nn_; int nn_;
srs_cond_t done_; srs_cond_t done_;
@ -203,13 +203,13 @@ class SrsExecutorCoroutine : public ISrsResource, // It's a resource.
public ISrsContextIdGetter, public ISrsContextIdGetter,
public ISrsCoroutineHandler public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsResourceManager *manager_; ISrsResourceManager *manager_;
ISrsResource *resource_; ISrsResource *resource_;
ISrsCoroutineHandler *handler_; ISrsCoroutineHandler *handler_;
ISrsExecutorHandler *callback_; ISrsExecutorHandler *callback_;
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
public: public:

View File

@ -178,7 +178,7 @@ public:
// The global statistic instance. // The global statistic instance.
class SrsStatistic : public ISrsStatistic class SrsStatistic : public ISrsStatistic
{ {
private: SRS_DECLARE_PRIVATE:
// The id to identify the sever. // The id to identify the sever.
std::string server_id_; std::string server_id_;
// The id to identify the service. // The id to identify the service.
@ -186,27 +186,27 @@ private:
// The pid to identify the service process. // The pid to identify the service process.
std::string service_pid_; std::string service_pid_;
private: SRS_DECLARE_PRIVATE:
// The key: vhost id, value: vhost object. // The key: vhost id, value: vhost object.
std::map<std::string, SrsStatisticVhost *> vhosts_; std::map<std::string, SrsStatisticVhost *> vhosts_;
// The key: vhost url, value: vhost Object. // The key: vhost url, value: vhost Object.
// @remark a fast index for vhosts. // @remark a fast index for vhosts.
std::map<std::string, SrsStatisticVhost *> rvhosts_; std::map<std::string, SrsStatisticVhost *> rvhosts_;
private: SRS_DECLARE_PRIVATE:
// The key: stream id, value: stream Object. // The key: stream id, value: stream Object.
std::map<std::string, SrsStatisticStream *> streams_; std::map<std::string, SrsStatisticStream *> streams_;
// The key: stream url, value: stream Object. // The key: stream url, value: stream Object.
// @remark a fast index for streams. // @remark a fast index for streams.
std::map<std::string, SrsStatisticStream *> rstreams_; std::map<std::string, SrsStatisticStream *> rstreams_;
private: SRS_DECLARE_PRIVATE:
// The key: client id, value: stream object. // The key: client id, value: stream object.
std::map<std::string, SrsStatisticClient *> clients_; std::map<std::string, SrsStatisticClient *> clients_;
// The server total kbps. // The server total kbps.
SrsKbps *kbps_; SrsKbps *kbps_;
private: SRS_DECLARE_PRIVATE:
// The total of clients connections. // The total of clients connections.
int64_t nb_clients_; int64_t nb_clients_;
// The total of clients errors. // The total of clients errors.
@ -252,7 +252,7 @@ public:
// exists in stat. // exists in stat.
virtual void on_disconnect(std::string id, srs_error_t err); virtual void on_disconnect(std::string id, srs_error_t err);
private: SRS_DECLARE_PRIVATE:
// Cleanup the stream if stream is not active and for the last client. // Cleanup the stream if stream is not active and for the last client.
void cleanup_stream(SrsStatisticStream *stream); void cleanup_stream(SrsStatisticStream *stream);
@ -284,7 +284,7 @@ public:
// Dumps the hints about SRS server. // Dumps the hints about SRS server.
void dumps_hints_kv(std::stringstream &ss); void dumps_hints_kv(std::stringstream &ss);
private: SRS_DECLARE_PRIVATE:
virtual SrsStatisticVhost *create_vhost(ISrsRequest *req); virtual SrsStatisticVhost *create_vhost(ISrsRequest *req);
virtual SrsStatisticStream *create_stream(SrsStatisticVhost *vhost, ISrsRequest *req); virtual SrsStatisticStream *create_stream(SrsStatisticVhost *vhost, ISrsRequest *req);

View File

@ -85,7 +85,7 @@ public:
// Then, deliver the RTP packets to RTP target, which binds to a RTC/RTSP source. // Then, deliver the RTP packets to RTP target, which binds to a RTC/RTSP source.
class SrsRtmpBridge : public ISrsRtmpBridge class SrsRtmpBridge : public ISrsRtmpBridge
{ {
private: SRS_DECLARE_PRIVATE:
#ifdef SRS_FFMPEG_FIT #ifdef SRS_FFMPEG_FIT
SrsRtcRtpBuilder *rtp_builder_; SrsRtcRtpBuilder *rtp_builder_;
#endif #endif
@ -135,7 +135,7 @@ public:
// Then, deliver the AV frames to frame target, which binds to a RTMP/RTC source. // Then, deliver the AV frames to frame target, which binds to a RTMP/RTC source.
class SrsSrtBridge : public ISrsSrtBridge, public ISrsFrameTarget class SrsSrtBridge : public ISrsSrtBridge, public ISrsFrameTarget
{ {
private: SRS_DECLARE_PRIVATE:
// Convert SRT TS packets to media frame packets. // Convert SRT TS packets to media frame packets.
SrsSrtFrameBuilder *frame_builder_; SrsSrtFrameBuilder *frame_builder_;
// Deliver media frame packets to RTMP target. // Deliver media frame packets to RTMP target.
@ -184,7 +184,7 @@ public:
// Then, deliver the RTMP frame packet to RTMP target, which binds to a live source. // Then, deliver the RTMP frame packet to RTMP target, which binds to a live source.
class SrsRtcBridge : public ISrsRtcBridge class SrsRtcBridge : public ISrsRtcBridge
{ {
private: SRS_DECLARE_PRIVATE:
ISrsRequest *req_; ISrsRequest *req_;
#ifdef SRS_FFMPEG_FIT #ifdef SRS_FFMPEG_FIT
// Collect and build WebRTC RTP packets to AV frames. // Collect and build WebRTC RTP packets to AV frames.

View File

@ -24,7 +24,7 @@ class SrsStreamPublishTokenManager;
// This prevents race conditions across all protocols (RTMP, RTC, SRT, etc.). // This prevents race conditions across all protocols (RTMP, RTC, SRT, etc.).
class SrsStreamPublishToken class SrsStreamPublishToken
{ {
private: SRS_DECLARE_PRIVATE:
// The stream URL this token is for // The stream URL this token is for
std::string stream_url_; std::string stream_url_;
// Whether this token is currently acquired // Whether this token is currently acquired
@ -70,7 +70,7 @@ public:
// This prevents race conditions across all protocols. // This prevents race conditions across all protocols.
class SrsStreamPublishTokenManager : public ISrsStreamPublishTokenManager class SrsStreamPublishTokenManager : public ISrsStreamPublishTokenManager
{ {
private: SRS_DECLARE_PRIVATE:
// Map of stream URL to token // Map of stream URL to token
std::map<std::string, SrsStreamPublishToken *> tokens_; std::map<std::string, SrsStreamPublishToken *> tokens_;
// Mutex to protect the tokens map // Mutex to protect the tokens map

View File

@ -17,8 +17,11 @@
// This ensures consistent class layout between production code and utest code with AddressSanitizer. // This ensures consistent class layout between production code and utest code with AddressSanitizer.
// The macro is automatically enabled when --utest=on is specified in configure. // The macro is automatically enabled when --utest=on is specified in configure.
#ifdef SRS_FORCE_PUBLIC4UTEST #ifdef SRS_FORCE_PUBLIC4UTEST
#define private public #define SRS_DECLARE_PRIVATE public
#define protected public #define SRS_DECLARE_PROTECTED public
#else
#define SRS_DECLARE_PRIVATE private
#define SRS_DECLARE_PROTECTED protected
#endif #endif
// To convert macro values to string. // To convert macro values to string.
@ -76,7 +79,7 @@ typedef SrsCplxError *srs_error_t;
#if 1 #if 1
class _SrsContextId class _SrsContextId
{ {
private: SRS_DECLARE_PRIVATE:
std::string v_; std::string v_;
public: public:

View File

@ -32,7 +32,7 @@
template <class T> template <class T>
class SrsUniquePtr class SrsUniquePtr
{ {
private: SRS_DECLARE_PRIVATE:
T *ptr_; T *ptr_;
void (*deleter_)(T *); void (*deleter_)(T *);
@ -63,19 +63,19 @@ public:
return ptr_; return ptr_;
} }
private: SRS_DECLARE_PRIVATE:
// Copy the unique ptr. // Copy the unique ptr.
SrsUniquePtr(const SrsUniquePtr<T> &); SrsUniquePtr(const SrsUniquePtr<T> &);
// The assign operator. // The assign operator.
SrsUniquePtr<T> &operator=(const SrsUniquePtr<T> &); SrsUniquePtr<T> &operator=(const SrsUniquePtr<T> &);
private: SRS_DECLARE_PRIVATE:
// Overload the * operator. // Overload the * operator.
T &operator*(); T &operator*();
// Overload the bool operator. // Overload the bool operator.
operator bool() const; operator bool() const;
#if __cplusplus >= 201103L // C++11 #if __cplusplus >= 201103L // C++11
private: SRS_DECLARE_PRIVATE:
// The move constructor. // The move constructor.
SrsUniquePtr(SrsUniquePtr<T> &&); SrsUniquePtr(SrsUniquePtr<T> &&);
// The move assign operator. // The move assign operator.
@ -96,7 +96,7 @@ private:
template <class T> template <class T>
class SrsUniquePtr<T[]> class SrsUniquePtr<T[]>
{ {
private: SRS_DECLARE_PRIVATE:
T *ptr_; T *ptr_;
public: public:
@ -125,19 +125,19 @@ public:
return ptr_[index]; return ptr_[index];
} }
private: SRS_DECLARE_PRIVATE:
// Copy the unique ptr. // Copy the unique ptr.
SrsUniquePtr(const SrsUniquePtr<T> &); SrsUniquePtr(const SrsUniquePtr<T> &);
// The assign operator. // The assign operator.
SrsUniquePtr<T> &operator=(const SrsUniquePtr<T> &); SrsUniquePtr<T> &operator=(const SrsUniquePtr<T> &);
private: SRS_DECLARE_PRIVATE:
// Overload the * operator. // Overload the * operator.
T &operator*(); T &operator*();
// Overload the bool operator. // Overload the bool operator.
operator bool() const; operator bool() const;
#if __cplusplus >= 201103L // C++11 #if __cplusplus >= 201103L // C++11
private: SRS_DECLARE_PRIVATE:
// The move constructor. // The move constructor.
SrsUniquePtr(SrsUniquePtr<T> &&); SrsUniquePtr(SrsUniquePtr<T> &&);
// The move assign operator. // The move assign operator.
@ -157,7 +157,7 @@ private:
template <class T> template <class T>
class SrsSharedPtr class SrsSharedPtr
{ {
private: SRS_DECLARE_PRIVATE:
// The pointer to the object. // The pointer to the object.
T *ptr_; T *ptr_;
// The reference count of the object. // The reference count of the object.
@ -181,7 +181,7 @@ public:
reset(); reset();
} }
private: SRS_DECLARE_PRIVATE:
// Reset the shared ptr. // Reset the shared ptr.
void reset() void reset()
{ {
@ -235,7 +235,7 @@ public:
return *this; return *this;
} }
private: SRS_DECLARE_PRIVATE:
// Overload the * operator. // Overload the * operator.
T &operator*() T &operator*()
{ {

View File

@ -60,7 +60,7 @@
// template<class T> // template<class T>
// class impl_SrsAutoFree // class impl_SrsAutoFree
//{ //{
// private: // SRS_DECLARE_PRIVATE:
// T** ptr; // T** ptr;
// bool is_array; // bool is_array;
// bool _use_free; // bool _use_free;

View File

@ -30,10 +30,10 @@ public:
// Transmux the RTMP packets to AAC stream. // Transmux the RTMP packets to AAC stream.
class SrsAacTransmuxer : public ISrsAacTransmuxer class SrsAacTransmuxer : public ISrsAacTransmuxer
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStreamWriter *writer_; ISrsStreamWriter *writer_;
private: SRS_DECLARE_PRIVATE:
SrsAacObjectType aac_object_; SrsAacObjectType aac_object_;
int8_t aac_sample_rate_; int8_t aac_sample_rate_;
int8_t aac_channels_; int8_t aac_channels_;

View File

@ -50,7 +50,7 @@ public:
// //
class SrsLbRoundRobin : public ISrsLbRoundRobin class SrsLbRoundRobin : public ISrsLbRoundRobin
{ {
private: SRS_DECLARE_PRIVATE:
int index_; int index_;
uint32_t count_; uint32_t count_;
std::string elem_; std::string elem_;

View File

@ -182,7 +182,7 @@ public:
// @remark The buffer never manages the bytes memory, user must manage it. // @remark The buffer never manages the bytes memory, user must manage it.
class SrsBuffer class SrsBuffer
{ {
private: SRS_DECLARE_PRIVATE:
// Current read/write position within the buffer // Current read/write position within the buffer
char *p_; char *p_;
// Pointer to the start of the buffer data (not owned by this class) // Pointer to the start of the buffer data (not owned by this class)
@ -402,7 +402,7 @@ public:
// @remark This class does not take ownership of the SrsBuffer pointer. // @remark This class does not take ownership of the SrsBuffer pointer.
class SrsBitBuffer class SrsBitBuffer
{ {
private: SRS_DECLARE_PRIVATE:
// Current byte being processed (cached from stream) // Current byte being processed (cached from stream)
int8_t cb_; int8_t cb_;
// Number of unread bits remaining in current byte (0-8) // Number of unread bits remaining in current byte (0-8)
@ -534,7 +534,7 @@ public:
// @remark The size may be less than the allocated buffer size for chunked data. // @remark The size may be less than the allocated buffer size for chunked data.
class SrsMemoryBlock class SrsMemoryBlock
{ {
private: SRS_DECLARE_PRIVATE:
// Current size of valid data in the buffer. // Current size of valid data in the buffer.
// This may be less than the allocated buffer size for chunked data // This may be less than the allocated buffer size for chunked data
// that arrives in multiple parts. // that arrives in multiple parts.

View File

@ -434,7 +434,7 @@ extern bool srs_is_server_gracefully_close(srs_error_t err);
// please @read https://github.com/ossrs/srs/issues/913 // please @read https://github.com/ossrs/srs/issues/913
class SrsCplxError class SrsCplxError
{ {
private: SRS_DECLARE_PRIVATE:
int code_; int code_;
SrsCplxError *wrapped_; SrsCplxError *wrapped_;
std::string msg_; std::string msg_;
@ -449,13 +449,13 @@ private:
std::string desc_; std::string desc_;
std::string summary_; std::string summary_;
private: SRS_DECLARE_PRIVATE:
SrsCplxError(); SrsCplxError();
public: public:
virtual ~SrsCplxError(); virtual ~SrsCplxError();
private: SRS_DECLARE_PRIVATE:
virtual std::string description(); virtual std::string description();
virtual std::string summary(); virtual std::string summary();

View File

@ -38,7 +38,7 @@ public:
// file writer, to write to file. // file writer, to write to file.
class SrsFileWriter : public ISrsFileWriter class SrsFileWriter : public ISrsFileWriter
{ {
private: SRS_DECLARE_PRIVATE:
std::string path_; std::string path_;
FILE *fp_; FILE *fp_;
char *buf_; char *buf_;
@ -107,7 +107,7 @@ public:
*/ */
class SrsFileReader : public ISrsFileReader class SrsFileReader : public ISrsFileReader
{ {
private: SRS_DECLARE_PRIVATE:
std::string path_; std::string path_;
int fd_; int fd_;

View File

@ -268,13 +268,13 @@ public:
// Transmux RTMP packets to FLV stream. // Transmux RTMP packets to FLV stream.
class SrsFlvTransmuxer : public ISrsFlvTransmuxer class SrsFlvTransmuxer : public ISrsFlvTransmuxer
{ {
private: SRS_DECLARE_PRIVATE:
bool has_audio_; bool has_audio_;
bool has_video_; bool has_video_;
bool drop_if_not_match_; bool drop_if_not_match_;
ISrsWriter *writer_; ISrsWriter *writer_;
private: SRS_DECLARE_PRIVATE:
char tag_header_[SRS_FLV_TAG_HEADER_SIZE]; char tag_header_[SRS_FLV_TAG_HEADER_SIZE];
public: public:
@ -317,7 +317,7 @@ public:
// @remark assert data_size is not negative. // @remark assert data_size is not negative.
static int size_tag(int data_size); static int size_tag(int data_size);
private: SRS_DECLARE_PRIVATE:
// The cache tag header. // The cache tag header.
int nb_tag_headers_; int nb_tag_headers_;
char *tag_headers_; char *tag_headers_;
@ -332,7 +332,7 @@ public:
// Write the tags in a time. // Write the tags in a time.
virtual srs_error_t write_tags(SrsMediaPacket **msgs, int count); virtual srs_error_t write_tags(SrsMediaPacket **msgs, int count);
private: SRS_DECLARE_PRIVATE:
virtual void cache_metadata(char type, char *data, int size, char *cache); virtual void cache_metadata(char type, char *data, int size, char *cache);
virtual void cache_audio(int64_t timestamp, char *data, int size, char *cache); virtual void cache_audio(int64_t timestamp, char *data, int size, char *cache);
virtual void cache_video(int64_t timestamp, char *data, int size, char *cache); virtual void cache_video(int64_t timestamp, char *data, int size, char *cache);
@ -363,7 +363,7 @@ public:
// Decode flv file. // Decode flv file.
class SrsFlvDecoder : public ISrsFlvDecoder class SrsFlvDecoder : public ISrsFlvDecoder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsReader *reader_; ISrsReader *reader_;
public: public:
@ -396,7 +396,7 @@ public:
// then seek to specified offset. // then seek to specified offset.
class SrsFlvVodStreamDecoder class SrsFlvVodStreamDecoder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsFileReader *reader_; ISrsFileReader *reader_;
public: public:

View File

@ -70,7 +70,7 @@ public:
// hg->start(); // hg->start();
class SrsHourGlass : public ISrsCoroutineHandler, public ISrsHourGlass class SrsHourGlass : public ISrsCoroutineHandler, public ISrsHourGlass
{ {
private: SRS_DECLARE_PRIVATE:
std::string label_; std::string label_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
ISrsHourGlassHandler *handler_; ISrsHourGlassHandler *handler_;
@ -139,7 +139,7 @@ public:
// instead, we should start only one fast timer in server. // instead, we should start only one fast timer in server.
class SrsFastTimer : public ISrsCoroutineHandler, public ISrsFastTimer class SrsFastTimer : public ISrsCoroutineHandler, public ISrsFastTimer
{ {
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
srs_utime_t interval_; srs_utime_t interval_;
std::vector<ISrsFastTimerHandler *> handlers_; std::vector<ISrsFastTimerHandler *> handlers_;
@ -156,7 +156,7 @@ public:
void subscribe(ISrsFastTimerHandler *timer); void subscribe(ISrsFastTimerHandler *timer);
void unsubscribe(ISrsFastTimerHandler *timer); void unsubscribe(ISrsFastTimerHandler *timer);
// Interface ISrsCoroutineHandler // Interface ISrsCoroutineHandler
private: SRS_DECLARE_PRIVATE:
// Cycle the hourglass, which will sleep resolution every time. // Cycle the hourglass, which will sleep resolution every time.
// and call handler when ticked. // and call handler when ticked.
virtual srs_error_t cycle(); virtual srs_error_t cycle();
@ -165,14 +165,14 @@ private:
// To monitor the system wall clock timer deviation. // To monitor the system wall clock timer deviation.
class SrsClockWallMonitor : public ISrsFastTimerHandler class SrsClockWallMonitor : public ISrsFastTimerHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsTime *time_; ISrsTime *time_;
public: public:
SrsClockWallMonitor(); SrsClockWallMonitor();
virtual ~SrsClockWallMonitor(); virtual ~SrsClockWallMonitor();
// interface ISrsFastTimerHandler // interface ISrsFastTimerHandler
private: SRS_DECLARE_PRIVATE:
srs_error_t on_timer(srs_utime_t interval); srs_error_t on_timer(srs_utime_t interval);
}; };
@ -193,7 +193,7 @@ public:
// Global shared timer manager // Global shared timer manager
class SrsSharedTimer : public ISrsSharedTimer class SrsSharedTimer : public ISrsSharedTimer
{ {
private: SRS_DECLARE_PRIVATE:
SrsFastTimer *timer20ms_; SrsFastTimer *timer20ms_;
SrsFastTimer *timer100ms_; SrsFastTimer *timer100ms_;
SrsFastTimer *timer1s_; SrsFastTimer *timer1s_;

View File

@ -71,10 +71,10 @@ public:
// A pps manager every some duration. // A pps manager every some duration.
class SrsPps class SrsPps
{ {
private: SRS_DECLARE_PRIVATE:
ISrsClock *clk_; ISrsClock *clk_;
private: SRS_DECLARE_PRIVATE:
// samples // samples
SrsRateSample sample_10s_; SrsRateSample sample_10s_;
SrsRateSample sample_30s_; SrsRateSample sample_30s_;
@ -252,7 +252,7 @@ void srs_global_rtc_update(SrsKbsRtcStats *stats);
*/ */
class SrsKbpsSlice class SrsKbpsSlice
{ {
private: SRS_DECLARE_PRIVATE:
ISrsClock *clk_; ISrsClock *clk_;
public: public:
@ -315,7 +315,7 @@ public:
// sent out each UDP packet. // sent out each UDP packet.
class SrsEphemeralDelta : public ISrsEphemeralDelta class SrsEphemeralDelta : public ISrsEphemeralDelta
{ {
private: SRS_DECLARE_PRIVATE:
uint64_t in_; uint64_t in_;
uint64_t out_; uint64_t out_;
@ -344,7 +344,7 @@ public:
// A network delta data source for SrsKbps. // A network delta data source for SrsKbps.
class SrsNetworkDelta : public ISrsNetworkDelta class SrsNetworkDelta : public ISrsNetworkDelta
{ {
private: SRS_DECLARE_PRIVATE:
ISrsProtocolStatistic *in_; ISrsProtocolStatistic *in_;
ISrsProtocolStatistic *out_; ISrsProtocolStatistic *out_;
uint64_t in_base_; uint64_t in_base_;
@ -375,7 +375,7 @@ public:
*/ */
class SrsKbps class SrsKbps
{ {
private: SRS_DECLARE_PRIVATE:
SrsKbpsSlice *is_; SrsKbpsSlice *is_;
SrsKbpsSlice *os_; SrsKbpsSlice *os_;
ISrsClock *clk_; ISrsClock *clk_;
@ -411,7 +411,7 @@ public:
// A sugar to use SrsNetworkDelta and SrsKbps. // A sugar to use SrsNetworkDelta and SrsKbps.
class SrsNetworkKbps class SrsNetworkKbps
{ {
private: SRS_DECLARE_PRIVATE:
SrsNetworkDelta *delta_; SrsNetworkDelta *delta_;
SrsKbps *kbps_; SrsKbps *kbps_;

View File

@ -94,7 +94,7 @@ public:
#define SrsContextRestore(cid) impl_SrsContextRestore _context_restore_instance(cid) #define SrsContextRestore(cid) impl_SrsContextRestore _context_restore_instance(cid)
class impl_SrsContextRestore class impl_SrsContextRestore
{ {
private: SRS_DECLARE_PRIVATE:
SrsContextId cid_; SrsContextId cid_;
public: public:

View File

@ -32,7 +32,7 @@ public:
*/ */
class SrsMp3Transmuxer : public ISrsMp3Transmuxer class SrsMp3Transmuxer : public ISrsMp3Transmuxer
{ {
private: SRS_DECLARE_PRIVATE:
ISrsFileWriter *writer_; ISrsFileWriter *writer_;
public: public:

View File

@ -177,7 +177,7 @@ public:
// ISO_IEC_14496-12-base-format-2012.pdf, page 16 // ISO_IEC_14496-12-base-format-2012.pdf, page 16
class SrsMp4Box : public ISrsCodec class SrsMp4Box : public ISrsCodec
{ {
private: SRS_DECLARE_PRIVATE:
// The size is the entire size of the box, including the size and type header, fields, // The size is the entire size of the box, including the size and type header, fields,
// And all contained boxes. This facilitates general parsing of the file. // And all contained boxes. This facilitates general parsing of the file.
// //
@ -195,10 +195,10 @@ public:
// For box 'uuid'. // For box 'uuid'.
std::vector<char> usertype_; std::vector<char> usertype_;
protected: SRS_DECLARE_PROTECTED:
std::vector<SrsMp4Box *> boxes_; std::vector<SrsMp4Box *> boxes_;
private: SRS_DECLARE_PRIVATE:
// The position at buffer to start demux the box. // The position at buffer to start demux the box.
int start_pos_; int start_pos_;
@ -240,12 +240,12 @@ public:
virtual srs_error_t encode(SrsBuffer *buf); virtual srs_error_t encode(SrsBuffer *buf);
virtual srs_error_t decode(SrsBuffer *buf); virtual srs_error_t decode(SrsBuffer *buf);
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t encode_boxes(SrsBuffer *buf); virtual srs_error_t encode_boxes(SrsBuffer *buf);
virtual srs_error_t decode_boxes(SrsBuffer *buf); virtual srs_error_t decode_boxes(SrsBuffer *buf);
// Sub classes can override these functions for special codec. // Sub classes can override these functions for special codec.
// @remark For mdat box, we use completely different codec. // @remark For mdat box, we use completely different codec.
protected: SRS_DECLARE_PROTECTED:
// The size of header, not including the contained boxes. // The size of header, not including the contained boxes.
virtual int nb_header(); virtual int nb_header();
// It's not necessary to check the buffer, because we already know the size in parent function, // It's not necessary to check the buffer, because we already know the size in parent function,
@ -276,7 +276,7 @@ public:
SrsMp4FullBox(); SrsMp4FullBox();
virtual ~SrsMp4FullBox(); virtual ~SrsMp4FullBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -299,7 +299,7 @@ public:
// An informative integer for the minor version of the major brand // An informative integer for the minor version of the major brand
uint32_t minor_version_; uint32_t minor_version_;
private: SRS_DECLARE_PRIVATE:
// A list, to the end of the box, of brands // A list, to the end of the box, of brands
std::vector<SrsMp4BoxBrand> compatible_brands_; std::vector<SrsMp4BoxBrand> compatible_brands_;
@ -312,7 +312,7 @@ public:
virtual void set_compatible_brands(SrsMp4BoxBrand b0, SrsMp4BoxBrand b1, SrsMp4BoxBrand b2); virtual void set_compatible_brands(SrsMp4BoxBrand b0, SrsMp4BoxBrand b1, SrsMp4BoxBrand b2);
virtual void set_compatible_brands(SrsMp4BoxBrand b0, SrsMp4BoxBrand b1, SrsMp4BoxBrand b2, SrsMp4BoxBrand b3); virtual void set_compatible_brands(SrsMp4BoxBrand b0, SrsMp4BoxBrand b1, SrsMp4BoxBrand b2, SrsMp4BoxBrand b3);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -370,7 +370,7 @@ public:
SrsMp4MovieFragmentHeaderBox(); SrsMp4MovieFragmentHeaderBox();
virtual ~SrsMp4MovieFragmentHeaderBox(); virtual ~SrsMp4MovieFragmentHeaderBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -452,7 +452,7 @@ public:
SrsMp4TrackFragmentHeaderBox(); SrsMp4TrackFragmentHeaderBox();
virtual ~SrsMp4TrackFragmentHeaderBox(); virtual ~SrsMp4TrackFragmentHeaderBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -478,7 +478,7 @@ public:
SrsMp4TrackFragmentDecodeTimeBox(); SrsMp4TrackFragmentDecodeTimeBox();
virtual ~SrsMp4TrackFragmentDecodeTimeBox(); virtual ~SrsMp4TrackFragmentDecodeTimeBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -554,7 +554,7 @@ public:
SrsMp4TrackFragmentRunBox(); SrsMp4TrackFragmentRunBox();
virtual ~SrsMp4TrackFragmentRunBox(); virtual ~SrsMp4TrackFragmentRunBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -629,7 +629,7 @@ public:
// because the mdat only decode the header. // because the mdat only decode the header.
virtual srs_error_t decode(SrsBuffer *buf); virtual srs_error_t decode(SrsBuffer *buf);
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t encode_boxes(SrsBuffer *buf); virtual srs_error_t encode_boxes(SrsBuffer *buf);
virtual srs_error_t decode_boxes(SrsBuffer *buf); virtual srs_error_t decode_boxes(SrsBuffer *buf);
@ -641,14 +641,14 @@ public:
// ISO_IEC_14496-12-base-format-2012.pdf, page 29 // ISO_IEC_14496-12-base-format-2012.pdf, page 29
class SrsMp4FreeSpaceBox : public SrsMp4Box class SrsMp4FreeSpaceBox : public SrsMp4Box
{ {
private: SRS_DECLARE_PRIVATE:
std::vector<char> data_; std::vector<char> data_;
public: public:
SrsMp4FreeSpaceBox(SrsMp4BoxType v); SrsMp4FreeSpaceBox(SrsMp4BoxType v);
virtual ~SrsMp4FreeSpaceBox(); virtual ~SrsMp4FreeSpaceBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -685,7 +685,7 @@ public:
// Get the number of audio tracks. // Get the number of audio tracks.
virtual int nb_soun_tracks(); virtual int nb_soun_tracks();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -738,7 +738,7 @@ public:
// Get the duration in ms. // Get the duration in ms.
virtual uint64_t duration(); virtual uint64_t duration();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -787,7 +787,7 @@ public:
SrsMp4TrackExtendsBox(); SrsMp4TrackExtendsBox();
virtual ~SrsMp4TrackExtendsBox(); virtual ~SrsMp4TrackExtendsBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -915,7 +915,7 @@ public:
SrsMp4TrackHeaderBox(); SrsMp4TrackHeaderBox();
virtual ~SrsMp4TrackHeaderBox(); virtual ~SrsMp4TrackHeaderBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -985,7 +985,7 @@ public:
SrsMp4EditListBox(); SrsMp4EditListBox();
virtual ~SrsMp4EditListBox(); virtual ~SrsMp4EditListBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1042,7 +1042,7 @@ public:
// longest track in the presentation. If the duration cannot be determined then duration is set to all 1s. // longest track in the presentation. If the duration cannot be determined then duration is set to all 1s.
uint64_t duration_; uint64_t duration_;
private: SRS_DECLARE_PRIVATE:
// The language code for this media. See ISO 639-2/T for the set of three character // The language code for this media. See ISO 639-2/T for the set of three character
// codes. Each character is packed as the difference between its ASCII value and 0x60. Since the code // codes. Each character is packed as the difference between its ASCII value and 0x60. Since the code
// is confined to being three lower-case letters, these values are strictly positive. // is confined to being three lower-case letters, these values are strictly positive.
@ -1067,7 +1067,7 @@ public:
virtual char language2(); virtual char language2();
virtual void set_language2(char v); virtual void set_language2(char v);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1101,7 +1101,7 @@ public:
virtual bool is_video(); virtual bool is_video();
virtual bool is_audio(); virtual bool is_audio();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1152,7 +1152,7 @@ public:
SrsMp4VideoMeidaHeaderBox(); SrsMp4VideoMeidaHeaderBox();
virtual ~SrsMp4VideoMeidaHeaderBox(); virtual ~SrsMp4VideoMeidaHeaderBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1174,7 +1174,7 @@ public:
SrsMp4SoundMeidaHeaderBox(); SrsMp4SoundMeidaHeaderBox();
virtual ~SrsMp4SoundMeidaHeaderBox(); virtual ~SrsMp4SoundMeidaHeaderBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1220,7 +1220,7 @@ public:
SrsMp4DataEntryUrlBox(); SrsMp4DataEntryUrlBox();
virtual ~SrsMp4DataEntryUrlBox(); virtual ~SrsMp4DataEntryUrlBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1240,7 +1240,7 @@ public:
SrsMp4DataEntryUrnBox(); SrsMp4DataEntryUrnBox();
virtual ~SrsMp4DataEntryUrnBox(); virtual ~SrsMp4DataEntryUrnBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1256,7 +1256,7 @@ public:
// in this table to the samples in the track. A track may be split over several sources in this way. // in this table to the samples in the track. A track may be split over several sources in this way.
class SrsMp4DataReferenceBox : public SrsMp4FullBox class SrsMp4DataReferenceBox : public SrsMp4FullBox
{ {
private: SRS_DECLARE_PRIVATE:
std::vector<SrsMp4DataEntryBox *> entries_; std::vector<SrsMp4DataEntryBox *> entries_;
public: public:
@ -1269,7 +1269,7 @@ public:
// Note that box must be SrsMp4DataEntryBox* // Note that box must be SrsMp4DataEntryBox*
virtual void append(SrsMp4Box *box); virtual void append(SrsMp4Box *box);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1315,7 +1315,7 @@ public:
virtual SrsMp4SyncSampleBox *stss(); virtual SrsMp4SyncSampleBox *stss();
virtual void set_stss(SrsMp4SyncSampleBox *v); virtual void set_stss(SrsMp4SyncSampleBox *v);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1336,7 +1336,7 @@ public:
SrsMp4SampleEntry(); SrsMp4SampleEntry();
virtual ~SrsMp4SampleEntry(); virtual ~SrsMp4SampleEntry();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1386,7 +1386,7 @@ public:
virtual SrsMp4HvcCBox *hvcC(); virtual SrsMp4HvcCBox *hvcC();
virtual void set_hvcC(SrsMp4HvcCBox *v); virtual void set_hvcC(SrsMp4HvcCBox *v);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1406,7 +1406,7 @@ public:
SrsMp4AvccBox(); SrsMp4AvccBox();
virtual ~SrsMp4AvccBox(); virtual ~SrsMp4AvccBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1426,7 +1426,7 @@ public:
SrsMp4HvcCBox(); SrsMp4HvcCBox();
virtual ~SrsMp4HvcCBox(); virtual ~SrsMp4HvcCBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1458,7 +1458,7 @@ public:
// For AAC codec, get the asc. // For AAC codec, get the asc.
virtual SrsMp4DecoderSpecificInfo *asc(); virtual SrsMp4DecoderSpecificInfo *asc();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1491,7 +1491,7 @@ public:
SrsMp4ESTagEs tag; // bit(8) SrsMp4ESTagEs tag; // bit(8)
// The decoded or encoded variant length. // The decoded or encoded variant length.
int32_t vlen; // bit(28) int32_t vlen; // bit(28)
private: SRS_DECLARE_PRIVATE:
// The position at buffer to start demux the box. // The position at buffer to start demux the box.
int start_pos; int start_pos;
@ -1508,7 +1508,7 @@ public:
virtual srs_error_t encode(SrsBuffer *buf); virtual srs_error_t encode(SrsBuffer *buf);
virtual srs_error_t decode(SrsBuffer *buf); virtual srs_error_t decode(SrsBuffer *buf);
protected: SRS_DECLARE_PROTECTED:
virtual int32_t nb_payload() = 0; virtual int32_t nb_payload() = 0;
virtual srs_error_t encode_payload(SrsBuffer *buf) = 0; virtual srs_error_t encode_payload(SrsBuffer *buf) = 0;
virtual srs_error_t decode_payload(SrsBuffer *buf) = 0; virtual srs_error_t decode_payload(SrsBuffer *buf) = 0;
@ -1549,7 +1549,7 @@ public:
SrsMp4DecoderSpecificInfo(); SrsMp4DecoderSpecificInfo();
virtual ~SrsMp4DecoderSpecificInfo(); virtual ~SrsMp4DecoderSpecificInfo();
protected: SRS_DECLARE_PROTECTED:
virtual int32_t nb_payload(); virtual int32_t nb_payload();
virtual srs_error_t encode_payload(SrsBuffer *buf); virtual srs_error_t encode_payload(SrsBuffer *buf);
virtual srs_error_t decode_payload(SrsBuffer *buf); virtual srs_error_t decode_payload(SrsBuffer *buf);
@ -1577,7 +1577,7 @@ public:
SrsMp4DecoderConfigDescriptor(); SrsMp4DecoderConfigDescriptor();
virtual ~SrsMp4DecoderConfigDescriptor(); virtual ~SrsMp4DecoderConfigDescriptor();
protected: SRS_DECLARE_PROTECTED:
virtual int32_t nb_payload(); virtual int32_t nb_payload();
virtual srs_error_t encode_payload(SrsBuffer *buf); virtual srs_error_t encode_payload(SrsBuffer *buf);
virtual srs_error_t decode_payload(SrsBuffer *buf); virtual srs_error_t decode_payload(SrsBuffer *buf);
@ -1597,7 +1597,7 @@ public:
SrsMp4SLConfigDescriptor(); SrsMp4SLConfigDescriptor();
virtual ~SrsMp4SLConfigDescriptor(); virtual ~SrsMp4SLConfigDescriptor();
protected: SRS_DECLARE_PROTECTED:
virtual int32_t nb_payload(); virtual int32_t nb_payload();
virtual srs_error_t encode_payload(SrsBuffer *buf); virtual srs_error_t encode_payload(SrsBuffer *buf);
virtual srs_error_t decode_payload(SrsBuffer *buf); virtual srs_error_t decode_payload(SrsBuffer *buf);
@ -1626,7 +1626,7 @@ public:
SrsMp4ES_Descriptor(); SrsMp4ES_Descriptor();
virtual ~SrsMp4ES_Descriptor(); virtual ~SrsMp4ES_Descriptor();
protected: SRS_DECLARE_PROTECTED:
virtual int32_t nb_payload(); virtual int32_t nb_payload();
virtual srs_error_t encode_payload(SrsBuffer *buf); virtual srs_error_t encode_payload(SrsBuffer *buf);
virtual srs_error_t decode_payload(SrsBuffer *buf); virtual srs_error_t decode_payload(SrsBuffer *buf);
@ -1652,7 +1652,7 @@ public:
// For AAC codec, get the asc. // For AAC codec, get the asc.
virtual SrsMp4DecoderSpecificInfo *asc(); virtual SrsMp4DecoderSpecificInfo *asc();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1667,7 +1667,7 @@ public:
// information needed for that coding. // information needed for that coding.
class SrsMp4SampleDescriptionBox : public SrsMp4FullBox class SrsMp4SampleDescriptionBox : public SrsMp4FullBox
{ {
private: SRS_DECLARE_PRIVATE:
std::vector<SrsMp4SampleEntry *> entries_; std::vector<SrsMp4SampleEntry *> entries_;
public: public:
@ -1686,7 +1686,7 @@ public:
// Note that box must be SrsMp4SampleEntry* // Note that box must be SrsMp4SampleEntry*
virtual void append(SrsMp4Box *box); virtual void append(SrsMp4Box *box);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1726,7 +1726,7 @@ public:
// An integer that gives the number of entries in the following table. // An integer that gives the number of entries in the following table.
std::vector<SrsMp4SttsEntry> entries_; std::vector<SrsMp4SttsEntry> entries_;
private: SRS_DECLARE_PRIVATE:
// The index for counter to calc the dts for samples. // The index for counter to calc the dts for samples.
uint32_t index_; uint32_t index_;
uint32_t count_; uint32_t count_;
@ -1741,7 +1741,7 @@ public:
// When got an sample, index starts from 0. // When got an sample, index starts from 0.
virtual srs_error_t on_sample(uint32_t sample_index, SrsMp4SttsEntry **ppentry); virtual srs_error_t on_sample(uint32_t sample_index, SrsMp4SttsEntry **ppentry);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1786,7 +1786,7 @@ public:
// An integer that gives the number of entries in the following table. // An integer that gives the number of entries in the following table.
std::vector<SrsMp4CttsEntry> entries_; std::vector<SrsMp4CttsEntry> entries_;
private: SRS_DECLARE_PRIVATE:
// The index for counter to calc the dts for samples. // The index for counter to calc the dts for samples.
uint32_t index_; uint32_t index_;
uint32_t count_; uint32_t count_;
@ -1801,7 +1801,7 @@ public:
// When got an sample, index starts from 0. // When got an sample, index starts from 0.
virtual srs_error_t on_sample(uint32_t sample_index, SrsMp4CttsEntry **ppentry); virtual srs_error_t on_sample(uint32_t sample_index, SrsMp4CttsEntry **ppentry);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1831,7 +1831,7 @@ public:
// Whether the sample is sync, index starts from 0. // Whether the sample is sync, index starts from 0.
virtual bool is_sync(uint32_t sample_index); virtual bool is_sync(uint32_t sample_index);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1876,7 +1876,7 @@ public:
// The numbers of the samples that are sync samples in the stream. // The numbers of the samples that are sync samples in the stream.
SrsMp4StscEntry *entries_; SrsMp4StscEntry *entries_;
private: SRS_DECLARE_PRIVATE:
// The index for counter to calc the dts for samples. // The index for counter to calc the dts for samples.
uint32_t index_; uint32_t index_;
@ -1890,7 +1890,7 @@ public:
// When got an chunk, index starts from 0. // When got an chunk, index starts from 0.
virtual SrsMp4StscEntry *on_chunk(uint32_t chunk_index); virtual SrsMp4StscEntry *on_chunk(uint32_t chunk_index);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1917,7 +1917,7 @@ public:
SrsMp4ChunkOffsetBox(); SrsMp4ChunkOffsetBox();
virtual ~SrsMp4ChunkOffsetBox(); virtual ~SrsMp4ChunkOffsetBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1944,7 +1944,7 @@ public:
SrsMp4ChunkLargeOffsetBox(); SrsMp4ChunkLargeOffsetBox();
virtual ~SrsMp4ChunkLargeOffsetBox(); virtual ~SrsMp4ChunkLargeOffsetBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -1979,7 +1979,7 @@ public:
// Get the size of sample. // Get the size of sample.
virtual srs_error_t get_sample_size(uint32_t sample_index, uint32_t *psample_size); virtual srs_error_t get_sample_size(uint32_t sample_index, uint32_t *psample_size);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -2001,7 +2001,7 @@ public:
SrsMp4UserDataBox(); SrsMp4UserDataBox();
virtual ~SrsMp4UserDataBox(); virtual ~SrsMp4UserDataBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -2040,7 +2040,7 @@ public:
SrsMp4SegmentIndexBox(); SrsMp4SegmentIndexBox();
virtual ~SrsMp4SegmentIndexBox(); virtual ~SrsMp4SegmentIndexBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -2079,7 +2079,7 @@ public:
SrsMp4SampleAuxiliaryInfoSizeBox(); SrsMp4SampleAuxiliaryInfoSizeBox();
virtual ~SrsMp4SampleAuxiliaryInfoSizeBox(); virtual ~SrsMp4SampleAuxiliaryInfoSizeBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -2117,7 +2117,7 @@ public:
SrsMp4SampleAuxiliaryInfoOffsetBox(); SrsMp4SampleAuxiliaryInfoOffsetBox();
virtual ~SrsMp4SampleAuxiliaryInfoOffsetBox(); virtual ~SrsMp4SampleAuxiliaryInfoOffsetBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -2162,7 +2162,7 @@ public:
virtual std::stringstream &dumps(std::stringstream &ss, SrsMp4DumpContext dc); virtual std::stringstream &dumps(std::stringstream &ss, SrsMp4DumpContext dc);
private: SRS_DECLARE_PRIVATE:
SrsMp4FullBox *senc_; SrsMp4FullBox *senc_;
uint8_t per_sample_iv_size_; uint8_t per_sample_iv_size_;
uint8_t *iv_; uint8_t *iv_;
@ -2195,7 +2195,7 @@ class SrsMp4SampleEncryptionBox : public SrsMp4FullBox
public: public:
std::vector<SrsMp4SampleEncryptionEntry *> entries_; std::vector<SrsMp4SampleEncryptionEntry *> entries_;
private: SRS_DECLARE_PRIVATE:
uint8_t per_sample_iv_size_; uint8_t per_sample_iv_size_;
public: public:
@ -2204,7 +2204,7 @@ public:
SrsMp4SampleEncryptionBox(uint8_t per_sample_iv_size); SrsMp4SampleEncryptionBox(uint8_t per_sample_iv_size);
virtual ~SrsMp4SampleEncryptionBox(); virtual ~SrsMp4SampleEncryptionBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -2220,14 +2220,14 @@ public:
// } // }
class SrsMp4OriginalFormatBox : public SrsMp4Box class SrsMp4OriginalFormatBox : public SrsMp4Box
{ {
private: SRS_DECLARE_PRIVATE:
uint32_t data_format_; uint32_t data_format_;
public: public:
SrsMp4OriginalFormatBox(uint32_t original_format); SrsMp4OriginalFormatBox(uint32_t original_format);
virtual ~SrsMp4OriginalFormatBox(); virtual ~SrsMp4OriginalFormatBox();
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -2263,7 +2263,7 @@ public:
public: public:
virtual void set_scheme_uri(char *uri, uint32_t uri_size); virtual void set_scheme_uri(char *uri, uint32_t uri_size);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -2387,7 +2387,7 @@ public:
public: public:
virtual void set_default_constant_IV(uint8_t *iv, uint8_t iv_size); virtual void set_default_constant_IV(uint8_t *iv, uint8_t iv_size);
protected: SRS_DECLARE_PROTECTED:
virtual int nb_header(); virtual int nb_header();
virtual srs_error_t encode_header(SrsBuffer *buf); virtual srs_error_t encode_header(SrsBuffer *buf);
virtual srs_error_t decode_header(SrsBuffer *buf); virtual srs_error_t decode_header(SrsBuffer *buf);
@ -2438,7 +2438,7 @@ public:
// Handles timing offset between audio and video tracks to ensure proper A/V sync in MP4 files. // Handles timing offset between audio and video tracks to ensure proper A/V sync in MP4 files.
class SrsMp4DvrJitter class SrsMp4DvrJitter
{ {
private: SRS_DECLARE_PRIVATE:
uint64_t video_start_dts_; uint64_t video_start_dts_;
uint64_t audio_start_dts_; uint64_t audio_start_dts_;
bool has_first_video_; bool has_first_video_;
@ -2455,7 +2455,7 @@ public:
// to maintain A/V synchronization in MP4 files // to maintain A/V synchronization in MP4 files
virtual uint32_t get_first_sample_delta(SrsFrameType track); virtual uint32_t get_first_sample_delta(SrsFrameType track);
private: SRS_DECLARE_PRIVATE:
// Reset the jitter state (useful for new recording sessions) // Reset the jitter state (useful for new recording sessions)
virtual void reset(); virtual void reset();
// Check if both audio and video start times have been captured // Check if both audio and video start times have been captured
@ -2473,7 +2473,7 @@ private:
// The keyframe is specified by stss. // The keyframe is specified by stss.
class SrsMp4SampleManager class SrsMp4SampleManager
{ {
private: SRS_DECLARE_PRIVATE:
SrsMp4DvrJitter *jitter_; // MP4 A/V sync jitter handler SrsMp4DvrJitter *jitter_; // MP4 A/V sync jitter handler
public: public:
@ -2497,13 +2497,13 @@ public:
// @param The dts is the dts of last segment. // @param The dts is the dts of last segment.
virtual srs_error_t write(SrsMp4TrackFragmentBox *traf, uint64_t dts); virtual srs_error_t write(SrsMp4TrackFragmentBox *traf, uint64_t dts);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t write_track(SrsFrameType track, virtual srs_error_t write_track(SrsFrameType track,
SrsMp4DecodingTime2SampleBox *stts, SrsMp4SyncSampleBox *stss, SrsMp4CompositionTime2SampleBox *ctts, SrsMp4DecodingTime2SampleBox *stts, SrsMp4SyncSampleBox *stss, SrsMp4CompositionTime2SampleBox *ctts,
SrsMp4Sample2ChunkBox *stsc, SrsMp4SampleSizeBox *stsz, SrsMp4FullBox *co); SrsMp4Sample2ChunkBox *stsc, SrsMp4SampleSizeBox *stsz, SrsMp4FullBox *co);
virtual srs_error_t do_load(std::map<uint64_t, SrsMp4Sample *> &tses, SrsMp4MovieBox *moov); virtual srs_error_t do_load(std::map<uint64_t, SrsMp4Sample *> &tses, SrsMp4MovieBox *moov);
private: SRS_DECLARE_PRIVATE:
// Load the samples of track from stco, stsz and stsc. // Load the samples of track from stco, stsz and stsc.
// @param tses The temporary samples, key is offset, value is sample. // @param tses The temporary samples, key is offset, value is sample.
// @param tt The type of sample, convert to flv tag type. // @param tt The type of sample, convert to flv tag type.
@ -2517,7 +2517,7 @@ private:
// @remark For mdat box, we only decode the header, then skip the data. // @remark For mdat box, we only decode the header, then skip the data.
class SrsMp4BoxReader class SrsMp4BoxReader
{ {
private: SRS_DECLARE_PRIVATE:
ISrsReadSeeker *rsio_; ISrsReadSeeker *rsio_;
// The temporary buffer to read from buffer. // The temporary buffer to read from buffer.
char *buf_; char *buf_;
@ -2533,7 +2533,7 @@ public:
// Read a MP4 box to pbox, the stream is fill with the bytes of box to decode. // Read a MP4 box to pbox, the stream is fill with the bytes of box to decode.
virtual srs_error_t read(SrsSimpleStream *stream, SrsMp4Box **ppbox); virtual srs_error_t read(SrsSimpleStream *stream, SrsMp4Box **ppbox);
private: SRS_DECLARE_PRIVATE:
srs_error_t do_read(SrsSimpleStream *stream, SrsMp4Box *&box); srs_error_t do_read(SrsSimpleStream *stream, SrsMp4Box *&box);
public: public:
@ -2544,7 +2544,7 @@ public:
// The MP4 demuxer. // The MP4 demuxer.
class SrsMp4Decoder class SrsMp4Decoder
{ {
private: SRS_DECLARE_PRIVATE:
// The major brand of decoder, parse from ftyp. // The major brand of decoder, parse from ftyp.
SrsMp4BoxBrand brand_; SrsMp4BoxBrand brand_;
// The samples build from moov. // The samples build from moov.
@ -2559,7 +2559,7 @@ public:
// TODO: FIXME: Use SrsFormat instead. // TODO: FIXME: Use SrsFormat instead.
SrsVideoCodecId vcodec_; SrsVideoCodecId vcodec_;
private: SRS_DECLARE_PRIVATE:
// For H.264/AVC, the avcc contains the sps/pps. // For H.264/AVC, the avcc contains the sps/pps.
std::vector<char> pavcc_; std::vector<char> pavcc_;
// Whether avcc is written to reader. // Whether avcc is written to reader.
@ -2576,13 +2576,13 @@ public:
// The audio sound type. // The audio sound type.
SrsAudioChannels channels_; SrsAudioChannels channels_;
private: SRS_DECLARE_PRIVATE:
// For AAC, the asc in esds box. // For AAC, the asc in esds box.
std::vector<char> pasc_; std::vector<char> pasc_;
// Whether asc is written to reader. // Whether asc is written to reader.
bool asc_written_; bool asc_written_;
private: SRS_DECLARE_PRIVATE:
// Underlayer reader and seeker. // Underlayer reader and seeker.
// @remark The demuxer must use seeker for general MP4 to seek the moov. // @remark The demuxer must use seeker for general MP4 to seek the moov.
ISrsReadSeeker *rsio_; ISrsReadSeeker *rsio_;
@ -2612,11 +2612,11 @@ public:
virtual srs_error_t read_sample(SrsMp4HandlerType *pht, uint16_t *pft, uint16_t *pct, virtual srs_error_t read_sample(SrsMp4HandlerType *pht, uint16_t *pft, uint16_t *pct,
uint32_t *pdts, uint32_t *ppts, uint8_t **psample, uint32_t *pnb_sample); uint32_t *pdts, uint32_t *ppts, uint8_t **psample, uint32_t *pnb_sample);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t parse_ftyp(SrsMp4FileTypeBox *ftyp); virtual srs_error_t parse_ftyp(SrsMp4FileTypeBox *ftyp);
virtual srs_error_t parse_moov(SrsMp4MovieBox *moov); virtual srs_error_t parse_moov(SrsMp4MovieBox *moov);
private: SRS_DECLARE_PRIVATE:
// Load the next box from reader. // Load the next box from reader.
// @param required_box_type The box type required, 0 for any box. // @param required_box_type The box type required, 0 for any box.
virtual srs_error_t load_next_box(SrsMp4Box **ppbox, uint32_t required_box_type); virtual srs_error_t load_next_box(SrsMp4Box **ppbox, uint32_t required_box_type);
@ -2646,7 +2646,7 @@ public:
// The MP4 muxer. // The MP4 muxer.
class SrsMp4Encoder : public ISrsMp4Encoder class SrsMp4Encoder : public ISrsMp4Encoder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsWriteSeeker *wsio_; ISrsWriteSeeker *wsio_;
// The mdat offset at file, we must update the header when flush. // The mdat offset at file, we must update the header when flush.
off_t mdat_offset_; off_t mdat_offset_;
@ -2666,7 +2666,7 @@ public:
// The audio sound type. // The audio sound type.
SrsAudioChannels channels_; SrsAudioChannels channels_;
private: SRS_DECLARE_PRIVATE:
// For AAC, the asc in esds box. // For AAC, the asc in esds box.
std::vector<char> pasc_; std::vector<char> pasc_;
// The number of audio samples. // The number of audio samples.
@ -2679,7 +2679,7 @@ public:
// Forbidden if no video stream. // Forbidden if no video stream.
SrsVideoCodecId vcodec_; SrsVideoCodecId vcodec_;
private: SRS_DECLARE_PRIVATE:
// For H.264/AVC, the avcc contains the sps/pps. // For H.264/AVC, the avcc contains the sps/pps.
std::vector<char> pavcc_; std::vector<char> pavcc_;
// For H.265/HEVC, the hvcC contains the vps/sps/pps. // For H.265/HEVC, the hvcC contains the vps/sps/pps.
@ -2715,7 +2715,7 @@ public:
virtual void set_audio_codec(SrsAudioCodecId vcodec, SrsAudioSampleRate sample_rate, SrsAudioSampleBits sound_bits, SrsAudioChannels channels); virtual void set_audio_codec(SrsAudioCodecId vcodec, SrsAudioSampleRate sample_rate, SrsAudioSampleBits sound_bits, SrsAudioChannels channels);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t copy_sequence_header(SrsFormat *format, bool vsh, uint8_t *sample, uint32_t nb_sample); virtual srs_error_t copy_sequence_header(SrsFormat *format, bool vsh, uint8_t *sample, uint32_t nb_sample);
virtual srs_error_t do_write_sample(SrsMp4Sample *ps, uint8_t *sample, uint32_t nb_sample); virtual srs_error_t do_write_sample(SrsMp4Sample *ps, uint8_t *sample, uint32_t nb_sample);
virtual SrsMp4ObjectType get_audio_object_type(); virtual SrsMp4ObjectType get_audio_object_type();
@ -2739,10 +2739,10 @@ public:
// TODO: What the M2ts short for? // TODO: What the M2ts short for?
class SrsMp4M2tsInitEncoder : public ISrsMp4M2tsInitEncoder class SrsMp4M2tsInitEncoder : public ISrsMp4M2tsInitEncoder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsWriter *writer_; ISrsWriter *writer_;
private: SRS_DECLARE_PRIVATE:
uint8_t crypt_byte_block_; uint8_t crypt_byte_block_;
uint8_t skip_byte_block_; uint8_t skip_byte_block_;
unsigned char kid_[16]; unsigned char kid_[16];
@ -2782,7 +2782,7 @@ public:
*/ */
virtual srs_error_t write(SrsFormat *format, int v_tid, int a_tid); virtual srs_error_t write(SrsFormat *format, int v_tid, int a_tid);
private: SRS_DECLARE_PRIVATE:
/** /**
* box->type = 'encv' or 'enca' * box->type = 'encv' or 'enca'
* |encv| * |encv|
@ -2824,13 +2824,13 @@ public:
// TODO: fmp4 support package more than one tracks. // TODO: fmp4 support package more than one tracks.
class SrsMp4M2tsSegmentEncoder : public ISrsMp4M2tsSegmentEncoder class SrsMp4M2tsSegmentEncoder : public ISrsMp4M2tsSegmentEncoder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsWriter *writer_; ISrsWriter *writer_;
uint32_t sequence_number_; uint32_t sequence_number_;
srs_utime_t decode_basetime_; srs_utime_t decode_basetime_;
uint32_t track_id_; uint32_t track_id_;
private: SRS_DECLARE_PRIVATE:
uint32_t nb_audios_; uint32_t nb_audios_;
uint32_t nb_videos_; uint32_t nb_videos_;
uint32_t styp_bytes_; uint32_t styp_bytes_;
@ -2863,7 +2863,7 @@ public:
// TODO: fmp4 support package more than one tracks. // TODO: fmp4 support package more than one tracks.
class SrsFmp4SegmentEncoder class SrsFmp4SegmentEncoder
{ {
private: SRS_DECLARE_PRIVATE:
ISrsWriter *writer_; ISrsWriter *writer_;
uint32_t sequence_number_; uint32_t sequence_number_;
// TODO: audio, video may have different basetime. // TODO: audio, video may have different basetime.
@ -2871,7 +2871,7 @@ private:
uint32_t audio_track_id_; uint32_t audio_track_id_;
uint32_t video_track_id_; uint32_t video_track_id_;
private: SRS_DECLARE_PRIVATE:
uint32_t nb_audios_; uint32_t nb_audios_;
uint32_t nb_videos_; uint32_t nb_videos_;
uint32_t styp_bytes_; uint32_t styp_bytes_;
@ -2880,7 +2880,7 @@ private:
SrsMp4SampleManager *audio_samples_; SrsMp4SampleManager *audio_samples_;
SrsMp4SampleManager *video_samples_; SrsMp4SampleManager *video_samples_;
private: SRS_DECLARE_PRIVATE:
// Encryption // Encryption
unsigned char *key_; unsigned char *key_;
unsigned char iv_[16]; unsigned char iv_[16];

View File

@ -252,17 +252,17 @@ public:
virtual SrsParsedVideoPacket *video(); virtual SrsParsedVideoPacket *video();
virtual SrsVideoCodecConfig *vcodec(); virtual SrsVideoCodecConfig *vcodec();
private: SRS_DECLARE_PRIVATE:
// Demux the video packet in H.264 codec. // Demux the video packet in H.264 codec.
// The packet is muxed in FLV format, defined in flv specification. // The packet is muxed in FLV format, defined in flv specification.
// Demux the sps/pps from sequence header. // Demux the sps/pps from sequence header.
// Demux the samples from NALUs. // Demux the samples from NALUs.
virtual srs_error_t video_avc_demux(SrsBuffer *stream, int64_t timestamp); virtual srs_error_t video_avc_demux(SrsBuffer *stream, int64_t timestamp);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t hevc_demux_hvcc(SrsBuffer *stream); virtual srs_error_t hevc_demux_hvcc(SrsBuffer *stream);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t hevc_demux_vps_sps_pps(SrsHevcHvccNalu *nal); virtual srs_error_t hevc_demux_vps_sps_pps(SrsHevcHvccNalu *nal);
virtual srs_error_t hevc_demux_vps_rbsp(char *rbsp, int nb_rbsp); virtual srs_error_t hevc_demux_vps_rbsp(char *rbsp, int nb_rbsp);
virtual srs_error_t hevc_demux_sps_rbsp(char *rbsp, int nb_rbsp); virtual srs_error_t hevc_demux_sps_rbsp(char *rbsp, int nb_rbsp);
@ -274,13 +274,13 @@ public:
virtual srs_error_t hevc_demux_sps(SrsBuffer *stream); virtual srs_error_t hevc_demux_sps(SrsBuffer *stream);
virtual srs_error_t hevc_demux_pps(SrsBuffer *stream); virtual srs_error_t hevc_demux_pps(SrsBuffer *stream);
private: SRS_DECLARE_PRIVATE:
// Parse the H.264 SPS/PPS. // Parse the H.264 SPS/PPS.
virtual srs_error_t avc_demux_sps_pps(SrsBuffer *stream); virtual srs_error_t avc_demux_sps_pps(SrsBuffer *stream);
virtual srs_error_t avc_demux_sps(); virtual srs_error_t avc_demux_sps();
virtual srs_error_t avc_demux_sps_rbsp(char *rbsp, int nb_rbsp); virtual srs_error_t avc_demux_sps_rbsp(char *rbsp, int nb_rbsp);
private: SRS_DECLARE_PRIVATE:
// Parse the H.264 or H.265 NALUs. // Parse the H.264 or H.265 NALUs.
virtual srs_error_t video_nalu_demux(SrsBuffer *stream); virtual srs_error_t video_nalu_demux(SrsBuffer *stream);
// Demux the avc NALU in "AnnexB" from ISO_IEC_14496-10-AVC-2003.pdf, page 211. // Demux the avc NALU in "AnnexB" from ISO_IEC_14496-10-AVC-2003.pdf, page 211.
@ -290,7 +290,7 @@ private:
virtual srs_error_t avc_demux_ibmf_format(SrsBuffer *stream); virtual srs_error_t avc_demux_ibmf_format(SrsBuffer *stream);
virtual srs_error_t do_avc_demux_ibmf_format(SrsBuffer *stream); virtual srs_error_t do_avc_demux_ibmf_format(SrsBuffer *stream);
private: SRS_DECLARE_PRIVATE:
// Demux the audio packet in AAC codec. // Demux the audio packet in AAC codec.
// Demux the asc from sequence header. // Demux the asc from sequence header.
// Demux the sampels from RAW data. // Demux the sampels from RAW data.

View File

@ -43,7 +43,7 @@ public:
// Of course, we can add the multiple user support, which is SrsPithyPrint. // Of course, we can add the multiple user support, which is SrsPithyPrint.
class SrsStageManager class SrsStageManager
{ {
private: SRS_DECLARE_PRIVATE:
std::map<int, SrsStageInfo *> stages_; std::map<int, SrsStageInfo *> stages_;
public: public:
@ -63,7 +63,7 @@ public:
// The number of call of can_print(). // The number of call of can_print().
uint32_t nn_count_; uint32_t nn_count_;
private: SRS_DECLARE_PRIVATE:
double ratio_; double ratio_;
SrsStageManager stages_; SrsStageManager stages_;
std::map<int, srs_utime_t> ticks_; std::map<int, srs_utime_t> ticks_;
@ -82,7 +82,7 @@ public:
// An standalone pithy print, without shared stages. // An standalone pithy print, without shared stages.
class SrsAlonePithyPrint class SrsAlonePithyPrint
{ {
private: SRS_DECLARE_PRIVATE:
SrsStageInfo info_; SrsStageInfo info_;
srs_utime_t previous_tick_; srs_utime_t previous_tick_;
@ -127,14 +127,14 @@ public:
// } // }
class SrsPithyPrint : public ISrsPithyPrint class SrsPithyPrint : public ISrsPithyPrint
{ {
private: SRS_DECLARE_PRIVATE:
int client_id_; int client_id_;
SrsStageInfo *cache_; SrsStageInfo *cache_;
int stage_id_; int stage_id_;
srs_utime_t age_; srs_utime_t age_;
srs_utime_t previous_tick_; srs_utime_t previous_tick_;
private: SRS_DECLARE_PRIVATE:
SrsPithyPrint(int _stage_id); SrsPithyPrint(int _stage_id);
public: public:
@ -157,7 +157,7 @@ public:
static SrsPithyPrint *create_srt_publish(); static SrsPithyPrint *create_srt_publish();
virtual ~SrsPithyPrint(); virtual ~SrsPithyPrint();
private: SRS_DECLARE_PRIVATE:
// Enter the specified stage, return the client id. // Enter the specified stage, return the client id.
virtual int enter_stage(); virtual int enter_stage();
// Leave the specified stage, release the client id. // Leave the specified stage, release the client id.

View File

@ -78,7 +78,7 @@ class SrsPsContext : public ISrsPsContext
public: public:
SrsPsDecodeHelper helper_; SrsPsDecodeHelper helper_;
private: SRS_DECLARE_PRIVATE:
// The last decoding PS(TS) message. // The last decoding PS(TS) message.
SrsTsMessage *last_; SrsTsMessage *last_;
// The current parsing PS packet context. // The current parsing PS packet context.
@ -112,7 +112,7 @@ public:
// @remark We will consume all bytes in stream. // @remark We will consume all bytes in stream.
virtual srs_error_t decode(SrsBuffer *stream, ISrsPsMessageHandler *handler); virtual srs_error_t decode(SrsBuffer *stream, ISrsPsMessageHandler *handler);
private: SRS_DECLARE_PRIVATE:
srs_error_t do_decode(SrsBuffer *stream, ISrsPsMessageHandler *handler); srs_error_t do_decode(SrsBuffer *stream, ISrsPsMessageHandler *handler);
}; };
@ -274,7 +274,7 @@ public:
public: public:
virtual srs_error_t decode(SrsBuffer *stream); virtual srs_error_t decode(SrsBuffer *stream);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t decode_pack(SrsBuffer *stream); virtual srs_error_t decode_pack(SrsBuffer *stream);
virtual srs_error_t decode_system(SrsBuffer *stream); virtual srs_error_t decode_system(SrsBuffer *stream);
}; };

View File

@ -123,12 +123,12 @@ public:
// The resource manager remove resource and delete it asynchronously. // The resource manager remove resource and delete it asynchronously.
class SrsResourceManager : public ISrsCoroutineHandler, public ISrsResourceManager class SrsResourceManager : public ISrsCoroutineHandler, public ISrsResourceManager
{ {
private: SRS_DECLARE_PRIVATE:
std::string label_; std::string label_;
SrsContextId cid_; SrsContextId cid_;
bool verbose_; bool verbose_;
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
ISrsCond *cond_; ISrsCond *cond_;
// Callback handlers. // Callback handlers.
@ -141,7 +141,7 @@ private:
std::vector<ISrsResource *> zombies_; std::vector<ISrsResource *> zombies_;
std::vector<ISrsResource *> *p_disposing_; std::vector<ISrsResource *> *p_disposing_;
private: SRS_DECLARE_PRIVATE:
// The connections without any id. // The connections without any id.
std::vector<ISrsResource *> conns_; std::vector<ISrsResource *> conns_;
// The connections with resource id. // The connections with resource id.
@ -183,7 +183,7 @@ public:
public: public:
virtual void remove(ISrsResource *c); virtual void remove(ISrsResource *c);
private: SRS_DECLARE_PRIVATE:
void do_remove(ISrsResource *c); void do_remove(ISrsResource *c);
void check_remove(ISrsResource *c, bool &in_zombie, bool &in_disposing); void check_remove(ISrsResource *c, bool &in_zombie, bool &in_disposing);
void clear(); void clear();
@ -210,7 +210,7 @@ private:
template <typename T> template <typename T>
class SrsSharedResource : public ISrsResource class SrsSharedResource : public ISrsResource
{ {
private: SRS_DECLARE_PRIVATE:
SrsSharedPtr<T> ptr_; SrsSharedPtr<T> ptr_;
public: public:
@ -244,7 +244,7 @@ public:
return *this; return *this;
} }
private: SRS_DECLARE_PRIVATE:
// Overload the * operator. // Overload the * operator.
T &operator*() T &operator*()
{ {

View File

@ -30,7 +30,7 @@ class SrsRtpRingBuffer;
// We store the received packets in ring buffer. // We store the received packets in ring buffer.
class SrsRtpRingBuffer class SrsRtpRingBuffer
{ {
private: SRS_DECLARE_PRIVATE:
// Capacity of the ring-buffer. // Capacity of the ring-buffer.
uint16_t capacity_; uint16_t capacity_;
// Ring bufer. // Ring bufer.
@ -106,7 +106,7 @@ struct SrsRtpNackInfo {
class SrsRtpNackForReceiver class SrsRtpNackForReceiver
{ {
private: SRS_DECLARE_PRIVATE:
// Nack queue, seq order, oldest to newest. // Nack queue, seq order, oldest to newest.
std::map<uint16_t, SrsRtpNackInfo, SrsSeqCompareLess> queue_; std::map<uint16_t, SrsRtpNackInfo, SrsSeqCompareLess> queue_;
// Max nack count. // Max nack count.
@ -114,10 +114,10 @@ private:
SrsRtpRingBuffer *rtp_; SrsRtpRingBuffer *rtp_;
SrsNackOption opts_; SrsNackOption opts_;
private: SRS_DECLARE_PRIVATE:
srs_utime_t pre_check_time_; srs_utime_t pre_check_time_;
private: SRS_DECLARE_PRIVATE:
int rtt_; int rtt_;
public: public:

View File

@ -63,7 +63,7 @@ struct SrsRtcpHeader {
class SrsRtcpCommon : public ISrsCodec class SrsRtcpCommon : public ISrsCodec
{ {
protected: SRS_DECLARE_PROTECTED:
SrsRtcpHeader header_; SrsRtcpHeader header_;
uint32_t ssrc_; uint32_t ssrc_;
uint8_t payload_[kRtcpPacketSize]; uint8_t payload_[kRtcpPacketSize];
@ -72,7 +72,7 @@ protected:
char *data_; char *data_;
int nb_data_; int nb_data_;
protected: SRS_DECLARE_PROTECTED:
srs_error_t decode_header(SrsBuffer *buffer); srs_error_t decode_header(SrsBuffer *buffer);
srs_error_t encode_header(SrsBuffer *buffer); srs_error_t encode_header(SrsBuffer *buffer);
@ -96,7 +96,7 @@ public:
class SrsRtcpApp : public SrsRtcpCommon class SrsRtcpApp : public SrsRtcpCommon
{ {
private: SRS_DECLARE_PRIVATE:
uint8_t name_[4]; uint8_t name_[4];
public: public:
@ -144,7 +144,7 @@ struct SrsRtcpRB {
class SrsRtcpSR : public SrsRtcpCommon class SrsRtcpSR : public SrsRtcpCommon
{ {
private: SRS_DECLARE_PRIVATE:
uint64_t ntp_; uint64_t ntp_;
uint32_t rtp_ts_; uint32_t rtp_ts_;
uint32_t send_rtp_packets_; uint32_t send_rtp_packets_;
@ -175,7 +175,7 @@ public:
class SrsRtcpRR : public SrsRtcpCommon class SrsRtcpRR : public SrsRtcpCommon
{ {
private: SRS_DECLARE_PRIVATE:
SrsRtcpRB rb_; SrsRtcpRB rb_;
public: public:
@ -213,7 +213,7 @@ public:
// inlucde Transport layer FB message and Payload-specific FB message. // inlucde Transport layer FB message and Payload-specific FB message.
class SrsRtcpFbCommon : public SrsRtcpCommon class SrsRtcpFbCommon : public SrsRtcpCommon
{ {
protected: SRS_DECLARE_PROTECTED:
uint32_t media_ssrc_; uint32_t media_ssrc_;
public: public:
@ -273,7 +273,7 @@ public:
class SrsRtcpTWCC : public SrsRtcpFbCommon class SrsRtcpTWCC : public SrsRtcpFbCommon
{ {
private: SRS_DECLARE_PRIVATE:
uint16_t base_sn_; uint16_t base_sn_;
int32_t reference_time_; int32_t reference_time_;
uint8_t fb_pkt_count_; uint8_t fb_pkt_count_;
@ -294,7 +294,7 @@ private:
int pkt_len_; int pkt_len_;
uint16_t next_base_sn_; uint16_t next_base_sn_;
private: SRS_DECLARE_PRIVATE:
void clear(); void clear();
srs_utime_t calculate_delta_us(srs_utime_t ts, srs_utime_t last); srs_utime_t calculate_delta_us(srs_utime_t ts, srs_utime_t last);
srs_error_t process_pkt_chunk(SrsRtcpTWCCChunk &chunk, int delta_size); srs_error_t process_pkt_chunk(SrsRtcpTWCCChunk &chunk, int delta_size);
@ -332,13 +332,13 @@ public:
virtual uint64_t nb_bytes(); virtual uint64_t nb_bytes();
virtual srs_error_t encode(SrsBuffer *buffer); virtual srs_error_t encode(SrsBuffer *buffer);
private: SRS_DECLARE_PRIVATE:
srs_error_t do_encode(SrsBuffer *buffer); srs_error_t do_encode(SrsBuffer *buffer);
}; };
class SrsRtcpNack : public SrsRtcpFbCommon class SrsRtcpNack : public SrsRtcpFbCommon
{ {
private: SRS_DECLARE_PRIVATE:
struct SrsPidBlp { struct SrsPidBlp {
uint16_t pid_; uint16_t pid_;
uint16_t blp_; uint16_t blp_;
@ -377,7 +377,7 @@ public:
class SrsRtcpSli : public SrsRtcpFbCommon class SrsRtcpSli : public SrsRtcpFbCommon
{ {
private: SRS_DECLARE_PRIVATE:
uint16_t first_; uint16_t first_;
uint16_t number_; uint16_t number_;
uint8_t picture_; uint8_t picture_;
@ -395,7 +395,7 @@ public:
class SrsRtcpRpsi : public SrsRtcpFbCommon class SrsRtcpRpsi : public SrsRtcpFbCommon
{ {
private: SRS_DECLARE_PRIVATE:
uint8_t pb_; uint8_t pb_;
uint8_t payload_type_; uint8_t payload_type_;
char *native_rpsi_; char *native_rpsi_;
@ -427,7 +427,7 @@ public:
class SrsRtcpCompound : public ISrsCodec class SrsRtcpCompound : public ISrsCodec
{ {
private: SRS_DECLARE_PRIVATE:
std::vector<SrsRtcpCommon *> rtcps_; std::vector<SrsRtcpCommon *> rtcps_;
int nb_bytes_; int nb_bytes_;
char *data_; char *data_;

View File

@ -137,10 +137,10 @@ public:
SrsRtpExtensionTypes(); SrsRtpExtensionTypes();
virtual ~SrsRtpExtensionTypes(); virtual ~SrsRtpExtensionTypes();
private: SRS_DECLARE_PRIVATE:
bool register_id(int id, SrsRtpExtensionType type, std::string uri); bool register_id(int id, SrsRtpExtensionType type, std::string uri);
private: SRS_DECLARE_PRIVATE:
uint8_t ids_[kRtpExtensionNumberOfExtensions]; uint8_t ids_[kRtpExtensionNumberOfExtensions];
}; };
@ -197,17 +197,17 @@ public:
// Note that the extensions should never extends from any class, for performance. // Note that the extensions should never extends from any class, for performance.
class SrsRtpExtensions // : public ISrsCodec class SrsRtpExtensions // : public ISrsCodec
{ {
private: SRS_DECLARE_PRIVATE:
bool has_ext_; bool has_ext_;
// by default, twcc isnot decoded. Because it is decoded by fast function(srs_rtp_fast_parse_twcc) // by default, twcc isnot decoded. Because it is decoded by fast function(srs_rtp_fast_parse_twcc)
bool decode_twcc_extension_; bool decode_twcc_extension_;
private: SRS_DECLARE_PRIVATE:
// The extension types is used to decode the packet, which is reference to // The extension types is used to decode the packet, which is reference to
// the types in publish stream. // the types in publish stream.
SrsRtpExtensionTypes *types_; SrsRtpExtensionTypes *types_;
private: SRS_DECLARE_PRIVATE:
SrsRtpExtensionTwcc twcc_; SrsRtpExtensionTwcc twcc_;
SrsRtpExtensionOneByte audio_level_; SrsRtpExtensionOneByte audio_level_;
@ -227,7 +227,7 @@ public:
public: public:
virtual srs_error_t decode(SrsBuffer *buf); virtual srs_error_t decode(SrsBuffer *buf);
private: SRS_DECLARE_PRIVATE:
srs_error_t decode_0xbede(SrsBuffer *buf); srs_error_t decode_0xbede(SrsBuffer *buf);
public: public:
@ -238,7 +238,7 @@ public:
// Note that the header should never extends from any class, for performance. // Note that the header should never extends from any class, for performance.
class SrsRtpHeader // : public ISrsCodec class SrsRtpHeader // : public ISrsCodec
{ {
private: SRS_DECLARE_PRIVATE:
uint8_t padding_length_; uint8_t padding_length_;
uint8_t cc_; uint8_t cc_;
bool marker_; bool marker_;
@ -257,7 +257,7 @@ public:
public: public:
virtual srs_error_t decode(SrsBuffer *buf); virtual srs_error_t decode(SrsBuffer *buf);
private: SRS_DECLARE_PRIVATE:
srs_error_t parse_extensions(SrsBuffer *buf); srs_error_t parse_extensions(SrsBuffer *buf);
public: public:
@ -326,11 +326,11 @@ class SrsRtpPacket
public: public:
SrsRtpHeader header_; SrsRtpHeader header_;
private: SRS_DECLARE_PRIVATE:
ISrsRtpPayloader *payload_; ISrsRtpPayloader *payload_;
SrsRtpPacketPayloadType payload_type_; SrsRtpPacketPayloadType payload_type_;
private: SRS_DECLARE_PRIVATE:
// The original shared memory block, all RTP packets can refer to its data. // The original shared memory block, all RTP packets can refer to its data.
// Note that the size of shared memory block, is not the packet size, it's a larger aligned buffer. // Note that the size of shared memory block, is not the packet size, it's a larger aligned buffer.
// @remark Note that it may point to the whole RTP packet(for RTP parser, which decode RTP packet from buffer), // @remark Note that it may point to the whole RTP packet(for RTP parser, which decode RTP packet from buffer),
@ -345,13 +345,13 @@ public:
// The frame type, for RTMP bridge or SFU source. // The frame type, for RTMP bridge or SFU source.
SrsFrameType frame_type_; SrsFrameType frame_type_;
// Fast cache for performance. // Fast cache for performance.
private: SRS_DECLARE_PRIVATE:
// The cached payload size for packet. // The cached payload size for packet.
int cached_payload_size_; int cached_payload_size_;
// The helper handler for decoder, use RAW payload if NULL. // The helper handler for decoder, use RAW payload if NULL.
ISrsRtpPacketDecodeHandler *decode_handler_; ISrsRtpPacketDecodeHandler *decode_handler_;
private: SRS_DECLARE_PRIVATE:
int64_t avsync_time_; int64_t avsync_time_;
public: public:
@ -428,7 +428,7 @@ public:
// Multiple NALUs, automatically insert 001 between NALUs. // Multiple NALUs, automatically insert 001 between NALUs.
class SrsRtpRawNALUs : public ISrsRtpPayloader class SrsRtpRawNALUs : public ISrsRtpPayloader
{ {
private: SRS_DECLARE_PRIVATE:
// We will manage the samples, but the sample itself point to the shared memory. // We will manage the samples, but the sample itself point to the shared memory.
std::vector<SrsNaluSample *> nalus_; std::vector<SrsNaluSample *> nalus_;
int nn_bytes_; int nn_bytes_;

View File

@ -17,7 +17,7 @@
*/ */
class SrsSimpleStream class SrsSimpleStream
{ {
private: SRS_DECLARE_PRIVATE:
std::vector<char> data_; std::vector<char> data_;
public: public:

View File

@ -338,18 +338,18 @@ public:
// The context of ts, to decode the ts stream. // The context of ts, to decode the ts stream.
class SrsTsContext : public ISrsTsContext class SrsTsContext : public ISrsTsContext
{ {
private: SRS_DECLARE_PRIVATE:
// Whether context is ready, failed if try to write data when not ready. // Whether context is ready, failed if try to write data when not ready.
// When PAT and PMT writen, the context is ready. // When PAT and PMT writen, the context is ready.
// @see https://github.com/ossrs/srs/issues/834 // @see https://github.com/ossrs/srs/issues/834
bool ready_; bool ready_;
private: SRS_DECLARE_PRIVATE:
std::map<int, SrsTsChannel *> pids_; std::map<int, SrsTsChannel *> pids_;
bool pure_audio_; bool pure_audio_;
int8_t sync_byte_; int8_t sync_byte_;
private: SRS_DECLARE_PRIVATE:
// when any codec changed, write the PAT/PMT. // when any codec changed, write the PAT/PMT.
SrsVideoCodecId vcodec_; SrsVideoCodecId vcodec_;
SrsAudioCodecId acodec_; SrsAudioCodecId acodec_;
@ -391,7 +391,7 @@ public:
// @param ac The audio codec, write the PAT/PMT table when changed. // @param ac The audio codec, write the PAT/PMT table when changed.
virtual srs_error_t encode(ISrsStreamWriter *writer, SrsTsMessage *msg, SrsVideoCodecId vc, SrsAudioCodecId ac); virtual srs_error_t encode(ISrsStreamWriter *writer, SrsTsMessage *msg, SrsVideoCodecId vc, SrsAudioCodecId ac);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t encode_pat_pmt(ISrsStreamWriter *writer, int16_t vpid, SrsTsStream vs, int16_t apid, SrsTsStream as); virtual srs_error_t encode_pat_pmt(ISrsStreamWriter *writer, int16_t vpid, SrsTsStream vs, int16_t apid, SrsTsStream as);
virtual srs_error_t encode_pes(ISrsStreamWriter *writer, SrsTsMessage *msg, int16_t pid, SrsTsStream sid, bool pure_audio); virtual srs_error_t encode_pes(ISrsStreamWriter *writer, SrsTsMessage *msg, int16_t pid, SrsTsStream sid, bool pure_audio);
}; };
@ -471,7 +471,7 @@ public:
// The continuity counter may be discontinuous when the discontinuity_indicator is set to '1' (refer to 2.4.3.4). In the case of // The continuity counter may be discontinuous when the discontinuity_indicator is set to '1' (refer to 2.4.3.4). In the case of
// a null packet the value of the continuity_counter is undefined. // a null packet the value of the continuity_counter is undefined.
uint8_t continuity_counter_; // 4bits uint8_t continuity_counter_; // 4bits
private: SRS_DECLARE_PRIVATE:
SrsTsAdaptationField *adaptation_field_; SrsTsAdaptationField *adaptation_field_;
SrsTsPayload *payload_; SrsTsPayload *payload_;
@ -742,7 +742,7 @@ public:
// decoder. // decoder.
int nb_af_reserved_; int nb_af_reserved_;
private: SRS_DECLARE_PRIVATE:
SrsTsPacket *packet_; SrsTsPacket *packet_;
public: public:
@ -788,7 +788,7 @@ enum SrsTsPsiId {
// The payload of ts packet, can be PES or PSI payload. // The payload of ts packet, can be PES or PSI payload.
class SrsTsPayload class SrsTsPayload
{ {
protected: SRS_DECLARE_PROTECTED:
SrsTsPacket *packet_; SrsTsPacket *packet_;
public: public:
@ -1071,7 +1071,7 @@ public:
virtual int size(); virtual int size();
virtual srs_error_t encode(SrsBuffer *stream); virtual srs_error_t encode(SrsBuffer *stream);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t decode_33bits_dts_pts(SrsBuffer *stream, int64_t *pv); virtual srs_error_t decode_33bits_dts_pts(SrsBuffer *stream, int64_t *pv);
virtual srs_error_t encode_33bits_dts_pts(SrsBuffer *stream, uint8_t fb, int64_t v); virtual srs_error_t encode_33bits_dts_pts(SrsBuffer *stream, uint8_t fb, int64_t v);
}; };
@ -1145,7 +1145,7 @@ public:
virtual int size(); virtual int size();
virtual srs_error_t encode(SrsBuffer *stream); virtual srs_error_t encode(SrsBuffer *stream);
protected: SRS_DECLARE_PROTECTED:
virtual int psi_size() = 0; virtual int psi_size() = 0;
virtual srs_error_t psi_encode(SrsBuffer *stream) = 0; virtual srs_error_t psi_encode(SrsBuffer *stream) = 0;
virtual srs_error_t psi_decode(SrsBuffer *stream) = 0; virtual srs_error_t psi_decode(SrsBuffer *stream) = 0;
@ -1226,10 +1226,10 @@ public:
SrsTsPayloadPAT(SrsTsPacket *p); SrsTsPayloadPAT(SrsTsPacket *p);
virtual ~SrsTsPayloadPAT(); virtual ~SrsTsPayloadPAT();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t psi_decode(SrsBuffer *stream); virtual srs_error_t psi_decode(SrsBuffer *stream);
protected: SRS_DECLARE_PROTECTED:
virtual int psi_size(); virtual int psi_size();
virtual srs_error_t psi_encode(SrsBuffer *stream); virtual srs_error_t psi_encode(SrsBuffer *stream);
}; };
@ -1331,10 +1331,10 @@ public:
SrsTsPayloadPMT(SrsTsPacket *p); SrsTsPayloadPMT(SrsTsPacket *p);
virtual ~SrsTsPayloadPMT(); virtual ~SrsTsPayloadPMT();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t psi_decode(SrsBuffer *stream); virtual srs_error_t psi_decode(SrsBuffer *stream);
protected: SRS_DECLARE_PROTECTED:
virtual int psi_size(); virtual int psi_size();
virtual srs_error_t psi_encode(SrsBuffer *stream); virtual srs_error_t psi_encode(SrsBuffer *stream);
}; };
@ -1366,12 +1366,12 @@ public:
// Write the TS message to TS context. // Write the TS message to TS context.
class SrsTsContextWriter : public ISrsTsContextWriter class SrsTsContextWriter : public ISrsTsContextWriter
{ {
private: SRS_DECLARE_PRIVATE:
// User must config the codec in right way. // User must config the codec in right way.
SrsVideoCodecId vcodec_; SrsVideoCodecId vcodec_;
SrsAudioCodecId acodec_; SrsAudioCodecId acodec_;
private: SRS_DECLARE_PRIVATE:
ISrsTsContext *context_; ISrsTsContext *context_;
ISrsStreamWriter *writer_; ISrsStreamWriter *writer_;
std::string path_; std::string path_;
@ -1411,11 +1411,11 @@ public:
public: public:
srs_error_t config_cipher(unsigned char *key, unsigned char *iv); srs_error_t config_cipher(unsigned char *key, unsigned char *iv);
private: SRS_DECLARE_PRIVATE:
unsigned char *key; unsigned char *key;
unsigned char iv[16]; unsigned char iv[16];
private: SRS_DECLARE_PRIVATE:
char *buf; char *buf;
int nb_buf; int nb_buf;
}; };
@ -1469,7 +1469,7 @@ public:
virtual SrsTsMessage *video(); virtual SrsTsMessage *video();
virtual void set_video(SrsTsMessage *msg); virtual void set_video(SrsTsMessage *msg);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cache_mp3(SrsParsedAudioPacket *frame); virtual srs_error_t do_cache_mp3(SrsParsedAudioPacket *frame);
virtual srs_error_t do_cache_aac(SrsParsedAudioPacket *frame); virtual srs_error_t do_cache_aac(SrsParsedAudioPacket *frame);
virtual srs_error_t do_cache_avc(SrsParsedVideoPacket *frame); virtual srs_error_t do_cache_avc(SrsParsedVideoPacket *frame);
@ -1497,13 +1497,13 @@ public:
// Transmux the RTMP stream to HTTP-TS stream. // Transmux the RTMP stream to HTTP-TS stream.
class SrsTsTransmuxer : public ISrsTsTransmuxer class SrsTsTransmuxer : public ISrsTsTransmuxer
{ {
private: SRS_DECLARE_PRIVATE:
ISrsStreamWriter *writer_; ISrsStreamWriter *writer_;
bool has_audio_; bool has_audio_;
bool has_video_; bool has_video_;
bool guess_has_av_; bool guess_has_av_;
private: SRS_DECLARE_PRIVATE:
ISrsFormat *format_; ISrsFormat *format_;
ISrsTsMessageCache *tsmc_; ISrsTsMessageCache *tsmc_;
ISrsTsContextWriter *tscw_; ISrsTsContextWriter *tscw_;
@ -1529,7 +1529,7 @@ public:
virtual srs_error_t write_audio(int64_t timestamp, char *data, int size); virtual srs_error_t write_audio(int64_t timestamp, char *data, int size);
virtual srs_error_t write_video(int64_t timestamp, char *data, int size); virtual srs_error_t write_video(int64_t timestamp, char *data, int size);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t flush_audio(); virtual srs_error_t flush_audio();
virtual srs_error_t flush_video(); virtual srs_error_t flush_video();
}; };

View File

@ -318,11 +318,11 @@ public:
*/ */
class SrsAmf0Object : public SrsAmf0Any class SrsAmf0Object : public SrsAmf0Any
{ {
private: SRS_DECLARE_PRIVATE:
srs_internal::SrsUnSortedHashtable *properties_; srs_internal::SrsUnSortedHashtable *properties_;
srs_internal::SrsAmf0ObjectEOF *eof_; srs_internal::SrsAmf0ObjectEOF *eof_;
private: SRS_DECLARE_PRIVATE:
friend class SrsAmf0Any; friend class SrsAmf0Any;
/** /**
* make amf0 object to private, * make amf0 object to private,
@ -410,12 +410,12 @@ public:
*/ */
class SrsAmf0EcmaArray : public SrsAmf0Any class SrsAmf0EcmaArray : public SrsAmf0Any
{ {
private: SRS_DECLARE_PRIVATE:
srs_internal::SrsUnSortedHashtable *properties_; srs_internal::SrsUnSortedHashtable *properties_;
srs_internal::SrsAmf0ObjectEOF *eof_; srs_internal::SrsAmf0ObjectEOF *eof_;
int32_t count_; int32_t count_;
private: SRS_DECLARE_PRIVATE:
friend class SrsAmf0Any; friend class SrsAmf0Any;
/** /**
* make amf0 object to private, * make amf0 object to private,
@ -498,11 +498,11 @@ public:
*/ */
class SrsAmf0StrictArray : public SrsAmf0Any class SrsAmf0StrictArray : public SrsAmf0Any
{ {
private: SRS_DECLARE_PRIVATE:
std::vector<SrsAmf0Any *> properties_; std::vector<SrsAmf0Any *> properties_;
int32_t count_; int32_t count_;
private: SRS_DECLARE_PRIVATE:
friend class SrsAmf0Any; friend class SrsAmf0Any;
/** /**
* make amf0 object to private, * make amf0 object to private,
@ -630,7 +630,7 @@ class SrsAmf0String : public SrsAmf0Any
public: public:
std::string value_; std::string value_;
private: SRS_DECLARE_PRIVATE:
friend class SrsAmf0Any; friend class SrsAmf0Any;
/** /**
* make amf0 string to private, * make amf0 string to private,
@ -660,7 +660,7 @@ class SrsAmf0Boolean : public SrsAmf0Any
public: public:
bool value_; bool value_;
private: SRS_DECLARE_PRIVATE:
friend class SrsAmf0Any; friend class SrsAmf0Any;
/** /**
* make amf0 boolean to private, * make amf0 boolean to private,
@ -689,7 +689,7 @@ class SrsAmf0Number : public SrsAmf0Any
public: public:
double value_; double value_;
private: SRS_DECLARE_PRIVATE:
friend class SrsAmf0Any; friend class SrsAmf0Any;
/** /**
* make amf0 number to private, * make amf0 number to private,
@ -715,11 +715,11 @@ public:
*/ */
class SrsAmf0Date : public SrsAmf0Any class SrsAmf0Date : public SrsAmf0Any
{ {
private: SRS_DECLARE_PRIVATE:
int64_t date_value_; int64_t date_value_;
int16_t time_zone_; int16_t time_zone_;
private: SRS_DECLARE_PRIVATE:
friend class SrsAmf0Any; friend class SrsAmf0Any;
/** /**
* make amf0 date to private, * make amf0 date to private,
@ -754,7 +754,7 @@ public:
*/ */
class SrsAmf0Null : public SrsAmf0Any class SrsAmf0Null : public SrsAmf0Any
{ {
private: SRS_DECLARE_PRIVATE:
friend class SrsAmf0Any; friend class SrsAmf0Any;
/** /**
* make amf0 null to private, * make amf0 null to private,
@ -779,7 +779,7 @@ public:
*/ */
class SrsAmf0Undefined : public SrsAmf0Any class SrsAmf0Undefined : public SrsAmf0Any
{ {
private: SRS_DECLARE_PRIVATE:
friend class SrsAmf0Any; friend class SrsAmf0Any;
/** /**
* make amf0 undefined to private, * make amf0 undefined to private,
@ -805,7 +805,7 @@ public:
*/ */
class SrsUnSortedHashtable class SrsUnSortedHashtable
{ {
private: SRS_DECLARE_PRIVATE:
typedef std::pair<std::string, SrsAmf0Any *> SrsAmf0ObjectPropertyType; typedef std::pair<std::string, SrsAmf0Any *> SrsAmf0ObjectPropertyType;
std::vector<SrsAmf0ObjectPropertyType> properties_; std::vector<SrsAmf0ObjectPropertyType> properties_;

View File

@ -51,7 +51,7 @@ public:
// server will add the connection to manager, and delete it when remove. // server will add the connection to manager, and delete it when remove.
class SrsTcpConnection : public ISrsProtocolReadWriter class SrsTcpConnection : public ISrsProtocolReadWriter
{ {
private: SRS_DECLARE_PRIVATE:
// The underlayer st fd handler. // The underlayer st fd handler.
srs_netfd_t stfd_; srs_netfd_t stfd_;
// The underlayer socket. // The underlayer socket.
@ -84,7 +84,7 @@ public:
// cache or buffer. // cache or buffer.
class SrsBufferedReadWriter : public ISrsProtocolReadWriter class SrsBufferedReadWriter : public ISrsProtocolReadWriter
{ {
private: SRS_DECLARE_PRIVATE:
// The under-layer transport. // The under-layer transport.
ISrsProtocolReadWriter *io_; ISrsProtocolReadWriter *io_;
// Fixed, small and fast buffer. Note that it must be very small piece of cache, make sure matches all protocols, // Fixed, small and fast buffer. Note that it must be very small piece of cache, make sure matches all protocols,
@ -101,7 +101,7 @@ public:
// Peek the head of cache to buf in size of bytes. // Peek the head of cache to buf in size of bytes.
srs_error_t peek(char *buf, int *size); srs_error_t peek(char *buf, int *size);
private: SRS_DECLARE_PRIVATE:
srs_error_t reload_buffer(); srs_error_t reload_buffer();
// Interface ISrsProtocolReadWriter // Interface ISrsProtocolReadWriter
public: public:
@ -131,11 +131,11 @@ public:
// The SSL connection over TCP transport, in server mode. // The SSL connection over TCP transport, in server mode.
class SrsSslConnection : public ISrsSslConnection class SrsSslConnection : public ISrsSslConnection
{ {
private: SRS_DECLARE_PRIVATE:
// The under-layer plaintext transport. // The under-layer plaintext transport.
ISrsProtocolReadWriter *transport_; ISrsProtocolReadWriter *transport_;
private: SRS_DECLARE_PRIVATE:
SSL_CTX *ssl_ctx_; SSL_CTX *ssl_ctx_;
SSL *ssl_; SSL *ssl_;
BIO *bio_in_; BIO *bio_in_;

View File

@ -32,10 +32,10 @@ class SrsTcpClient;
// The SSL client over TCP transport. // The SSL client over TCP transport.
class SrsSslClient : public ISrsReader, public ISrsStreamWriter class SrsSslClient : public ISrsReader, public ISrsStreamWriter
{ {
private: SRS_DECLARE_PRIVATE:
ISrsProtocolReadWriter *transport_; ISrsProtocolReadWriter *transport_;
private: SRS_DECLARE_PRIVATE:
SSL_CTX *ssl_ctx_; SSL_CTX *ssl_ctx_;
SSL *ssl_; SSL *ssl_;
BIO *bio_in_; BIO *bio_in_;
@ -82,7 +82,7 @@ public:
// hc.post("/api/v1/version", "Hello world!", NULL); // hc.post("/api/v1/version", "Hello world!", NULL);
class SrsHttpClient : public ISrsHttpClient class SrsHttpClient : public ISrsHttpClient
{ {
private: SRS_DECLARE_PRIVATE:
// The underlayer TCP transport, set to NULL when disconnect, or never not NULL when connected. // The underlayer TCP transport, set to NULL when disconnect, or never not NULL when connected.
// We will disconnect transport when initialize or channel error, such as send/recv error. // We will disconnect transport when initialize or channel error, such as send/recv error.
SrsTcpClient *transport_; SrsTcpClient *transport_;
@ -90,7 +90,7 @@ private:
std::map<std::string, std::string> headers_; std::map<std::string, std::string> headers_;
SrsNetworkKbps *kbps_; SrsNetworkKbps *kbps_;
private: SRS_DECLARE_PRIVATE:
// The timeout in srs_utime_t. // The timeout in srs_utime_t.
srs_utime_t timeout_; srs_utime_t timeout_;
srs_utime_t recv_timeout_; srs_utime_t recv_timeout_;
@ -99,7 +99,7 @@ private:
std::string host_; std::string host_;
int port_; int port_;
private: SRS_DECLARE_PRIVATE:
SrsSslClient *ssl_transport_; SrsSslClient *ssl_transport_;
public: public:
@ -136,7 +136,7 @@ public:
public: public:
virtual void kbps_sample(const char *label, srs_utime_t age); virtual void kbps_sample(const char *label, srs_utime_t age);
private: SRS_DECLARE_PRIVATE:
virtual void disconnect(); virtual void disconnect();
virtual srs_error_t connect(); virtual srs_error_t connect();
ISrsStreamWriter *writer(); ISrsStreamWriter *writer();

View File

@ -47,7 +47,7 @@ public:
// provides HTTP message originted service. // provides HTTP message originted service.
class SrsHttpParser : public ISrsHttpParser class SrsHttpParser : public ISrsHttpParser
{ {
private: SRS_DECLARE_PRIVATE:
llhttp_settings_t settings_; llhttp_settings_t settings_;
llhttp_t parser_; llhttp_t parser_;
// The global parse buffer. // The global parse buffer.
@ -55,7 +55,7 @@ private:
// Whether allow jsonp parse. // Whether allow jsonp parse.
bool jsonp_; bool jsonp_;
private: SRS_DECLARE_PRIVATE:
std::string field_name_; std::string field_name_;
std::string field_value_; std::string field_value_;
SrsHttpParseState state_; SrsHttpParseState state_;
@ -82,11 +82,11 @@ public:
// @remark user must free the ppmsg if not NULL. // @remark user must free the ppmsg if not NULL.
virtual srs_error_t parse_message(ISrsReader *reader, ISrsHttpMessage **ppmsg); virtual srs_error_t parse_message(ISrsReader *reader, ISrsHttpMessage **ppmsg);
private: SRS_DECLARE_PRIVATE:
// parse the HTTP message to member field: msg. // parse the HTTP message to member field: msg.
virtual srs_error_t parse_message_imp(ISrsReader *reader); virtual srs_error_t parse_message_imp(ISrsReader *reader);
private: SRS_DECLARE_PRIVATE:
static int on_message_begin(llhttp_t *parser); static int on_message_begin(llhttp_t *parser);
static int on_headers_complete(llhttp_t *parser); static int on_headers_complete(llhttp_t *parser);
static int on_message_complete(llhttp_t *parser); static int on_message_complete(llhttp_t *parser);
@ -104,7 +104,7 @@ private:
// documentation for Request.Write and RoundTripper. // documentation for Request.Write and RoundTripper.
class SrsHttpMessage : public ISrsHttpMessage class SrsHttpMessage : public ISrsHttpMessage
{ {
private: SRS_DECLARE_PRIVATE:
// The body object, reader object. // The body object, reader object.
// @remark, user can get body in string by get_body(). // @remark, user can get body in string by get_body().
SrsHttpResponseReader *_body; SrsHttpResponseReader *_body;
@ -112,7 +112,7 @@ private:
// The transport connection, can be NULL. // The transport connection, can be NULL.
ISrsConnection *owner_conn_; ISrsConnection *owner_conn_;
private: SRS_DECLARE_PRIVATE:
// The request type defined as // The request type defined as
// enum http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH }; // enum http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH };
uint8_t type_; uint8_t type_;
@ -121,7 +121,7 @@ private:
llhttp_status_t _status; llhttp_status_t _status;
int64_t _content_length; int64_t _content_length;
private: SRS_DECLARE_PRIVATE:
// The http headers // The http headers
SrsHttpHeader _header; SrsHttpHeader _header;
// Whether the request indicates should keep alive for the http connection. // Whether the request indicates should keep alive for the http connection.
@ -129,7 +129,7 @@ private:
// Whether the body is chunked. // Whether the body is chunked.
bool chunked_; bool chunked_;
private: SRS_DECLARE_PRIVATE:
std::string schema_; std::string schema_;
// The parsed url. // The parsed url.
std::string _url; std::string _url;
@ -140,7 +140,7 @@ private:
// The query map // The query map
std::map<std::string, std::string> _query; std::map<std::string, std::string> _query;
private: SRS_DECLARE_PRIVATE:
// Whether request is jsonp. // Whether request is jsonp.
bool jsonp_; bool jsonp_;
// The method in QueryString will override the HTTP method. // The method in QueryString will override the HTTP method.
@ -253,7 +253,7 @@ public:
// HTTP request, the first line is RequestLine. While for HTTP response, it's StatusLine. // HTTP request, the first line is RequestLine. While for HTTP response, it's StatusLine.
class SrsHttpMessageWriter class SrsHttpMessageWriter
{ {
private: SRS_DECLARE_PRIVATE:
ISrsProtocolReadWriter *skt_; ISrsProtocolReadWriter *skt_;
SrsHttpHeader *hdr_; SrsHttpHeader *hdr_;
// Before writing header, there is a chance to filter it, // Before writing header, there is a chance to filter it,
@ -262,22 +262,22 @@ private:
// The first line writer. // The first line writer.
ISrsHttpFirstLineWriter *flw_; ISrsHttpFirstLineWriter *flw_;
private: SRS_DECLARE_PRIVATE:
char header_cache_[SRS_HTTP_HEADER_CACHE_SIZE]; char header_cache_[SRS_HTTP_HEADER_CACHE_SIZE];
iovec *iovss_cache_; iovec *iovss_cache_;
int nb_iovss_cache_; int nb_iovss_cache_;
private: SRS_DECLARE_PRIVATE:
// Reply header has been (logically) written // Reply header has been (logically) written
bool header_wrote_; bool header_wrote_;
private: SRS_DECLARE_PRIVATE:
// The explicitly-declared Content-Length; or -1 // The explicitly-declared Content-Length; or -1
int64_t content_length_; int64_t content_length_;
// The number of bytes written in body // The number of bytes written in body
int64_t written_; int64_t written_;
private: SRS_DECLARE_PRIVATE:
// The wroteHeader tells whether the header's been written to "the // The wroteHeader tells whether the header's been written to "the
// wire" (or rather: w.conn.buf). this is unlike // wire" (or rather: w.conn.buf). this is unlike
// (*response).wroteHeader, which tells only whether it was // (*response).wroteHeader, which tells only whether it was
@ -306,7 +306,7 @@ public:
// Response writer use st socket // Response writer use st socket
class SrsHttpResponseWriter : public ISrsHttpResponseWriter, public ISrsHttpFirstLineWriter class SrsHttpResponseWriter : public ISrsHttpResponseWriter, public ISrsHttpFirstLineWriter
{ {
protected: SRS_DECLARE_PROTECTED:
SrsHttpMessageWriter *writer_; SrsHttpMessageWriter *writer_;
// The status code passed to WriteHeader, for response only. // The status code passed to WriteHeader, for response only.
int status_; int status_;
@ -333,7 +333,7 @@ public:
// Request writer use st socket // Request writer use st socket
class SrsHttpRequestWriter : public ISrsHttpRequestWriter, public ISrsHttpFirstLineWriter class SrsHttpRequestWriter : public ISrsHttpRequestWriter, public ISrsHttpFirstLineWriter
{ {
protected: SRS_DECLARE_PROTECTED:
SrsHttpMessageWriter *writer_; SrsHttpMessageWriter *writer_;
// The method and path passed to WriteHeader, for request only. // The method and path passed to WriteHeader, for request only.
std::string method_; std::string method_;
@ -358,7 +358,7 @@ public:
// Response reader use st socket. // Response reader use st socket.
class SrsHttpResponseReader : public ISrsHttpResponseReader class SrsHttpResponseReader : public ISrsHttpResponseReader
{ {
private: SRS_DECLARE_PRIVATE:
ISrsReader *skt_; ISrsReader *skt_;
SrsHttpMessage *owner_; SrsHttpMessage *owner_;
SrsFastStream *buffer_; SrsFastStream *buffer_;
@ -386,7 +386,7 @@ public:
virtual bool eof(); virtual bool eof();
virtual srs_error_t read(void *buf, size_t size, ssize_t *nread); virtual srs_error_t read(void *buf, size_t size, ssize_t *nread);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t read_chunked(void *buf, size_t size, ssize_t *nread); virtual srs_error_t read_chunked(void *buf, size_t size, ssize_t *nread);
virtual srs_error_t read_specified(void *buf, size_t size, ssize_t *nread); virtual srs_error_t read_specified(void *buf, size_t size, ssize_t *nread);
}; };

View File

@ -85,7 +85,7 @@ enum SrsHttpParseState {
// A Header represents the key-value pairs in an HTTP header. // A Header represents the key-value pairs in an HTTP header.
class SrsHttpHeader class SrsHttpHeader
{ {
private: SRS_DECLARE_PRIVATE:
// The order in which header fields with differing field names are // The order in which header fields with differing field names are
// received is not significant. However, it is "good practice" to send // received is not significant. However, it is "good practice" to send
// general-header fields first, followed by request-header or response- // general-header fields first, followed by request-header or response-
@ -304,7 +304,7 @@ public:
// Redirect to a fixed URL // Redirect to a fixed URL
class SrsHttpRedirectHandler : public ISrsHttpHandler class SrsHttpRedirectHandler : public ISrsHttpHandler
{ {
private: SRS_DECLARE_PRIVATE:
std::string url; std::string url;
int code; int code;
@ -341,10 +341,10 @@ extern std::string srs_http_fs_fullpath(std::string dir, std::string pattern, st
// http.Handle("/", SrsHttpFileServer("static-dir")) // http.Handle("/", SrsHttpFileServer("static-dir"))
class SrsHttpFileServer : public ISrsHttpHandler class SrsHttpFileServer : public ISrsHttpHandler
{ {
protected: SRS_DECLARE_PROTECTED:
std::string dir; std::string dir;
protected: SRS_DECLARE_PROTECTED:
ISrsFileReaderFactory *fs_factory; ISrsFileReaderFactory *fs_factory;
SrsPath *path_; SrsPath *path_;
@ -352,7 +352,7 @@ public:
SrsHttpFileServer(std::string root_dir); SrsHttpFileServer(std::string root_dir);
virtual ~SrsHttpFileServer(); virtual ~SrsHttpFileServer();
private: SRS_DECLARE_PRIVATE:
// For utest to mock the fs. // For utest to mock the fs.
virtual void set_fs_factory(ISrsFileReaderFactory *v); virtual void set_fs_factory(ISrsFileReaderFactory *v);
// For utest to mock the path utility. // For utest to mock the path utility.
@ -361,13 +361,13 @@ private:
public: public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
private: SRS_DECLARE_PRIVATE:
// Serve the file by specified path // Serve the file by specified path
virtual srs_error_t serve_file(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, std::string fullpath); virtual srs_error_t serve_file(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, std::string fullpath);
virtual srs_error_t serve_flv_file(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, std::string fullpath); virtual srs_error_t serve_flv_file(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, std::string fullpath);
virtual srs_error_t serve_mp4_file(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, std::string fullpath); virtual srs_error_t serve_mp4_file(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, std::string fullpath);
protected: SRS_DECLARE_PROTECTED:
// When access flv file with x.flv?start=xxx // When access flv file with x.flv?start=xxx
virtual srs_error_t serve_flv_stream(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, std::string fullpath, int64_t offset); virtual srs_error_t serve_flv_stream(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, std::string fullpath, int64_t offset);
// When access mp4 file with x.mp4?range=start-end // When access mp4 file with x.mp4?range=start-end
@ -388,7 +388,7 @@ protected:
// the ts file including: .ts .m4s init.mp4 // the ts file including: .ts .m4s init.mp4
virtual srs_error_t serve_ts_ctx(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, std::string fullpath); virtual srs_error_t serve_ts_ctx(ISrsHttpResponseWriter *w, ISrsHttpMessage *r, std::string fullpath);
protected: SRS_DECLARE_PROTECTED:
// Copy the fs to response writer in size bytes. // Copy the fs to response writer in size bytes.
virtual srs_error_t copy(ISrsHttpResponseWriter *w, SrsFileReader *fs, ISrsHttpMessage *r, int64_t size); virtual srs_error_t copy(ISrsHttpResponseWriter *w, SrsFileReader *fs, ISrsHttpMessage *r, int64_t size);
}; };
@ -476,7 +476,7 @@ public:
// equivalent .- and ..-free URL. // equivalent .- and ..-free URL.
class SrsHttpServeMux : public ISrsHttpServeMux class SrsHttpServeMux : public ISrsHttpServeMux
{ {
private: SRS_DECLARE_PRIVATE:
// The pattern handler, to handle the http request. // The pattern handler, to handle the http request.
std::map<std::string, SrsHttpMuxEntry *> static_matchers_; std::map<std::string, SrsHttpMuxEntry *> static_matchers_;
// The vhost handler. // The vhost handler.
@ -486,7 +486,7 @@ private:
// The path will rewrite to ossrs.net/live/livestream.flv // The path will rewrite to ossrs.net/live/livestream.flv
std::map<std::string, ISrsHttpHandler *> vhosts_; std::map<std::string, ISrsHttpHandler *> vhosts_;
private: SRS_DECLARE_PRIVATE:
// all dynamic matcher for http match. // all dynamic matcher for http match.
// For example, the hstrs(http stream trigger rtmp source) // For example, the hstrs(http stream trigger rtmp source)
// can dynamic match and install handler when request incoming and no handler. // can dynamic match and install handler when request incoming and no handler.
@ -518,7 +518,7 @@ public:
public: public:
virtual srs_error_t find_handler(ISrsHttpMessage *r, ISrsHttpHandler **ph); virtual srs_error_t find_handler(ISrsHttpMessage *r, ISrsHttpHandler **ph);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t match(ISrsHttpMessage *r, ISrsHttpHandler **ph); virtual srs_error_t match(ISrsHttpMessage *r, ISrsHttpHandler **ph);
virtual bool path_match(std::string pattern, std::string path); virtual bool path_match(std::string pattern, std::string path);
}; };
@ -537,7 +537,7 @@ public:
// The filter http mux, directly serve the http CORS requests // The filter http mux, directly serve the http CORS requests
class SrsHttpCorsMux : public ISrsHttpCorsMux class SrsHttpCorsMux : public ISrsHttpCorsMux
{ {
private: SRS_DECLARE_PRIVATE:
bool required; bool required;
bool enabled; bool enabled;
ISrsHttpHandler *next_; ISrsHttpHandler *next_;
@ -570,7 +570,7 @@ public:
// @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate // @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate
class SrsHttpAuthMux : public ISrsHttpAuthMux class SrsHttpAuthMux : public ISrsHttpAuthMux
{ {
private: SRS_DECLARE_PRIVATE:
bool enabled_; bool enabled_;
std::string username_; std::string username_;
std::string password_; std::string password_;
@ -586,7 +586,7 @@ public:
public: public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); virtual srs_error_t serve_http(ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_auth(ISrsHttpResponseWriter *w, ISrsHttpMessage *r); virtual srs_error_t do_auth(ISrsHttpResponseWriter *w, ISrsHttpMessage *r);
}; };
@ -668,7 +668,7 @@ public:
// Used to resolve the http uri. // Used to resolve the http uri.
class SrsHttpUri class SrsHttpUri
{ {
private: SRS_DECLARE_PRIVATE:
std::string url_; std::string url_;
std::string schema_; std::string schema_;
std::string host_; std::string host_;
@ -702,7 +702,7 @@ public:
virtual std::string username(); virtual std::string username();
virtual std::string password(); virtual std::string password();
private: SRS_DECLARE_PRIVATE:
// Simple URL parser to replace http-parser URL parsing // Simple URL parser to replace http-parser URL parsing
virtual srs_error_t parse_url_simple(const std::string &url, std::string &schema, std::string &host, int &port, virtual srs_error_t parse_url_simple(const std::string &url, std::string &schema, std::string &host, int &port,
std::string &path, std::string &query, std::string &fragment, std::string &path, std::string &query, std::string &fragment,

View File

@ -44,7 +44,7 @@ public:
char marker_; char marker_;
// Don't directly create this object, // Don't directly create this object,
// please use SrsJsonAny::str() to create a concreated one. // please use SrsJsonAny::str() to create a concreated one.
protected: SRS_DECLARE_PROTECTED:
SrsJsonAny(); SrsJsonAny();
public: public:
@ -101,11 +101,11 @@ public:
class SrsJsonObject : public SrsJsonAny class SrsJsonObject : public SrsJsonAny
{ {
private: SRS_DECLARE_PRIVATE:
typedef std::pair<std::string, SrsJsonAny *> SrsJsonObjectPropertyType; typedef std::pair<std::string, SrsJsonAny *> SrsJsonObjectPropertyType;
std::vector<SrsJsonObjectPropertyType> properties_; std::vector<SrsJsonObjectPropertyType> properties_;
private: SRS_DECLARE_PRIVATE:
// Use SrsJsonAny::object() to create it. // Use SrsJsonAny::object() to create it.
friend class SrsJsonAny; friend class SrsJsonAny;
SrsJsonObject(); SrsJsonObject();
@ -137,10 +137,10 @@ public:
class SrsJsonArray : public SrsJsonAny class SrsJsonArray : public SrsJsonAny
{ {
private: SRS_DECLARE_PRIVATE:
std::vector<SrsJsonAny *> properties_; std::vector<SrsJsonAny *> properties_;
private: SRS_DECLARE_PRIVATE:
// Use SrsJsonAny::array() to create it. // Use SrsJsonAny::array() to create it.
friend class SrsJsonAny; friend class SrsJsonAny;
SrsJsonArray(); SrsJsonArray();

View File

@ -19,7 +19,7 @@
// which identify the client. // which identify the client.
class SrsThreadContext : public ISrsContext class SrsThreadContext : public ISrsContext
{ {
private: SRS_DECLARE_PRIVATE:
std::map<srs_thread_t, SrsContextId> cache_; std::map<srs_thread_t, SrsContextId> cache_;
public: public:
@ -31,7 +31,7 @@ public:
virtual const SrsContextId &get_id(); virtual const SrsContextId &get_id();
virtual const SrsContextId &set_id(const SrsContextId &v); virtual const SrsContextId &set_id(const SrsContextId &v);
private: SRS_DECLARE_PRIVATE:
virtual void clear_cid(); virtual void clear_cid();
}; };

View File

@ -17,7 +17,7 @@ class ISrsEncoder;
// See https://developers.google.com/protocol-buffers/docs/encoding#varints // See https://developers.google.com/protocol-buffers/docs/encoding#varints
class SrsProtobufVarints class SrsProtobufVarints
{ {
private: SRS_DECLARE_PRIVATE:
static int bits_len64(uint64_t x); static int bits_len64(uint64_t x);
public: public:

View File

@ -59,7 +59,7 @@ enum SrsStunMessageAttribute {
class SrsStunPacket class SrsStunPacket
{ {
private: SRS_DECLARE_PRIVATE:
uint16_t message_type_; uint16_t message_type_;
std::string username_; std::string username_;
std::string local_ufrag_; std::string local_ufrag_;
@ -97,7 +97,7 @@ public:
srs_error_t decode(const char *buf, const int nb_buf); srs_error_t decode(const char *buf, const int nb_buf);
srs_error_t encode(const std::string &pwd, SrsBuffer *stream); srs_error_t encode(const std::string &pwd, SrsBuffer *stream);
private: SRS_DECLARE_PRIVATE:
srs_error_t encode_binding_response(const std::string &pwd, SrsBuffer *stream); srs_error_t encode_binding_response(const std::string &pwd, SrsBuffer *stream);
std::string encode_username(); std::string encode_username();
std::string encode_mapped_address(); std::string encode_mapped_address();

View File

@ -68,15 +68,15 @@ public:
// client.close(); // client.close();
class SrsBasicRtmpClient : public ISrsBasicRtmpClient class SrsBasicRtmpClient : public ISrsBasicRtmpClient
{ {
private: SRS_DECLARE_PRIVATE:
std::string url_; std::string url_;
srs_utime_t connect_timeout_; srs_utime_t connect_timeout_;
srs_utime_t stream_timeout_; srs_utime_t stream_timeout_;
protected: SRS_DECLARE_PROTECTED:
ISrsRequest *req_; ISrsRequest *req_;
private: SRS_DECLARE_PRIVATE:
SrsTcpClient *transport_; SrsTcpClient *transport_;
SrsRtmpClient *client_; SrsRtmpClient *client_;
SrsNetworkKbps *kbps_; SrsNetworkKbps *kbps_;
@ -100,7 +100,7 @@ public:
virtual srs_error_t connect(); virtual srs_error_t connect();
virtual void close(); virtual void close();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t connect_app(); virtual srs_error_t connect_app();
virtual srs_error_t do_connect_app(std::string local_ip, bool debug); virtual srs_error_t do_connect_app(std::string local_ip, bool debug);

View File

@ -36,14 +36,14 @@ srs_error_t openssl_generate_key(char *public_key, int32_t size);
// The DH wrapper. // The DH wrapper.
class SrsDH class SrsDH
{ {
private: SRS_DECLARE_PRIVATE:
DH *pdh; DH *pdh;
public: public:
SrsDH(); SrsDH();
virtual ~SrsDH(); virtual ~SrsDH();
private: SRS_DECLARE_PRIVATE:
virtual void close(); virtual void close();
public: public:
@ -67,7 +67,7 @@ public:
// user should never ignore this size. // user should never ignore this size.
virtual srs_error_t copy_shared_key(const char *ppkey, int32_t ppkey_size, char *skey, int32_t &skey_size); virtual srs_error_t copy_shared_key(const char *ppkey, int32_t ppkey_size, char *skey, int32_t &skey_size);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_initialize(); virtual srs_error_t do_initialize();
}; };
// The schema type. // The schema type.
@ -91,7 +91,7 @@ enum srs_schema_type {
// @see also: http://blog.csdn.net/win_lin/article/details/13006803 // @see also: http://blog.csdn.net/win_lin/article/details/13006803
class SrsKeyBlock class SrsKeyBlock
{ {
private: SRS_DECLARE_PRIVATE:
SrsRand rand_; SrsRand rand_;
public: public:
@ -119,7 +119,7 @@ public:
// @stream contains c1s1_key_bytes the key start bytes // @stream contains c1s1_key_bytes the key start bytes
srs_error_t parse(SrsBuffer *stream); srs_error_t parse(SrsBuffer *stream);
private: SRS_DECLARE_PRIVATE:
// Calculate the offset of key, // Calculate the offset of key,
// The key->offset cannot be used as the offset of key. // The key->offset cannot be used as the offset of key.
int calc_valid_offset(); int calc_valid_offset();
@ -133,7 +133,7 @@ private:
// @see also: http://blog.csdn.net/win_lin/article/details/13006803 // @see also: http://blog.csdn.net/win_lin/article/details/13006803
class SrsDigestBlock class SrsDigestBlock
{ {
private: SRS_DECLARE_PRIVATE:
SrsRand rand_; SrsRand rand_;
public: public:
@ -161,7 +161,7 @@ public:
// @stream contains c1s1_digest_bytes the digest start bytes // @stream contains c1s1_digest_bytes the digest start bytes
srs_error_t parse(SrsBuffer *stream); srs_error_t parse(SrsBuffer *stream);
private: SRS_DECLARE_PRIVATE:
// Calculate the offset of digest, // Calculate the offset of digest,
// The key->offset cannot be used as the offset of digest. // The key->offset cannot be used as the offset of digest.
int calc_valid_offset(); int calc_valid_offset();
@ -174,7 +174,7 @@ class SrsC1S1;
// while the concrete class to implements in schema0 or schema1. // while the concrete class to implements in schema0 or schema1.
class SrsC1S1Strategy class SrsC1S1Strategy
{ {
protected: SRS_DECLARE_PROTECTED:
SrsKeyBlock key_; SrsKeyBlock key_;
SrsDigestBlock digest_; SrsDigestBlock digest_;
@ -389,7 +389,7 @@ public:
// @see also: http://blog.csdn.net/win_lin/article/details/13006803 // @see also: http://blog.csdn.net/win_lin/article/details/13006803
class SrsC2S2 class SrsC2S2
{ {
private: SRS_DECLARE_PRIVATE:
SrsRand rand_; SrsRand rand_;
public: public:

View File

@ -37,7 +37,7 @@ public:
// Free specified count of messages. // Free specified count of messages.
virtual void free(int count); virtual void free(int count);
private: SRS_DECLARE_PRIVATE:
// Zero initialize the message array. // Zero initialize the message array.
virtual void zero(int count); virtual void zero(int count);
}; };

View File

@ -121,7 +121,7 @@ public:
// The message type set the RTMP message type in header. // The message type set the RTMP message type in header.
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
// The subpacket can override to calc the packet size. // The subpacket can override to calc the packet size.
virtual int get_size(); virtual int get_size();
// The subpacket can override to encode the payload to stream. // The subpacket can override to encode the payload to stream.
@ -134,7 +134,7 @@ protected:
// and to send out RTMP message over RTMP chunk stream. // and to send out RTMP message over RTMP chunk stream.
class SrsProtocol class SrsProtocol
{ {
private: SRS_DECLARE_PRIVATE:
class AckWindowSize class AckWindowSize
{ {
public: public:
@ -147,7 +147,7 @@ private:
AckWindowSize(); AckWindowSize();
}; };
// For peer in/out // For peer in/out
private: SRS_DECLARE_PRIVATE:
// The underlayer socket object, send/recv bytes. // The underlayer socket object, send/recv bytes.
ISrsProtocolReadWriter *skt_; ISrsProtocolReadWriter *skt_;
// The requests sent out, used to build the response. // The requests sent out, used to build the response.
@ -155,7 +155,7 @@ private:
// value: the request command name // value: the request command name
std::map<double, std::string> requests_; std::map<double, std::string> requests_;
// For peer in // For peer in
private: SRS_DECLARE_PRIVATE:
// The chunk stream to decode RTMP messages. // The chunk stream to decode RTMP messages.
std::map<int, SrsChunkStream *> chunk_streams_; std::map<int, SrsChunkStream *> chunk_streams_;
// Cache some frequently used chunk header. // Cache some frequently used chunk header.
@ -181,7 +181,7 @@ private:
// When not auto response message, manual flush the messages in queue. // When not auto response message, manual flush the messages in queue.
std::vector<SrsRtmpCommand *> manual_response_queue_; std::vector<SrsRtmpCommand *> manual_response_queue_;
// For peer out // For peer out
private: SRS_DECLARE_PRIVATE:
// Cache for multiple messages send, // Cache for multiple messages send,
// initialize to iovec[SRS_CONSTS_IOVS_MAX] and realloc when consumed, // initialize to iovec[SRS_CONSTS_IOVS_MAX] and realloc when consumed,
// it's ok to realloc the iovs cache, for all ptr is ok. // it's ok to realloc the iovs cache, for all ptr is ok.
@ -338,7 +338,7 @@ public:
return err; return err;
} }
private: SRS_DECLARE_PRIVATE:
// Send out the messages, donot free it, // Send out the messages, donot free it,
// The caller must free the param msgs. // The caller must free the param msgs.
virtual srs_error_t do_send_messages(SrsMediaPacket **msgs, int nb_msgs); virtual srs_error_t do_send_messages(SrsMediaPacket **msgs, int nb_msgs);
@ -367,13 +367,13 @@ private:
// When message sentout, update the context. // When message sentout, update the context.
virtual srs_error_t on_send_packet(SrsMessageHeader *mh, SrsRtmpCommand *packet); virtual srs_error_t on_send_packet(SrsMessageHeader *mh, SrsRtmpCommand *packet);
private: SRS_DECLARE_PRIVATE:
// Auto response the ack message. // Auto response the ack message.
virtual srs_error_t response_acknowledgement_message(); virtual srs_error_t response_acknowledgement_message();
// Auto response the ping message. // Auto response the ping message.
virtual srs_error_t response_ping_message(int32_t timestamp); virtual srs_error_t response_ping_message(int32_t timestamp);
private: SRS_DECLARE_PRIVATE:
virtual void print_debug_info(); virtual void print_debug_info();
}; };
@ -543,7 +543,7 @@ bool srs_client_type_is_publish(SrsRtmpConnType type);
// For smart switch between complex and simple handshake. // For smart switch between complex and simple handshake.
class SrsHandshakeBytes class SrsHandshakeBytes
{ {
private: SRS_DECLARE_PRIVATE:
SrsRand rand_; SrsRand rand_;
public: public:
@ -589,10 +589,10 @@ struct SrsServerInfo {
// implements the client role protocol. // implements the client role protocol.
class SrsRtmpClient class SrsRtmpClient
{ {
private: SRS_DECLARE_PRIVATE:
SrsHandshakeBytes *hs_bytes_; SrsHandshakeBytes *hs_bytes_;
protected: SRS_DECLARE_PROTECTED:
SrsProtocol *protocol_; SrsProtocol *protocol_;
ISrsProtocolReadWriter *io_; ISrsProtocolReadWriter *io_;
@ -702,7 +702,7 @@ public:
// such as connect to vhost/app, play stream, get audio/video data. // such as connect to vhost/app, play stream, get audio/video data.
class SrsRtmpServer : public ISrsRtmpServer class SrsRtmpServer : public ISrsRtmpServer
{ {
private: SRS_DECLARE_PRIVATE:
SrsHandshakeBytes *hs_bytes_; SrsHandshakeBytes *hs_bytes_;
SrsProtocol *protocol_; SrsProtocol *protocol_;
ISrsProtocolReadWriter *io_; ISrsProtocolReadWriter *io_;
@ -868,13 +868,13 @@ public:
return protocol_->expect_message<T>(pmsg, ppacket); return protocol_->expect_message<T>(pmsg, ppacket);
} }
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t identify_create_stream_client(SrsCreateStreamPacket *req, int stream_id, int depth, SrsRtmpConnType &type, std::string &stream_name, srs_utime_t &duration); virtual srs_error_t identify_create_stream_client(SrsCreateStreamPacket *req, int stream_id, int depth, SrsRtmpConnType &type, std::string &stream_name, srs_utime_t &duration);
virtual srs_error_t identify_fmle_publish_client(SrsFMLEStartPacket *req, SrsRtmpConnType &type, std::string &stream_name); virtual srs_error_t identify_fmle_publish_client(SrsFMLEStartPacket *req, SrsRtmpConnType &type, std::string &stream_name);
virtual srs_error_t identify_haivision_publish_client(SrsFMLEStartPacket *req, SrsRtmpConnType &type, std::string &stream_name); virtual srs_error_t identify_haivision_publish_client(SrsFMLEStartPacket *req, SrsRtmpConnType &type, std::string &stream_name);
virtual srs_error_t identify_flash_publish_client(SrsPublishPacket *req, SrsRtmpConnType &type, std::string &stream_name); virtual srs_error_t identify_flash_publish_client(SrsPublishPacket *req, SrsRtmpConnType &type, std::string &stream_name);
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t identify_play_client(SrsPlayPacket *req, SrsRtmpConnType &type, std::string &stream_name, srs_utime_t &duration); virtual srs_error_t identify_play_client(SrsPlayPacket *req, SrsRtmpConnType &type, std::string &stream_name, srs_utime_t &duration);
}; };
@ -907,7 +907,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -937,7 +937,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -971,7 +971,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -997,7 +997,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1030,7 +1030,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1058,7 +1058,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1109,7 +1109,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
// Factory method to create specified FMLE packet. // Factory method to create specified FMLE packet.
@ -1145,7 +1145,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1192,7 +1192,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1285,7 +1285,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1320,7 +1320,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1346,7 +1346,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1379,7 +1379,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1407,7 +1407,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1433,7 +1433,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1463,7 +1463,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1486,7 +1486,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1509,7 +1509,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1534,7 +1534,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1565,7 +1565,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };
@ -1676,7 +1676,7 @@ public:
public: public:
virtual int get_message_type(); virtual int get_message_type();
protected: SRS_DECLARE_PROTECTED:
virtual int get_size(); virtual int get_size();
virtual srs_error_t encode_packet(SrsBuffer *stream); virtual srs_error_t encode_packet(SrsBuffer *stream);
}; };

View File

@ -24,7 +24,7 @@ class SrsFormat;
// RTP video builder for packaging video NALUs into RTP packets // RTP video builder for packaging video NALUs into RTP packets
class SrsRtpVideoBuilder class SrsRtpVideoBuilder
{ {
private: SRS_DECLARE_PRIVATE:
uint16_t video_sequence_; uint16_t video_sequence_;
uint32_t video_ssrc_; uint32_t video_ssrc_;
uint8_t video_payload_type_; uint8_t video_payload_type_;

View File

@ -264,7 +264,7 @@ public:
// Encode message to string. // Encode message to string.
virtual srs_error_t encode(std::stringstream &ss); virtual srs_error_t encode(std::stringstream &ss);
protected: SRS_DECLARE_PROTECTED:
// Sub classes override this to encode the headers. // Sub classes override this to encode the headers.
virtual srs_error_t encode_header(std::stringstream &ss); virtual srs_error_t encode_header(std::stringstream &ss);
}; };
@ -283,7 +283,7 @@ public:
SrsRtspOptionsResponse(int cseq); SrsRtspOptionsResponse(int cseq);
virtual ~SrsRtspOptionsResponse(); virtual ~SrsRtspOptionsResponse();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t encode_header(std::stringstream &ss); virtual srs_error_t encode_header(std::stringstream &ss);
}; };
@ -298,7 +298,7 @@ public:
SrsRtspDescribeResponse(int cseq); SrsRtspDescribeResponse(int cseq);
virtual ~SrsRtspDescribeResponse(); virtual ~SrsRtspDescribeResponse();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t encode_header(std::stringstream &ss); virtual srs_error_t encode_header(std::stringstream &ss);
}; };
@ -330,7 +330,7 @@ public:
SrsRtspSetupResponse(int cseq); SrsRtspSetupResponse(int cseq);
virtual ~SrsRtspSetupResponse(); virtual ~SrsRtspSetupResponse();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t encode_header(std::stringstream &ss); virtual srs_error_t encode_header(std::stringstream &ss);
}; };
@ -341,7 +341,7 @@ public:
SrsRtspPlayResponse(int cseq); SrsRtspPlayResponse(int cseq);
virtual ~SrsRtspPlayResponse(); virtual ~SrsRtspPlayResponse();
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t encode_header(std::stringstream &ss); virtual srs_error_t encode_header(std::stringstream &ss);
}; };

View File

@ -154,7 +154,7 @@ public:
bool is_audio() const { return type_ == "audio"; } bool is_audio() const { return type_ == "audio"; }
bool is_video() const { return type_ == "video"; } bool is_video() const { return type_ == "video"; }
private: SRS_DECLARE_PRIVATE:
srs_error_t parse_attribute(const std::string &content); srs_error_t parse_attribute(const std::string &content);
srs_error_t parse_attr_rtpmap(const std::string &value); srs_error_t parse_attr_rtpmap(const std::string &value);
srs_error_t parse_attr_rtcp(const std::string &value); srs_error_t parse_attr_rtcp(const std::string &value);
@ -166,7 +166,7 @@ private:
srs_error_t parse_attr_ssrc_group(const std::string &value); srs_error_t parse_attr_ssrc_group(const std::string &value);
srs_error_t parse_attr_extmap(const std::string &value); srs_error_t parse_attr_extmap(const std::string &value);
private: SRS_DECLARE_PRIVATE:
SrsSSRCInfo &fetch_or_create_ssrc_info(uint32_t ssrc); SrsSSRCInfo &fetch_or_create_ssrc_info(uint32_t ssrc);
public: public:
@ -224,10 +224,10 @@ public:
std::string get_ice_pwd() const; std::string get_ice_pwd() const;
std::string get_dtls_role() const; std::string get_dtls_role() const;
private: SRS_DECLARE_PRIVATE:
srs_error_t parse_line(const std::string &line); srs_error_t parse_line(const std::string &line);
private: SRS_DECLARE_PRIVATE:
srs_error_t parse_origin(const std::string &content); srs_error_t parse_origin(const std::string &content);
srs_error_t parse_version(const std::string &content); srs_error_t parse_version(const std::string &content);
srs_error_t parse_session_name(const std::string &content); srs_error_t parse_session_name(const std::string &content);
@ -237,7 +237,7 @@ private:
srs_error_t parse_media_description(const std::string &content); srs_error_t parse_media_description(const std::string &content);
srs_error_t parse_attr_group(const std::string &content); srs_error_t parse_attr_group(const std::string &content);
private: SRS_DECLARE_PRIVATE:
bool in_media_session_; bool in_media_session_;
public: public:

View File

@ -71,7 +71,7 @@ extern srs_error_t srs_srt_get_remote_ip_port(srs_srt_t srt_fd, std::string &ip,
// Get SRT stats. // Get SRT stats.
class SrsSrtStat class SrsSrtStat
{ {
private: SRS_DECLARE_PRIVATE:
void *stat_; void *stat_;
public: public:
@ -178,12 +178,12 @@ public:
// Unsubscribed OUT event to srt poller. // Unsubscribed OUT event to srt poller.
srs_error_t disable_write(); srs_error_t disable_write();
private: SRS_DECLARE_PRIVATE:
srs_error_t enable_event(int event); srs_error_t enable_event(int event);
srs_error_t disable_event(int event); srs_error_t disable_event(int event);
srs_error_t check_error(); srs_error_t check_error();
private: SRS_DECLARE_PRIVATE:
srs_srt_t srt_fd_; srs_srt_t srt_fd_;
// Mark if some error occured in srt socket. // Mark if some error occured in srt socket.
bool has_error_; bool has_error_;

View File

@ -91,7 +91,7 @@ extern int srs_mutex_unlock(srs_mutex_t mutex);
// cond->signal(); // cond->signal();
class SrsCond : public ISrsCond class SrsCond : public ISrsCond
{ {
private: SRS_DECLARE_PRIVATE:
srs_cond_t cond_; srs_cond_t cond_;
public: public:
@ -111,7 +111,7 @@ public:
// SrsLocker(mutex->get()); // SrsLocker(mutex->get());
class SrsMutex class SrsMutex
{ {
private: SRS_DECLARE_PRIVATE:
srs_mutex_t mutex_; srs_mutex_t mutex_;
public: public:
@ -153,7 +153,7 @@ extern bool srs_is_never_timeout(srs_utime_t tm);
class impl__SrsLocker class impl__SrsLocker
{ {
private: SRS_DECLARE_PRIVATE:
srs_mutex_t *lock_; srs_mutex_t *lock_;
public: public:
@ -174,7 +174,7 @@ public:
// that is, the sync socket mechanism. // that is, the sync socket mechanism.
class SrsStSocket : public ISrsProtocolReadWriter class SrsStSocket : public ISrsProtocolReadWriter
{ {
private: SRS_DECLARE_PRIVATE:
// The recv/send timeout in srs_utime_t. // The recv/send timeout in srs_utime_t.
// @remark Use SRS_UTIME_NO_TIMEOUT for never timeout. // @remark Use SRS_UTIME_NO_TIMEOUT for never timeout.
srs_utime_t rtm_; srs_utime_t rtm_;
@ -190,7 +190,7 @@ public:
SrsStSocket(srs_netfd_t fd); SrsStSocket(srs_netfd_t fd);
virtual ~SrsStSocket(); virtual ~SrsStSocket();
private: SRS_DECLARE_PRIVATE:
void init(srs_netfd_t fd); void init(srs_netfd_t fd);
public: public:
@ -220,11 +220,11 @@ public:
// @remark User can directly free the object, which will close the fd. // @remark User can directly free the object, which will close the fd.
class SrsTcpClient : public ISrsProtocolReadWriter class SrsTcpClient : public ISrsProtocolReadWriter
{ {
private: SRS_DECLARE_PRIVATE:
srs_netfd_t stfd_; srs_netfd_t stfd_;
SrsStSocket *io_; SrsStSocket *io_;
private: SRS_DECLARE_PRIVATE:
std::string host_; std::string host_;
int port_; int port_;
// The timeout in srs_utime_t. // The timeout in srs_utime_t.

View File

@ -49,7 +49,7 @@ public:
// TODO: FIXME: add utest for it. // TODO: FIXME: add utest for it.
class SrsFastStream class SrsFastStream
{ {
private: SRS_DECLARE_PRIVATE:
#ifdef SRS_PERF_MERGED_READ #ifdef SRS_PERF_MERGED_READ
// the merged handler // the merged handler
bool merged_read_; bool merged_read_;

View File

@ -69,6 +69,14 @@ srs_error_t prepare_main()
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
// Root global objects, should be created before any other global objects.
_srs_log = new SrsFileLog();
_srs_context = new SrsThreadContext();
_srs_config = new SrsConfig();
// For background context id.
_srs_context->set_id(_srs_context->generate_id());
if ((err = srs_global_initialize()) != srs_success) { if ((err = srs_global_initialize()) != srs_success) {
return srs_error_wrap(err, "init global"); return srs_error_wrap(err, "init global");
} }
@ -222,7 +230,7 @@ public:
return cp; return cp;
} }
private: SRS_DECLARE_PRIVATE:
MockSrsContextId *bind_; MockSrsContextId *bind_;
}; };

View File

@ -120,7 +120,7 @@ public:
// @remark The size of memory to allocate, should smaller than page size, generally 4096 bytes. // @remark The size of memory to allocate, should smaller than page size, generally 4096 bytes.
class MockProtectedBuffer class MockProtectedBuffer
{ {
private: SRS_DECLARE_PRIVATE:
char *raw_memory_; char *raw_memory_;
public: public:
@ -139,7 +139,7 @@ public:
// The chan never free the args, you must manage the memory. // The chan never free the args, you must manage the memory.
class SrsCoroutineChan class SrsCoroutineChan
{ {
private: SRS_DECLARE_PRIVATE:
std::vector<void *> args_; std::vector<void *> args_;
srs_mutex_t lock_; srs_mutex_t lock_;
@ -206,7 +206,7 @@ public:
#define SRS_COROUTINE_GO_IMPL(context, id, code_block) \ #define SRS_COROUTINE_GO_IMPL(context, id, code_block) \
class AnonymousCoroutineHandler##id : public ISrsCoroutineHandler \ class AnonymousCoroutineHandler##id : public ISrsCoroutineHandler \
{ \ { \
private: \ SRS_DECLARE_PRIVATE: \
SrsCoroutineChan *ctx_; \ SrsCoroutineChan *ctx_; \
\ \
public: \ public: \
@ -283,7 +283,7 @@ public:
// but with proper HTTP response formatting // but with proper HTTP response formatting
class SrsHttpTestServer : public ISrsCoroutineHandler class SrsHttpTestServer : public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
srs_netfd_t fd_; srs_netfd_t fd_;
string response_body_; string response_body_;
@ -304,14 +304,14 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(srs_netfd_t cfd); virtual srs_error_t do_cycle(srs_netfd_t cfd);
}; };
// Simple HTTPS test server similar to Go's httptest.NewServer but with SSL support // Simple HTTPS test server similar to Go's httptest.NewServer but with SSL support
class SrsHttpsTestServer : public ISrsCoroutineHandler class SrsHttpsTestServer : public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
srs_netfd_t fd_; srs_netfd_t fd_;
string response_body_; string response_body_;
@ -329,10 +329,10 @@ public:
virtual int get_port(); virtual int get_port();
// Interface ISrsCoroutineHandler // Interface ISrsCoroutineHandler
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
srs_error_t handle_client(srs_netfd_t client_fd); srs_error_t handle_client(srs_netfd_t client_fd);
}; };
@ -340,7 +340,7 @@ private:
// This server handles basic RTMP handshake and connect app operations // This server handles basic RTMP handshake and connect app operations
class SrsRtmpTestServer : public ISrsCoroutineHandler class SrsRtmpTestServer : public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
srs_netfd_t fd_; srs_netfd_t fd_;
string app_; string app_;
@ -366,7 +366,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: SRS_DECLARE_PRIVATE:
virtual srs_error_t do_cycle(srs_netfd_t cfd); virtual srs_error_t do_cycle(srs_netfd_t cfd);
virtual srs_error_t handle_rtmp_client(srs_netfd_t cfd); virtual srs_error_t handle_rtmp_client(srs_netfd_t cfd);
}; };
@ -374,7 +374,7 @@ private:
// Test TCP server for testing SrsTcpConnection // Test TCP server for testing SrsTcpConnection
class SrsTestTcpServer : public ISrsCoroutineHandler, public ISrsTcpHandler class SrsTestTcpServer : public ISrsCoroutineHandler, public ISrsTcpHandler
{ {
private: SRS_DECLARE_PRIVATE:
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
SrsTcpListener *listener_; SrsTcpListener *listener_;
string ip_; string ip_;
@ -403,7 +403,7 @@ public:
// Test TCP client for testing SrsTcpConnection // Test TCP client for testing SrsTcpConnection
class SrsTestTcpClient class SrsTestTcpClient
{ {
private: SRS_DECLARE_PRIVATE:
SrsTcpClient *client_; SrsTcpClient *client_;
SrsTcpConnection *conn_; SrsTcpConnection *conn_;
string host_; string host_;
@ -425,7 +425,7 @@ public:
// Test UDP server for testing UDP socket communication // Test UDP server for testing UDP socket communication
class SrsUdpTestServer : public ISrsCoroutineHandler class SrsUdpTestServer : public ISrsCoroutineHandler
{ {
private: SRS_DECLARE_PRIVATE:
srs_netfd_t lfd_; srs_netfd_t lfd_;
ISrsCoroutine *trd_; ISrsCoroutine *trd_;
SrsStSocket *socket_; SrsStSocket *socket_;
@ -450,7 +450,7 @@ public:
// Test UDP client for testing UDP socket communication // Test UDP client for testing UDP socket communication
class SrsUdpTestClient class SrsUdpTestClient
{ {
private: SRS_DECLARE_PRIVATE:
srs_netfd_t stfd_; srs_netfd_t stfd_;
SrsStSocket *socket_; SrsStSocket *socket_;
string host_; string host_;

View File

@ -170,7 +170,7 @@ public:
// Mock ISrsLiveSource for testing SrsOriginHub::on_audio // Mock ISrsLiveSource for testing SrsOriginHub::on_audio
class MockLiveSourceForOriginHub : public ISrsLiveSource class MockLiveSourceForOriginHub : public ISrsLiveSource
{ {
private: SRS_DECLARE_PRIVATE:
SrsRtmpFormat *format_; SrsRtmpFormat *format_;
SrsMetaCache *meta_; SrsMetaCache *meta_;

View File

@ -34,20 +34,20 @@ public:
MockSrsConfig(); MockSrsConfig();
virtual ~MockSrsConfig(); virtual ~MockSrsConfig();
private: SRS_DECLARE_PRIVATE:
std::map<std::string, std::string> included_files; std::map<std::string, std::string> included_files;
public: public:
virtual srs_error_t mock_parse(std::string buf); virtual srs_error_t mock_parse(std::string buf);
virtual srs_error_t mock_include(const std::string file_name, const std::string content); virtual srs_error_t mock_include(const std::string file_name, const std::string content);
protected: SRS_DECLARE_PROTECTED:
virtual srs_error_t build_buffer(std::string src, srs_internal::SrsConfigBuffer **pbuffer); virtual srs_error_t build_buffer(std::string src, srs_internal::SrsConfigBuffer **pbuffer);
}; };
class ISrsSetEnvConfig class ISrsSetEnvConfig
{ {
private: SRS_DECLARE_PRIVATE:
std::string key; std::string key;
SrsConfig *conf; SrsConfig *conf;
@ -65,7 +65,7 @@ public:
conf->env_cache_ = new SrsConfDirective(); conf->env_cache_ = new SrsConfDirective();
} }
private: SRS_DECLARE_PRIVATE:
// Adds, changes environment variables, which may starts with $. // Adds, changes environment variables, which may starts with $.
int srs_setenv(const std::string &key, const std::string &value, bool overwrite); int srs_setenv(const std::string &key, const std::string &value, bool overwrite);
// Deletes environment variables, which may starts with $. // Deletes environment variables, which may starts with $.

View File

@ -16,7 +16,7 @@
class MyNormalObject class MyNormalObject
{ {
private: SRS_DECLARE_PRIVATE:
int id_; int id_;
public: public:

Some files were not shown because too many files have changed in this diff Show More