1#ifndef SKYWAY_MEDIA_RTP_RTP_CAPTURER_VIDEO_SOURCE_REPOSITORY_HPP_
2#define SKYWAY_MEDIA_RTP_RTP_CAPTURER_VIDEO_SOURCE_REPOSITORY_HPP_
5#include <unordered_set>
7#include "skyway/media/rtp/interface/rtp_capturer_video_source_repository.hpp"
14class RtpCapturerVideoSourceRepository :
public interface::RtpCapturerVideoSourceRepository {
16 ~RtpCapturerVideoSourceRepository();
18 static std::shared_ptr<interface::RtpCapturerVideoSourceRepository> GetInstance();
19 std::optional<uint16_t> Register(
20 std::shared_ptr<interface::RtpCapturerVideoSource> video_source)
override;
21 bool Unregister(std::shared_ptr<interface::RtpCapturerVideoSource> video_source)
override;
22 std::shared_ptr<interface::RtpCapturerVideoSource> Find(
const int& frame_id)
override;
23 static void Release();
26 RtpCapturerVideoSourceRepository();
28 mutable std::mutex video_sources_mtx_;
29 std::unordered_set<std::shared_ptr<interface::RtpCapturerVideoSource>> video_sources_;
30 inline static std::mutex instance_mtx_;
31 inline static std::shared_ptr<interface::RtpCapturerVideoSourceRepository> instance_ =
nullptr;
32 uint16_t current_frame_id_;
35 friend class RtpCapturerVideoSourceRepositoryTest;