Older/MediaServer/MediaServer.cpp
amass 4f2fef9375
All checks were successful
Deploy / PullDocker (push) Successful in 8s
Deploy / Build (push) Successful in 2m54s
fix code.
2024-10-23 21:04:59 +08:00

31 lines
797 B
C++

#include "MediaServer.h"
#include "BoostLog.h"
#include "Network/TcpServer.h"
#include "Rtsp/RtspSession.h"
class MediaServerPrivate {
public:
toolkit::TcpServer::Ptr rtsp_server[2];
};
MediaServer::MediaServer(uint16_t port, bool ssl) : m_d(new MediaServerPrivate()) {
try {
m_d->rtsp_server[ssl] = std::make_shared<toolkit::TcpServer>();
if (ssl) {
m_d->rtsp_server[ssl]->start<toolkit::SessionWithSSL<mediakit::RtspSession>>(port);
} else {
m_d->rtsp_server[ssl]->start<mediakit::RtspSession>(port);
}
} catch (std::exception &ex) {
m_d->rtsp_server[ssl] = nullptr;
WarnL << ex.what();
}
}
MediaServer::~MediaServer() {
// mk_stop_all_server();
if (m_d != nullptr) {
delete m_d;
}
}