9#ifndef SKYWAY_MEDIA_RTP_RTP_CAPTURER_VIDEO_SOURCE_REPOSITORY_HPP_
10#define SKYWAY_MEDIA_RTP_RTP_CAPTURER_VIDEO_SOURCE_REPOSITORY_HPP_
13#include <unordered_set>
15#include "skyway/media/rtp/interface/rtp_capturer_video_source_repository.hpp"
22class RtpCapturerVideoSourceRepository :
public interface::RtpCapturerVideoSourceRepository {
24 ~RtpCapturerVideoSourceRepository();
26 static std::shared_ptr<interface::RtpCapturerVideoSourceRepository> GetInstance();
27 std::optional<uint16_t> Register(
28 std::shared_ptr<interface::RtpCapturerVideoSource> video_source)
override;
29 bool Unregister(std::shared_ptr<interface::RtpCapturerVideoSource> video_source)
override;
30 std::shared_ptr<interface::RtpCapturerVideoSource> Find(
const int& frame_id)
override;
31 static void Release();
34 RtpCapturerVideoSourceRepository();
36 const std::shared_ptr<interface::RtpCapturerVideoSource>& video_source)
const;
38 mutable std::mutex video_sources_mtx_;
39 std::unordered_set<std::shared_ptr<interface::RtpCapturerVideoSource>> video_sources_;
40 inline static std::mutex instance_mtx_;
41 inline static std::shared_ptr<interface::RtpCapturerVideoSourceRepository> instance_ =
nullptr;
42 uint16_t current_frame_id_;
45 friend class RtpCapturerVideoSourceRepositoryTest;