38 public network::interface::UdpServer::PacketHandler,
39 public webrtc::RtpVideoStreamReceiver2::OnCompleteFrameCallback,
40 public std::enable_shared_from_this<RtpCapturerVideoSource> {
44 std::shared_ptr<codec::VideoCodec> codec,
45 std::unique_ptr<network::interface::UdpServer> udp_server,
46 std::shared_ptr<interface::RtpCapturerVideoSourceRepository> repository,
47 std::unique_ptr<rtc::Thread> depacketize_th);
62 static std::shared_ptr<RtpCapturerVideoSource>
Create(
69 std::optional<uint8_t> GetFrameId()
override;
70 void RegisterCallback(webrtc::EncodedImageCallback* callback)
override;
71 std::string Endpoint()
const override;
72 void OnEncoderReleased(webrtc::EncodedImageCallback* callback)
override;
73 rtc::scoped_refptr<media::interface::InternalCapturerVideoSource> GetSource()
override;
75 void OnPacketReceived(
const uint8_t* data,
size_t size)
override;
77 void OnCompleteFrame(std::unique_ptr<webrtc::EncodedFrame> frame)
override;
81 std::unique_ptr<webrtc::RtpVideoStreamReceiver2> CreateReceiver(
82 const webrtc::RtpPacketReceived& packet);
83 void DummyFrameLoop(uint16_t frame_id);
84 uint64_t GenerateSsrc()
const;
85 webrtc::VideoReceiveStreamInterface::Config CreateFakeConfig()
const;
87 std::shared_ptr<codec::VideoCodec> codec_;
88 std::unique_ptr<rtc::Thread> depacketize_th_ =
nullptr;
89 FakeTransport transport_;
91 rtc::scoped_refptr<I420CapturerVideoSource::I420InternalCapturerVideoSource> source_;
92 std::unique_ptr<network::interface::UdpServer> udp_server_;
93 std::mutex callbacks_mtx_;
94 std::unordered_set<webrtc::EncodedImageCallback*> callbacks_;
95 std::unique_ptr<webrtc::FieldTrials> trials_ =
nullptr;
96 webrtc::VideoReceiveStreamInterface::Config config_;
97 std::unique_ptr<webrtc::TaskQueueBase, webrtc::TaskQueueDeleter> encoded_image_queue_ =
nullptr;
98 std::unique_ptr<webrtc::RtpVideoStreamReceiver2> receiver_ =
nullptr;
99 std::atomic<bool> frame_loop_stopped_ =
true;
100 global::Worker dummy_frame_worker_;
101 std::optional<uint16_t> frame_id_;
102 std::atomic<bool> is_receiving =
false;
103 std::weak_ptr<interface::RtpCapturerVideoSourceRepository> repo_;
107 friend class RtpCapturerVideoSourceTest;