summaryrefslogtreecommitdiff
path: root/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp')
-rw-r--r--libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp b/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
index a296d205ca..1f2c51765d 100644
--- a/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
+++ b/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
@@ -440,9 +440,6 @@ ProducerQueue::ProducerQueue(const ProducerQueueConfig& config,
Status<std::vector<size_t>> ProducerQueue::AllocateBuffers(
uint32_t width, uint32_t height, uint32_t layer_count, uint32_t format,
uint64_t usage, size_t buffer_count) {
- if (buffer_count == 0) {
- return {};
- }
if (capacity() + buffer_count > kMaxQueueCapacity) {
ALOGE(
"ProducerQueue::AllocateBuffers: queue is at capacity: %zu, cannot "
@@ -484,13 +481,10 @@ Status<std::vector<size_t>> ProducerQueue::AllocateBuffers(
}
}
- if (buffer_slots.size() != buffer_count) {
- // Error out if the count of allocated/imported buffer(s) is not correct.
- ALOGE(
- "ProducerQueue::AllocateBuffers: requested to import %zu "
- "buffers, but actually imported %zu buffers.",
- buffer_count, buffer_slots.size());
- return ErrorStatus(ENOMEM);
+ if (buffer_slots.size() == 0) {
+ // Error out if no buffer is allocated and improted.
+ ALOGE_IF(TRACE, "ProducerQueue::AllocateBuffers: no buffer allocated.");
+ ErrorStatus(ENOMEM);
}
return {std::move(buffer_slots)};
@@ -508,6 +502,12 @@ Status<size_t> ProducerQueue::AllocateBuffer(uint32_t width, uint32_t height,
status.GetErrorMessage().c_str());
return status.error_status();
}
+
+ if (status.get().size() == 0) {
+ ALOGE_IF(TRACE, "ProducerQueue::AllocateBuffer: no buffer allocated.");
+ ErrorStatus(ENOMEM);
+ }
+
return {status.get()[0]};
}