libcamera: Stop using Stream::bufferPool to get the number of buffers

The cam and qcam applications, as well as the camera capture test case,
access the Stream::bufferPool in order to know how many requests to
initially queue. As part of an effort to remove access to the buffer
pool from applications, use the buffer count from the stream
configuration instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2019-07-12 15:15:48 +03:00
parent 4cb78e712c
commit 5085bc03bc
3 changed files with 4 additions and 8 deletions

View file

@ -74,10 +74,8 @@ int Capture::capture(EventLoop *loop)
/* Identify the stream with the least number of buffers. */
unsigned int nbuffers = UINT_MAX;
for (StreamConfiguration &cfg : *config_) {
Stream *stream = cfg.stream();
nbuffers = std::min(nbuffers, stream->bufferPool().count());
}
for (StreamConfiguration &cfg : *config_)
nbuffers = std::min(nbuffers, cfg.bufferCount);
/*
* TODO: make cam tool smarter to support still capture by for

View file

@ -140,9 +140,8 @@ int MainWindow::startCapture()
return ret;
}
BufferPool &pool = stream->bufferPool();
std::vector<Request *> requests;
for (unsigned int i = 0; i < pool.count(); ++i) {
for (unsigned int i = 0; i < cfg.bufferCount; ++i) {
Request *request = camera_->createRequest();
if (!request) {
std::cerr << "Can't create request" << std::endl;

View file

@ -80,9 +80,8 @@ protected:
}
Stream *stream = cfg.stream();
BufferPool &pool = stream->bufferPool();
std::vector<Request *> requests;
for (unsigned int i = 0; i < pool.count(); ++i) {
for (unsigned int i = 0; i < cfg.bufferCount; ++i) {
Request *request = camera_->createRequest();
if (!request) {
cout << "Failed to create request" << endl;