mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-10-18 09:53:05 +08:00
[feat] optimize macOS native video encoding
This commit is contained in:
@@ -384,7 +384,7 @@ void ScreenCapturerDxgi::CaptureLoop() {
|
||||
if (idx >= 0 && idx < static_cast<int>(display_info_list_.size())) {
|
||||
const std::string stream_id = MakeDisplayStreamId(idx);
|
||||
callback_(nv12_frame_, nv12_size, even_width, even_height,
|
||||
stream_id.c_str());
|
||||
stream_id.c_str(), nullptr);
|
||||
} else {
|
||||
LOG_ERROR("DXGI: CaptureLoop invalid monitor_index {} (list size {})",
|
||||
idx, display_info_list_.size());
|
||||
|
||||
@@ -212,7 +212,8 @@ void ScreenCapturerGdi::CaptureLoop() {
|
||||
|
||||
if (callback_) {
|
||||
const std::string stream_id = MakeDisplayStreamId(idx);
|
||||
callback_(nv12_frame_, nv12_size, width, height, stream_id.c_str());
|
||||
callback_(nv12_frame_, nv12_size, width, height, stream_id.c_str(),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
SelectObject(mem_dc, old);
|
||||
|
||||
@@ -406,7 +406,7 @@ void ScreenCapturerWgc::OnFrame(const WgcSession::wgc_session_frame& frame,
|
||||
|
||||
const std::string stream_id = MakeDisplayStreamId(id);
|
||||
on_data_(nv12_frame_, nv12_size, even_width, even_height,
|
||||
stream_id.c_str());
|
||||
stream_id.c_str(), nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -404,7 +404,8 @@ int ScreenCapturerWin::Init(const int fps, cb_desktop_data cb) {
|
||||
fps_ = fps;
|
||||
cb_orig_ = cb;
|
||||
cb_ = [this](unsigned char* data, int size, int w, int h,
|
||||
const char* reported_stream_id) {
|
||||
const char* reported_stream_id,
|
||||
const XNativeVideoFrame* native_frame) {
|
||||
if (secure_desktop_capture_active_.load(std::memory_order_relaxed)) {
|
||||
return;
|
||||
}
|
||||
@@ -450,7 +451,9 @@ int ScreenCapturerWin::Init(const int fps, cb_desktop_data cb) {
|
||||
"elapsed_ms={}",
|
||||
raw_stream_id, mapped_stream_id, w, h, size, elapsed_ms);
|
||||
}
|
||||
if (cb_orig_) cb_orig_(data, size, w, h, mapped_stream_id.c_str());
|
||||
if (cb_orig_) {
|
||||
cb_orig_(data, size, w, h, mapped_stream_id.c_str(), native_frame);
|
||||
}
|
||||
};
|
||||
|
||||
int ret = -1;
|
||||
@@ -1263,7 +1266,8 @@ void ScreenCapturerWin::SecureDesktopCaptureLoop() {
|
||||
&captured_width, &captured_height, &error_message)) {
|
||||
if (cb_orig_ && !secure_frame.empty()) {
|
||||
cb_orig_(secure_frame.data(), static_cast<int>(secure_frame.size()),
|
||||
captured_width, captured_height, display_name.c_str());
|
||||
captured_width, captured_height, display_name.c_str(),
|
||||
nullptr);
|
||||
}
|
||||
frame_delivered = true;
|
||||
}
|
||||
@@ -1277,7 +1281,8 @@ void ScreenCapturerWin::SecureDesktopCaptureLoop() {
|
||||
&captured_height, &error_message)) {
|
||||
if (cb_orig_ && !secure_frame.empty()) {
|
||||
cb_orig_(secure_frame.data(), static_cast<int>(secure_frame.size()),
|
||||
captured_width, captured_height, display_name.c_str());
|
||||
captured_width, captured_height, display_name.c_str(),
|
||||
nullptr);
|
||||
}
|
||||
frame_delivered = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user