Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

[BUG] Screen Lag every second #19

Closed
TurKurT656 opened this issue Aug 21, 2019 · 9 comments
Closed

[BUG] Screen Lag every second #19

TurKurT656 opened this issue Aug 21, 2019 · 9 comments
Labels
bug Something isn't working

Comments

@TurKurT656
Copy link

Describe the bug
First of TnQ for this great lib. its simple and completely a clean solution.
However There i an annoying bug. When camera shows up screen lags periodically every second. I think the problem is that you are processing bitmap on the main thread and when the device config is weak this bug happens.

To Reproduce
Run this lib on the mid level devices

Expected behavior
Camera must work without lag and calculating and processing must be in background thread

Smartphone (please complete the following information):

  • Device: [Samsung Galaxy J5]
  • OS: [Android 28]
  • Version [1.0.3]
@TurKurT656 TurKurT656 added the bug Something isn't working label Aug 21, 2019
@alistairsykes
Copy link
Contributor

Hi @TurKurT656. Your welcome!

Is there a particular block of code which makes you think the lib is processing bitmaps on the main thread?
Does everything still work, you're just getting lag?
Have you tried on any other "mid level" devices?

I admit it's been a little while since being deep in this code, but I thought I had made everything threaded correctly.

@TurKurT656
Copy link
Author

no, i double checked everything. yes everything works fine but with lag (almost every 2sec)
yes it lags on some devices (mid level and high level).

@TurKurT656
Copy link
Author

i found the problem:
app:formats="data" it lags on "data" and "all" mode

@alistairsykes
Copy link
Contributor

I think I have identified that this line is causing some dropped frames:
FirebaseVisionImage.fromMediaImage(image, frameMetadata.rotation) from VisionImageProcessorSingleBase.convertToVisionImage()

It appears that on some devices this call can be quite intensive and therefore cause jumps. I will have a think about a solution.

@alistairsykes
Copy link
Contributor

I have attempted a solution on this branch: https://github.com/brightec/KBarcode/tree/fix/Lag.

I add Kotlin Coroutines as a dependency in order to aid with the threading. And then made FirebaseVisionImage.fromMediaImage(image, frameMetadata.rotation) run on a background thread.

@TurKurT656 Fancy taking a look and seeing if this performs better on your devices too?

@alistairsykes alistairsykes self-assigned this Sep 16, 2019
@TurKurT656
Copy link
Author

@alistairsykes Ok i will test application with this branch and see if lag problem fixed.

@alistairsykes
Copy link
Contributor

Closing for inactivity. Hopefully that did solve your issue.

@alistairsykes alistairsykes removed their assignment Oct 15, 2019
@TurKurT656
Copy link
Author

srry for the delay, yes it is fixed on this version

@alistairsykes
Copy link
Contributor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants