File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525
2626namespace livekit {
2727
28- namespace capture {
29- class CaptureSource ;
30- } // namespace capture
31-
3228class VideoFrame ;
3329class EncodedVideoSource ;
30+ struct VideoSourceAccess ;
3431
3532// / Rotation of a video frame.
3633// /
@@ -101,12 +98,12 @@ class LIVEKIT_API VideoSource {
10198
10299private:
103100 friend class EncodedVideoSource ;
104- friend class capture ::CaptureSource ;
101+ friend struct VideoSourceAccess ;
105102
106103 enum class SourceType { Native, Encoded };
107104 VideoSource (int width, int height, SourceType source_type);
108105
109- // / @brief Adopt an existing FFI video source handle for capture sources .
106+ // / @brief Adopt an existing FFI video source handle.
110107 // / @param handle Rust-owned video source handle.
111108 // / @param width Frame width in pixels.
112109 // / @param height Frame height in pixels.
Original file line number Diff line number Diff line change @@ -172,8 +172,8 @@ std::shared_ptr<CaptureSource> CaptureSource::fromOwned(const proto::OwnedCaptur
172172 if (info.has_codec ()) {
173173 source->impl_ ->codec = static_cast <VideoCodec>(info.codec ());
174174 }
175- source->impl_ ->video_source = std::shared_ptr<VideoSource>(
176- new VideoSource (std::move (video_handle_owner), source->impl_ ->width , source->impl_ ->height ) );
175+ source->impl_ ->video_source =
176+ VideoSourceAccess::adopt (std::move (video_handle_owner), source->impl_ ->width , source->impl_ ->height );
177177
178178 return source;
179179}
Original file line number Diff line number Diff line change 1616
1717#pragma once
1818
19+ #include < memory>
20+ #include < utility>
21+
1922#include " livekit/capture/capture_source.h"
2023#include " livekit/visibility.h"
2124
25+ namespace livekit {
26+
27+ // / Internal adapter for adopting capture-owned video source handles without
28+ // / exposing capture types in the public VideoSource header.
29+ struct VideoSourceAccess {
30+ static std::shared_ptr<VideoSource> adopt (FfiHandle&& handle, int width, int height) {
31+ return std::shared_ptr<VideoSource>(new VideoSource (std::move (handle), width, height));
32+ }
33+ };
34+
35+ } // namespace livekit
36+
2237namespace livekit ::proto {
2338class NewCaptureSourceRequest ;
2439} // namespace livekit::proto
You can’t perform that action at this time.
0 commit comments