问题描述
我一直在 Flutter 中开发 POC(概念验证)应用程序,基本上我需要通过 HTTP 将 FPS 速率发送到服务器。但是 Flutter 的 Camera Controller 还没有这个功能。
这实际上是一个非常简单的代码,我从相机接收到的每个plane
(帧)都会发送到service.dart
,在那里进行处理和压缩。
// service.dart
void sendImagetoServerAsBytes(Plane plane) {
//
// As there's no way yet to set a framerate or bitrate with our camera
// controller,we must find a workaround,and that means controlling
// how many frames is processed.
// Todo: control how many frames are processed
//
if (plane.height == null || plane.width == null) {
// This probably happens bc 'avc: denied' access to the camera prop´.
Uint8List processedImage =
ImageProcessor().processImageForSending(720,1280,plane.bytes);
Uint8List compressedPayload = _compresspayload(processedImage);
// camera.dart
controller.startimagestream((image) {
image.planes.forEach((values) {
try {
Service().sendImagetoServerAsBytes(values);
} catch (e) {
print(e);
}
});
});
我尝试使用触发器将帧数减少一半,但没有奏效。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)