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

Preview Distortion when toggling BACK / FRONT #16

Closed
nonstoplm opened this issue Aug 30, 2017 · 13 comments
Closed

Preview Distortion when toggling BACK / FRONT #16

nonstoplm opened this issue Aug 30, 2017 · 13 comments

Comments

@nonstoplm
Copy link

preview distortion when camera toggle BACK / FRONT.

@UGhari
Copy link

UGhari commented Aug 30, 2017

You will need to give a lot more information than that to debug the problem. Log outputs if possible, model of device, what steps are you taking before this happens.

@natario1
Copy link
Owner

natario1 commented Sep 4, 2017

@nonstoplm can you provide more information? I can not reproduce this.

Are you testing on a tablet? Which device? Is BACK always good while FRONT is distorted, or what? Which steps are you taking and when do you start seeing the issue?

@natario1 natario1 changed the title Preview Distortion Preview Distortion when toggling BACK / FRONT Sep 4, 2017
@devalticode
Copy link

Hi,
I have same issue on Galaxy J5 (SM-J500H).
I set video quality is MAX720p -> Change device orientation + toogle camera facing BACK/FRONT -> issue occurs.
Please help to fix.

@natario1
Copy link
Owner

natario1 commented Sep 8, 2017

@devalticode are you using latest version?

@devalticode
Copy link

Yes, I did.
Can you please check my layout ?

activity_camera.zip

@Johnson145
Copy link
Contributor

Johnson145 commented Sep 27, 2017

I got an error fitting to this issue.

The crucial steps to reproduce seem to be:

  • cameraView.setSessionType(SessionType.VIDEO)
  • front camera
  • at least one cameraview dimension is using match_parent constraint
  • cameraView.setVideoQuality(VideoQuality.MAX_720P); // anything except the default MAX_480P

Toggling itself does not seem to affect it. It's always the front camera, even if I start it directly in that mode. The back camera is just fine. Furthermore, it's only about the preview. The captured image / video is all good. In my case, distorted means stretched horizontally.

Changing to cameraView.setSessionType(SessionType.PICTURE) solves the permanent distortion. Instead there is a temporary distortion whenever the camera is toggled. The image is static and stretched for about a second. Afterwards, everything is fine again. So the picture mode is actually working better.

If I set both dimensions to wrap_content, the distortions are gone, too. Of course this is in favor of blank space around the preview.

Tested on a Samsung Galaxy S6 Edge using commit cf3bfc1.

Any specific log parts that could help? Right now I don't see anything obvious.

Update:
Setting the maximum video quality to anything else except the default 480p seems to be crucial, too. If I use the default value again, everything works as expected, although the other settings are unchanged.

@natario1
Copy link
Owner

@Johnson145 thanks. Does this happen with the demo app? Can you start the app directly with the buggy parameters (sessionType = video, dim = match_parent, facing = front) and post logs?

You can post all, we are interested in anything related to size: and onMeasure:, possibly something else

@Johnson145
Copy link
Contributor

In order to reproduce the described behavior in your demo app, I need to change the surrounding ScrollView to a LinearLayout. When using the former, the chosen preview is bigger than the screen and I need to scroll to see everything, but nothing is distorted. Switching to the LinearLayout while keeping the other parameters, compresses the preview in height. The latter seems to be the same distortion as I experience in my app. Furthermore, your demo app gets a black bar simliar to the one in #41 (probably I would see the same bar in my app if I had more space).

This is the full log.

@natario1
Copy link
Owner

@Johnson145 thanks again, I hope we can sort this out. camera.isHardwareAccelerated() returns false, right?

@Johnson145
Copy link
Contributor

Yes, it does.

@natario1
Copy link
Owner

Can you guys check now? Demo app has changed and also a bug was fixed.

@Johnson145
Copy link
Contributor

Looks good! In the demo app as well as in my own app! Thanks for the changes.

@natario1
Copy link
Owner

Ok, closing this, feel free to reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants