converter: converter_v4l2_m2m: Rectify streams sanity check
The streams sanity check tries to determine if all the stream indexes passed in outputs std::map<> are unique. However, since the data container is std::map<>, all its keys (stream indexes in this case), are already unique. Instead, rectify the sanity check to ensure all the framebuffers passed in the outputs std::map<> are unique to each index. Hence, no two stream indexes should have same framebuffer. Update the comment to reflect the change. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
parent
e3310749f5
commit
67b24d2c4e
1 changed files with 6 additions and 5 deletions
|
@ -403,13 +403,13 @@ void V4L2M2MConverter::stop()
|
||||||
int V4L2M2MConverter::queueBuffers(FrameBuffer *input,
|
int V4L2M2MConverter::queueBuffers(FrameBuffer *input,
|
||||||
const std::map<unsigned int, FrameBuffer *> &outputs)
|
const std::map<unsigned int, FrameBuffer *> &outputs)
|
||||||
{
|
{
|
||||||
unsigned int mask = 0;
|
std::set<FrameBuffer *> outputBufs;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate the outputs as a sanity check: at least one output is
|
* Validate the outputs as a sanity check: at least one output is
|
||||||
* required, all outputs must reference a valid stream and no two
|
* required, all outputs must reference a valid stream and no two
|
||||||
* outputs can reference the same stream.
|
* streams can reference same output framebuffers.
|
||||||
*/
|
*/
|
||||||
if (outputs.empty())
|
if (outputs.empty())
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -419,12 +419,13 @@ int V4L2M2MConverter::queueBuffers(FrameBuffer *input,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (index >= streams_.size())
|
if (index >= streams_.size())
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (mask & (1 << index))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
mask |= 1 << index;
|
outputBufs.insert(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (outputBufs.size() != streams_.size())
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
/* Queue the input and output buffers to all the streams. */
|
/* Queue the input and output buffers to all the streams. */
|
||||||
for (auto [index, buffer] : outputs) {
|
for (auto [index, buffer] : outputs) {
|
||||||
ret = streams_[index].queueBuffers(input, buffer);
|
ret = streams_[index].queueBuffers(input, buffer);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue