You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

52 lines
1.3 KiB

/*
MediaMtx (C++) - RTSP static source (MediaMTX: internal/staticsources/rtsp)
Pulls a camera stream with live555 (DESCRIBE / SETUP / PLAY), in its own thread with its own live555
event loop. Only H264 video is taken; other tracks are skipped. On an error or when no data arrives
for readTimeout the session is torn down and opened again after sourceRetryPause.
*/
#pragma once
#include <atomic>
#include <condition_variable>
#include <mutex>
#include <string>
#include <thread>
#include "../../conf/conf.h"
#include <logger/logger.h>
#include <stream/stream.h>
#include <core/mediaPath.h>
namespace mtx {
class RtspSource : public LogParent
{
public:
RtspSource(const PathConf & conf, const Conf & global, SourceParent * parent);
~RtspSource();
void start();
void stop();
// called by the live555 session (same thread)
bool stopRequested() const { return m_bStop; }
SourceParent * parent() { return m_pParent; }
const PathConf & pathConf() const { return m_conf; }
const Conf & global() const { return m_global; }
private:
void run();
void runSession();
void waitRetry();
PathConf m_conf;
Conf m_global;
SourceParent * m_pParent;
std::atomic<bool> m_bStop{false};
std::mutex m_mutex;
std::condition_variable m_cond;
std::thread m_thread;
};
} // namespace mtx