[camera] Expand CameraImage DTO with properties for lens aperture, exposure time and ISO. #4256
Conversation
…posure time and ISO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through the code and noticed a potential null
error which I wanted to double check.
if (lensAperture != null) { | ||
this.captureProps.setLastLensAperture(lensAperture); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick check, is the null
check on purpose? I can imagine that null
indicates the value was not available for this particular capture result and you want to communicate this back to the Dart side.
Don't you now have the risk that you communicate a (invalid) previous value with the current image?
(this question also goes for the sensorExposureTime
and sensorSensitivity
values)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the way I had it in my head, is that in case you have some frames which do not supply these values, there's a very good chance the values will have been the same as the one from the frame(s) before it. Not sure if this is actually the case, but if you have a scenario where the camera implementation only reports back these values every X frames, there wouldn't be any issues like this.
I do agree that this might be confusing and potentially unwanted behavior. I'm not sure either whether my concerns actually have any ground, so I guess it depends on if caching these values is something we want to do or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since all frames are also send to Flutter, wouldn't it be better for the developer using the camera plugin to make this decision instead of we making it for him/her?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would certainly be a simpler solution. I guess I'll just do that, if it turns out to give some trouble we can always add something like it back in later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at it now I just remembered why I implemented it this way in the first place:
These properties all have to be sent back in the handler given to imageStreamReader.setOnImageAvailableListener
.
However, I ran into the problem here that I cannot actually access the CaptureResult which contains these values here. Instead, the capture result is only available in CameraCaptureCallback
.
This is why I opted to cache these, as I don't really see any way of associating a specific Image
from the stream with a specific CaptureResult
. Associating the last known capture result sounded like the next best option.
We can still set the values back to null
so results don't get merged, so I've removed the null checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ture, exposure time and ISO. (flutter/plugins#4256)
…ture, exposure time and ISO. (flutter/plugins#4256) (#88882)
…posure time and ISO. (flutter#4256)
…posure time and ISO. (flutter#4256)
(Resubmission of #4170)
This PR adds additional properties to the CameraImage DTO:
lensAperture
sensorExposureTime
sensorSensitivity
Relevant issue:
This PR adds no breaking changes.
Pre-launch Checklist
dart format
.)[shared_preferences]
///
).