mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #374, use fast stop for ingesters to stop many FFMPEG.
This commit is contained in:
parent
d611bb6b45
commit
860d68e6e7
6 changed files with 76 additions and 7 deletions
|
@ -45,6 +45,8 @@ class SrsFFMPEG
|
|||
{
|
||||
private:
|
||||
bool started;
|
||||
// whether SIGINT send but need to wait or SIGKILL.
|
||||
bool fast_stopped;
|
||||
pid_t pid;
|
||||
private:
|
||||
std::string log_file;
|
||||
|
@ -83,7 +85,25 @@ public:
|
|||
virtual int initialize_copy();
|
||||
virtual int start();
|
||||
virtual int cycle();
|
||||
/**
|
||||
* send SIGTERM then SIGKILL to ensure the process stopped.
|
||||
* the stop will wait [0, SRS_PROCESS_QUIT_TIMEOUT_MS] depends on the
|
||||
* process quit timeout.
|
||||
* @remark use fast_stop before stop one by one, when got lots of process to quit.
|
||||
*/
|
||||
virtual void stop();
|
||||
public:
|
||||
/**
|
||||
* the fast stop is to send a SIGTERM.
|
||||
* for example, the ingesters owner lots of FFMPEG, it will take a long time
|
||||
* to stop one by one, instead the ingesters can fast_stop all FFMPEG, then
|
||||
* wait one by one to stop, it's more faster.
|
||||
* @remark user must use stop() to ensure the ffmpeg to stopped.
|
||||
* @remark we got N processes to stop, compare the time we spend,
|
||||
* when use stop without fast_stop, we spend maybe [0, SRS_PROCESS_QUIT_TIMEOUT_MS * N]
|
||||
* but use fast_stop then stop, the time is almost [0, SRS_PROCESS_QUIT_TIMEOUT_MS].
|
||||
*/
|
||||
virtual void fast_stop();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue