apps: lc-compliance: Don't allocate FrameBufferAllocator
dynamically
There is no reason to do so. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
parent
d8645b5f67
commit
1f02966f3f
2 changed files with 7 additions and 7 deletions
|
@ -13,7 +13,7 @@ using namespace libcamera;
|
||||||
|
|
||||||
Capture::Capture(std::shared_ptr<Camera> camera)
|
Capture::Capture(std::shared_ptr<Camera> camera)
|
||||||
: loop_(nullptr), camera_(std::move(camera)),
|
: loop_(nullptr), camera_(std::move(camera)),
|
||||||
allocator_(std::make_unique<FrameBufferAllocator>(camera_))
|
allocator_(camera_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ void Capture::configure(StreamRole role)
|
||||||
void Capture::start()
|
void Capture::start()
|
||||||
{
|
{
|
||||||
Stream *stream = config_->at(0).stream();
|
Stream *stream = config_->at(0).stream();
|
||||||
int count = allocator_->allocate(stream);
|
int count = allocator_.allocate(stream);
|
||||||
|
|
||||||
ASSERT_GE(count, 0) << "Failed to allocate buffers";
|
ASSERT_GE(count, 0) << "Failed to allocate buffers";
|
||||||
EXPECT_EQ(count, config_->at(0).bufferCount) << "Allocated less buffers than expected";
|
EXPECT_EQ(count, config_->at(0).bufferCount) << "Allocated less buffers than expected";
|
||||||
|
@ -57,7 +57,7 @@ void Capture::start()
|
||||||
|
|
||||||
void Capture::stop()
|
void Capture::stop()
|
||||||
{
|
{
|
||||||
if (!config_ || !allocator_->allocated())
|
if (!config_ || !allocator_.allocated())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
camera_->stop();
|
camera_->stop();
|
||||||
|
@ -66,7 +66,7 @@ void Capture::stop()
|
||||||
|
|
||||||
Stream *stream = config_->at(0).stream();
|
Stream *stream = config_->at(0).stream();
|
||||||
requests_.clear();
|
requests_.clear();
|
||||||
allocator_->free(stream);
|
allocator_.free(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CaptureBalanced */
|
/* CaptureBalanced */
|
||||||
|
@ -81,7 +81,7 @@ void CaptureBalanced::capture(unsigned int numRequests)
|
||||||
start();
|
start();
|
||||||
|
|
||||||
Stream *stream = config_->at(0).stream();
|
Stream *stream = config_->at(0).stream();
|
||||||
const std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator_->buffers(stream);
|
const std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator_.buffers(stream);
|
||||||
|
|
||||||
/* No point in testing less requests then the camera depth. */
|
/* No point in testing less requests then the camera depth. */
|
||||||
if (buffers.size() > numRequests) {
|
if (buffers.size() > numRequests) {
|
||||||
|
@ -153,7 +153,7 @@ void CaptureUnbalanced::capture(unsigned int numRequests)
|
||||||
start();
|
start();
|
||||||
|
|
||||||
Stream *stream = config_->at(0).stream();
|
Stream *stream = config_->at(0).stream();
|
||||||
const std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator_->buffers(stream);
|
const std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator_.buffers(stream);
|
||||||
|
|
||||||
captureCount_ = 0;
|
captureCount_ = 0;
|
||||||
captureLimit_ = numRequests;
|
captureLimit_ = numRequests;
|
||||||
|
|
|
@ -30,7 +30,7 @@ protected:
|
||||||
EventLoop *loop_;
|
EventLoop *loop_;
|
||||||
|
|
||||||
std::shared_ptr<libcamera::Camera> camera_;
|
std::shared_ptr<libcamera::Camera> camera_;
|
||||||
std::unique_ptr<libcamera::FrameBufferAllocator> allocator_;
|
libcamera::FrameBufferAllocator allocator_;
|
||||||
std::unique_ptr<libcamera::CameraConfiguration> config_;
|
std::unique_ptr<libcamera::CameraConfiguration> config_;
|
||||||
std::vector<std::unique_ptr<libcamera::Request>> requests_;
|
std::vector<std::unique_ptr<libcamera::Request>> requests_;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue