Message ID | 20211123104042.3100902-5-paul.elder@ideasonboard.com |
---|---|
State | Superseded |
Delegated to: | Paul Elder |
Headers | show |
Series |
|
Related | show |
Quoting Paul Elder (2021-11-23 10:40:39) > The type of elements of the capability vector that is set in the static > metadata must be uint8_t. The enum will not suffice, as it is int32_t. > Fix this. > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > --- > src/android/camera_capabilities.cpp | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp > index 8484c682..875d38da 100644 > --- a/src/android/camera_capabilities.cpp > +++ b/src/android/camera_capabilities.cpp > @@ -1379,7 +1379,8 @@ int CameraCapabilities::initializeStaticMetadata() > > /* Check capabilities */ > capabilities_ = computeCapabilities(); > - std::vector<camera_metadata_enum_android_request_available_capabilities> > + /* This *must* uint8_t. */ *must* be uint8_t ... ? Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Assuming camera_metadata_enum_android_request_available_capabilities is out of our control, so we can't make it a uint8_t itself... > + std::vector<uint8_t> > capsVec(capabilities_.begin(), capabilities_.end()); > staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CAPABILITIES, capsVec); > > -- > 2.27.0 >
On Thu, Nov 25, 2021 at 11:07:09AM +0000, Kieran Bingham wrote: > Quoting Paul Elder (2021-11-23 10:40:39) > > The type of elements of the capability vector that is set in the static > > metadata must be uint8_t. The enum will not suffice, as it is int32_t. > > Fix this. > > > > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> > > --- > > src/android/camera_capabilities.cpp | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp > > index 8484c682..875d38da 100644 > > --- a/src/android/camera_capabilities.cpp > > +++ b/src/android/camera_capabilities.cpp > > @@ -1379,7 +1379,8 @@ int CameraCapabilities::initializeStaticMetadata() > > > > /* Check capabilities */ > > capabilities_ = computeCapabilities(); > > - std::vector<camera_metadata_enum_android_request_available_capabilities> > > + /* This *must* uint8_t. */ > > *must* be uint8_t ... ? *must* be uint8_t. If you use the enum type it'll be int32_t internally, which makes android not read the capabilities correctly due to, presumably, alignment. > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Assuming camera_metadata_enum_android_request_available_capabilities is > out of our control, so we can't make it a uint8_t itself... Yeah. Thanks, Paul > > > > + std::vector<uint8_t> > > capsVec(capabilities_.begin(), capabilities_.end()); > > staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CAPABILITIES, capsVec); > > > > -- > > 2.27.0 > >
diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index 8484c682..875d38da 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -1379,7 +1379,8 @@ int CameraCapabilities::initializeStaticMetadata() /* Check capabilities */ capabilities_ = computeCapabilities(); - std::vector<camera_metadata_enum_android_request_available_capabilities> + /* This *must* uint8_t. */ + std::vector<uint8_t> capsVec(capabilities_.begin(), capabilities_.end()); staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CAPABILITIES, capsVec);
The type of elements of the capability vector that is set in the static metadata must be uint8_t. The enum will not suffice, as it is int32_t. Fix this. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> --- src/android/camera_capabilities.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)