void SrsEncoder::encoder_cycle() { int ret = ERROR_SUCCESS; log_context->generate_id(); srs_trace("encoder cycle start"); while (loop) { if ((ret = cycle()) != ERROR_SUCCESS) { srs_warn("encoder cycle failed, ignored and retry, ret=%d", ret); } else { srs_info("encoder cycle success, retry"); } if (!loop) { break; } st_usleep(SRS_ENCODER_SLEEP_MS * 1000); } // kill ffmpeg when finished and it alive std::vector<SrsFFMPEG*>::iterator it; for (it = ffmpegs.begin(); it != ffmpegs.end(); ++it) { SrsFFMPEG* ffmpeg = *it; ffmpeg->stop(); } srs_trace("encoder cycle finished"); }
void SrsEncoder::on_thread_stop() { // kill ffmpeg when finished and it alive std::vector<SrsFFMPEG*>::iterator it; for (it = ffmpegs.begin(); it != ffmpegs.end(); ++it) { SrsFFMPEG* ffmpeg = *it; ffmpeg->stop(); } }