Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement AsyncTask for heavy computation to unblock UI thread #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlexSchwabauer
Copy link

I found that the bottleneck of this module is the barcode detection logic which is done on each frame.
Unfortunately, this computation is quite expensive and blocks the UI and leads to bad performance.
This pull request wraps the logic of BarcodeScannerView.onPreviewFrame in an AsyncTask to free the UI thread.

@ackdav
Copy link

ackdav commented Sep 15, 2016

@c0b41
Copy link

c0b41 commented Sep 27, 2016

👍

if(CURRENT_TASK == null || CURRENT_TASK.getStatus() == AsyncTask.Status.FINISHED ) {
if(camera != null) {
// AsyncTask expects one parameter, so I wrap data and camera in a class
ProcessFrameData frameDataHeloer = new ProcessFrameData(data, camera);
Copy link

@grunch grunch Oct 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexSchwabauer Maybe you want to change "frameDataHeloer" for "frameDataHelper" :)

@chirag04
Copy link
Contributor

chirag04 commented Oct 2, 2016

@andreaskeller Barcode scanning on android is added to react-native-camera now. It's worth joining hands with react-native-camera or adding in ios support here and claim barcode scanning only module.

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.

5 participants