HTTPD::~HTTPD()
{
- if (mhd) {
- MHD_quiesce_daemon(mhd);
- for (Stream *stream : streams) {
- stream->stop();
- }
- MHD_stop_daemon(mhd);
- }
+ stop();
}
void HTTPD::start(int port)
}
}
+void HTTPD::stop()
+{
+ if (mhd) {
+ MHD_quiesce_daemon(mhd);
+ for (Stream *stream : streams) {
+ stream->stop();
+ }
+ MHD_stop_daemon(mhd);
+ mhd = nullptr;
+ }
+}
+
void HTTPD::add_data(const char *buf, size_t size, bool keyframe, int64_t time, AVRational timebase)
{
unique_lock<mutex> lock(streams_mutex);