gpt4 book ai didi

qt - 由于 QML 中的主线程阻塞错误,无法启动视频表面

转载 作者:太空宇宙 更新时间:2023-11-03 16:53:07 33 4
gpt4 key购买 nike

我为网络摄像头显示编写了一个示例 QML-qt5 应用程序,但出现错误:操作系统:UBUNTU 13.04Qt Creator 2.7.1 基于Qt 5.0.2(64位)

Failed to start video surface due to main thread blocked. 
Failed to start video surface
CameraBin error: "Internal data flow error."

PS:这个错误是随机发生的,而且大多数时候都是这样;比如说20次18-19次

代码如下:

import QtQuick 2.0
import QtMultimedia 5.0

Item {
width: 320
height: 240

VideoOutput {
id:camOutput
source: camera
anchors.fill: parent
focus : visible // to receive focus and capture key events when visible

}

Camera {
id: camera

imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash

exposure {
exposureCompensation: -1.0
exposureMode: Camera.ExposurePortrait
}

flash.mode: Camera.FlashRedEyeReduction

imageCapture {
onImageCaptured: {
photoPreview.source = preview // Show the preview in an Image
}
}

}
Image {
id: photoPreview
}
}

最佳答案

这是 Qt 中的一个错误 - 参见 QTBUG-39567 .

写这篇文章时(2017 年 6 月)没有实际的解决方案,但建议解决方法:

启动应用时不要立即播放视频 - 等待一秒钟再启动视频播放器。

我已经对此进行了测试,它解决了我播放视频的问题。

在您的情况下,这不是视频播放器,但在我看来,这与所有 QtMultimedia 组件有关。

关于qt - 由于 QML 中的主线程阻塞错误,无法启动视频表面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17507709/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com