Git Product home page Git Product logo

Comments (7)

ThibaultBee avatar ThibaultBee commented on July 23, 2024

Oh nice one.
Could you provide the full exception?

Now I wonder, what will be the best answer to this issue.
Should we clamp focus rectangle >= 0?
Or should we cancel focus when we detect the issue?
Or somehow synchronize everything?

from streampack.

cdiddy77 avatar cdiddy77 commented on July 23, 2024

The relevant exception stack trace:

"main@15148" prio=5 tid=0x2 nid=NA runnable
  java.lang.Thread.State: RUNNABLE
	  at com.android.internal.util.Preconditions.checkArgumentNonnegative(Preconditions.java:324)
	  at android.hardware.camera2.params.MeteringRectangle.<init>(MeteringRectangle.java:138)
	  at io.github.thibaultbee.streampack.utils.FocusMetering$Companion.getMeteringRect(CameraSettings.kt:982)
	  at io.github.thibaultbee.streampack.utils.FocusMetering$Companion.getMeteringRectangles(CameraSettings.kt:926)
	  at io.github.thibaultbee.streampack.utils.FocusMetering$Companion.access$getMeteringRectangles(CameraSettings.kt:848)
	  at io.github.thibaultbee.streampack.utils.FocusMetering.startFocusAndMetering(CameraSettings.kt:719)
	  at io.github.thibaultbee.streampack.utils.FocusMetering.onTap(CameraSettings.kt:816)
	  at io.github.thibaultbee.streampack.views.PreviewView.performClick(PreviewView.kt:144)
	  at io.github.thibaultbee.streampack.views.PreviewView.onTouchEvent(PreviewView.kt:129)
	  at android.view.View.dispatchTouchEvent(View.java:16212)

Great question, I guess in the best of all worlds it would "just work" but that seems difficult. And also, in my specific case on an S22, what's happening under the covers, I believe, is that the camera is automatically switching to the wide-angle lens, which, on my device, is a fixed-field lens and thus, no focusing is possible.

I don't really see a clear best option, but I am certainly no expert. On my device, simply canceling the focus would be fine, since the fixed lens can't focus anyway. In any case you could argue that this is both easy and reasonable. I guess the second choice would be clamping. If it were me, I would cancel and log a message that leads the developer to understand that if they want, they could clamp it themselves.

from streampack.

ThibaultBee avatar ThibaultBee commented on July 23, 2024

I tried to reproduce this issue in the demo but I could not.
Does it happen when you zoom in or is it just when you zoom out? Have you changed something in the code?
I didn't know it was possible to have zoom < 1.

Unfortunately I don't have a device to test this.

Could you add log in the FocusMetering class? Could you also log availableRatioRange and everything you find usefull?

from streampack.

ThibaultBee avatar ThibaultBee commented on July 23, 2024

Could you test #98?

from streampack.

cdiddy77 avatar cdiddy77 commented on July 23, 2024

It does not crash when I zoom out, and there is lots of

2024-02-06 14:19:03.044  6781-6781  ViewRootIm...nActivity] io....thibaultbee.streampack.sample  I  ViewPostIme pointer 1
2024-02-06 14:19:03.056  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  cropRegion: Rect(0, 0 - 4080, 3060)
2024-02-06 14:19:03.056  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  adjustedPoint: PointF(0.6418467, 0.423781)
2024-02-06 14:19:03.056  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  size: 0.16666667
2024-02-06 14:19:03.056  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  centerX: 2618 - centerY: 1296
2024-02-06 14:19:03.056  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  width: 680.0 - height: 510.0
2024-02-06 14:19:03.057  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  focusRect1: Rect(2278, 1041 - 2958, 1551)
2024-02-06 14:19:03.057  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  focusRect2: Rect(2278, 1041 - 2958, 1551)
2024-02-06 14:19:03.057  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  cropRegion: Rect(0, 0 - 4080, 3060)
2024-02-06 14:19:03.057  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  adjustedPoint: PointF(0.6418467, 0.423781)
2024-02-06 14:19:03.057  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  size: 0.25
2024-02-06 14:19:03.057  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  centerX: 2618 - centerY: 1296
2024-02-06 14:19:03.057  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  width: 1020.0 - height: 765.0
2024-02-06 14:19:03.058  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  focusRect1: Rect(2108, 913 - 3128, 1678)
2024-02-06 14:19:03.058  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  focusRect2: Rect(2108, 913 - 3128, 1678)
2024-02-06 14:19:03.206  6781-6781  GestureDetector         io....thibaultbee.streampack.sample  I  handleMessage TAP

When I tap outside of the 1x zoom rectangle, I see:

2024-02-06 14:21:13.480  6781-6781  ViewRootIm...nActivity] io....thibaultbee.streampack.sample  I  ViewPostIme pointer 1
2024-02-06 14:21:13.493  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  cropRegion: Rect(0, 0 - 4080, 3060)
2024-02-06 14:21:13.493  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  adjustedPoint: PointF(0.013833943, 0.6899047)
2024-02-06 14:21:13.493  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  size: 0.16666667
2024-02-06 14:21:13.493  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  centerX: 56 - centerY: 2111
2024-02-06 14:21:13.494  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  width: 680.0 - height: 510.0
2024-02-06 14:21:13.494  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  focusRect1: Rect(-284, 1856 - 396, 2366)
2024-02-06 14:21:13.494  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  focusRect2: Rect(0, 1856 - 396, 2366)
2024-02-06 14:21:13.494  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  cropRegion: Rect(0, 0 - 4080, 3060)
2024-02-06 14:21:13.495  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  adjustedPoint: PointF(0.013833943, 0.6899047)
2024-02-06 14:21:13.495  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  size: 0.25
2024-02-06 14:21:13.495  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  centerX: 56 - centerY: 2111
2024-02-06 14:21:13.495  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  width: 1020.0 - height: 765.0
2024-02-06 14:21:13.495  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  focusRect1: Rect(-454, 1728 - 566, 2493)
2024-02-06 14:21:13.495  6781-6781  >>TEST                  io....thibaultbee.streampack.sample  E  focusRect2: Rect(0, 1728 - 566, 2493)
2024-02-06 14:21:16.767  6781-6781  ViewRootIm...nActivity] io....thibaultbee.streampack.sample  I  onDisplayChanged oldDisplayState=2 newDisplayState=2

from streampack.

ThibaultBee avatar ThibaultBee commented on July 23, 2024

Logs were unintentional.
I just removed them.

from streampack.

ThibaultBee avatar ThibaultBee commented on July 23, 2024

Released in 2.6.0

from streampack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.