Skip to content

Implement AsyncTask for heavy computation to unblock UI thread#55

Open
AlexSchwabauer wants to merge 1 commit intoideacreation:masterfrom
AlexSchwabauer:master
Open

Implement AsyncTask for heavy computation to unblock UI thread#55
AlexSchwabauer wants to merge 1 commit intoideacreation:masterfrom
AlexSchwabauer:master

Conversation

@AlexSchwabauer
Copy link
Copy Markdown

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
Copy Markdown

ackdav commented Sep 15, 2016

@c0b41
Copy link
Copy Markdown

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
Copy Markdown

@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
Copy Markdown
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