Skip to content

feat(ext-image-capture): Add multi-screen recording support#765

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:develop/snipefrom
dengzhongyuan365-dev:treelandcommit1
Nov 27, 2025
Merged

feat(ext-image-capture): Add multi-screen recording support#765
deepin-bot[bot] merged 1 commit into
linuxdeepin:develop/snipefrom
dengzhongyuan365-dev:treelandcommit1

Conversation

@dengzhongyuan365-dev

Copy link
Copy Markdown
Member
  • Introduce MultiScreenCaptureCoordinator and MultiScreenFrameCompositor classes to manage multi-screen capture functionality and composite captured frames.
  • Enhance ExtCaptureIntegration to support starting and stopping multi-screen recordings.
  • Add new signals to ExtCaptureIntegration for handling multi-screen frame readiness and error reporting.
  • Update relevant header and source files to include the new multi-screen components, significantly improving overall screen recording capabilities.

特性(ext-image-capture): 添加多屏幕录制支持

  • 引入 MultiScreenCaptureCoordinatorMultiScreenFrameCompositor 类,用于管理多屏幕捕获功能和进行帧合成。
  • 增强 ExtCaptureIntegration,以支持多屏幕录制的启动和停止操作。
  • ExtCaptureIntegration 添加新信号,用于处理多屏幕帧准备就绪和错误报告。
  • 更新相关的头文件和源文件,纳入新的多屏幕组件,显著提升了整体屏幕录制能力。

- Introduce `MultiScreenCaptureCoordinator` and `MultiScreenFrameCompositor` classes to manage multi-screen capture functionality and composite captured frames.
- Enhance `ExtCaptureIntegration` to support starting and stopping multi-screen recordings.
- Add new signals to `ExtCaptureIntegration` for handling multi-screen frame readiness and error reporting.
- Update relevant header and source files to include the new multi-screen components, significantly improving overall screen recording capabilities.

特性(ext-image-capture): 添加多屏幕录制支持

- 引入 `MultiScreenCaptureCoordinator` 和 `MultiScreenFrameCompositor` 类,用于管理多屏幕捕获功能和进行帧合成。
- 增强 `ExtCaptureIntegration`,以支持多屏幕录制的启动和停止操作。
- 为 `ExtCaptureIntegration` 添加新信号,用于处理多屏幕帧准备就绪和错误报告。
- 更新相关的头文件和源文件,纳入新的多屏幕组件,显著提升了整体屏幕录制能力。
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

我来对这段代码进行详细审查:

  1. 代码结构和功能:
  • 新增了多屏录制功能,通过MultiScreenCaptureCoordinator和MultiScreenFrameCompositor两个核心类实现
  • ExtCaptureIntegration类扩展支持多屏录制
  • ExtCaptureSession增加了DMA Buffer支持
  1. 语法逻辑:
  • 代码结构清晰,类职责划分合理
  • 信号槽连接正确
  • 资源管理得当,使用了RAII模式
  1. 代码质量:
  • 日志记录完善,便于调试
  • 错误处理机制健全
  • 代码注释详细
  1. 性能优化建议:
// 在MultiScreenFrameCompositor::performFrameStitching()中
// 建议:使用QImage::Format_RGB32代替Format_RGBA8888,在不需要alpha通道时性能更好
QImage compositeImage(m_outputSize, QImage::Format_RGB32);

// 在MultiScreenCaptureCoordinator::extractDmaBufferData()中
// 建议:添加内存对齐检查,避免性能下降
if (stride % 4 != 0) {
    qCWarning(dsrApp) << "Warning: Unaligned stride may affect performance";
}
  1. 安全性建议:
// 在MultiScreenCaptureCoordinator::onScreenFrameReady()中
// 建议:添加frameData大小检查
if (frameInfo.frameData.size() != size) {
    qCWarning(dsrApp) << "Frame data size mismatch";
    return;
}

// 在MultiScreenFrameCompositor::convertDmaBufferToQImage()中
// 建议:添加空指针检查
if (!frameInfo.frameData.constData()) {
    qCWarning(dsrApp) << "Invalid frame data";
    return QImage();
}
  1. 其他改进建议:
// 在MultiScreenCaptureCoordinator::startMultiScreenCapture()中
// 建议:添加屏幕数量限制
const int MAX_SCREENS = 4;
if (screens.size() > MAX_SCREENS) {
    qCWarning(dsrApp) << "Too many screens requested";
    return false;
}

// 在MultiScreenFrameCompositor::addScreenFrame()中
// 建议:添加帧时间戳同步检查
if (abs(frameInfo.timestamp - latestTimestamp) > MAX_TIMESTAMP_DIFF) {
    qCWarning(dsrApp) << "Frame timestamp out of sync";
}
  1. 内存管理优化:
// 在MultiScreenCaptureCoordinator::~MultiScreenCaptureCoordinator()中
// 建议:确保所有资源被正确释放
for (auto& layout : m_screenLayouts) {
    if (layout.session) {
        layout.session->disconnect();
        layout.session->deleteLater();
        layout.session = nullptr;
    }
}
  1. 线程安全建议:
// 在MultiScreenFrameCompositor::addScreenFrame()中
// 建议:使用QMutexLocker保护共享数据
QMutexLocker locker(&m_frameMutex);
if (!m_frameMutex.tryLock(1000)) {
    qCWarning(dsrApp) << "Frame mutex timeout";
    return false;
}
  1. 错误处理改进:
// 在MultiScreenCaptureCoordinator::startMultiScreenCapture()中
// 建议:添加更详细的错误信息
if (!m_manager) {
    emit error(tr("Capture manager not initialized"));
    return false;
}
  1. 性能监控建议:
// 在关键函数中添加性能监控
QElapsedTimer timer;
timer.start();

// ... 函数执行 ...

qCDebug(dsrApp) << "Function execution time:" << timer.elapsed() << "ms";

总结:
代码整体质量较高,实现了多屏录制的核心功能。主要需要关注性能优化和错误处理的完善。建议在后续开发中重点优化内存管理和帧同步机制。

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dengzhongyuan365-dev, lzwind

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@dengzhongyuan365-dev

Copy link
Copy Markdown
Member Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Nov 27, 2025

Copy link
Copy Markdown
Contributor

This pr force merged! (status: unstable)

@deepin-bot deepin-bot Bot merged commit 2f7e3dd into linuxdeepin:develop/snipe Nov 27, 2025
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants