diff options
-rw-r--r-- | src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 5 | ||||
-rw-r--r-- | src/libcamera/pipeline/raspberrypi/rpi_stream.cpp | 13 | ||||
-rw-r--r-- | src/libcamera/pipeline/raspberrypi/rpi_stream.h | 2 |
3 files changed, 11 insertions, 9 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 92043962..8fd79be6 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -693,7 +693,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) /* Start by freeing all buffers and reset the Unicam and ISP stream states. */ data->freeBuffers(); for (auto const stream : data->streams_) - stream->reset(); + stream->setExternal(false); BayerFormat::Packing packing = BayerFormat::Packing::CSI2; Size maxSize, sensorSize; @@ -991,6 +991,9 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) RPiCameraData *data = cameraData(camera); int ret; + for (auto const stream : data->streams_) + stream->resetBuffers(); + if (!data->buffersAllocated_) { /* Allocate buffers for internal pipeline usage. */ ret = prepareBuffers(camera); diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp index f446e1ce..7a93efaa 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp @@ -26,10 +26,12 @@ std::string Stream::name() const return name_; } -void Stream::reset() +void Stream::resetBuffers() { - external_ = false; - clearBuffers(); + /* Add all internal buffers to the queue of usable buffers. */ + availableBuffers_ = {}; + for (auto const &buffer : internalBuffers_) + availableBuffers_.push(buffer.get()); } void Stream::setExternal(bool external) @@ -97,10 +99,7 @@ int Stream::prepareBuffers(unsigned int count) /* Add these exported buffers to the internal/external buffer list. */ setExportedBuffers(&internalBuffers_); - - /* Add these buffers to the queue of internal usable buffers. */ - for (auto const &buffer : internalBuffers_) - availableBuffers_.push(buffer.get()); + resetBuffers(); } /* We must import all internal/external exported buffers. */ diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.h b/src/libcamera/pipeline/raspberrypi/rpi_stream.h index d6f49d34..c37f7e82 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.h +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.h @@ -45,7 +45,7 @@ public: V4L2VideoDevice *dev() const; std::string name() const; bool isImporter() const; - void reset(); + void resetBuffers(); void setExternal(bool external); bool isExternal() const; |