Skip to content

关于byte 数据存在Queue,线程中拿出 mFaceDetector.inference 返回 null的情况 #62

Description

@RavenGluttonous

部分代码如下:
@OverRide
public void onCameraPreview(byte[] data, long timestamp, int width, int height, int displayOrientation) {
//.......
frameQueue.put(byte)
//.......
}

public void start() {
new Thread(() -> {
while(true){
byte[] byte = frameQueue.take();
Thread.sleep(300);
//.......
long detectConfig = 0;//关于眨眼张嘴等配置
MNNFlipType outputFlip = isFrontCamera ? MNNFlipType.FLIP_Y : MNNFlipType.FLIP_NONE;//是否翻转
esults = mFaceDetector.inference(bytebuffer, width, height,
MNNCVImageFormat.YUV_NV21, detectConfig, inAngle, outAngle, outputFlip);
//.......
}

    }).start();

}

在这种情况下,假设在queue.put的时候,存入50条有效数据,线程内循环取出,当取出10条的时候,移开人脸,mFaceDetector.inference 将立即返回 null,且后续未处理部分有效数据,均返回null。

是否有人遇到过这种情况,您是如何解决的。。。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions