Camera.Parameters.setRecordingHint and aspect ratio
android, android-camera
Solution
You need to set `video-size` parameter to the correct value. I had the same problem - preview size was `640x480` and the preview appeared stretched while using `setRecordingHint(true)`. I then used `getParameters().flatten()` to print out all parameters set for my `Camera` device. My `video-size` parameter was actually set to `1920x1080` causing the incorrect aspect ratio. You can change this parameter using `params.set("video-size", "WxH")`. Only then is the aspect ratio correct.
Problem
I've found some odd behavior around Camera.Parameters.setRecordingHint that I'd like to understand better. If I set it to `true`, the size of the preview image can come back different from what I pass to setPreviewSize. It depends on what size I set it to-- some aspect ratios work and some don't. See the screenshots below-- `setPreviewSize` has been set to 640x480 for both, but one has setRecordingHint to `true` and the other to `false`. I have the code that produces this effect on GitHub. Is this expected behavior? The docs for setRecordingHint don't indicate anything like this.