关于byte 数据存在Queue,线程中拿出 mFaceDetector.inference 返回 null的情况
- Dominant language
- Objective-C
- Stars
- 702
- Forks
- 119
- PR merge metrics
- No merged PRs in 30d
Description
部分代码如下:
@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。
是否有人遇到过这种情况,您是如何解决的。。。
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the queue producer in onCameraPreview and the consumer loop in start(), then inspect the mFaceDetector.inference call shown in the report. Reproduce the case with queued frames while moving the face away, and determine whether the null results are expected or indicate stale frame handling. Done means the behavior and an appropriate fix or documented limitation are established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- computer-vision, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100