blob: 99b3ba8cbee1cbb97797f195ebc51212bd10e6cd [file] [log] [blame]
Zhijun He125684a2015-12-26 15:07:30 -08001/*
2 * Copyright 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//#define LOG_NDEBUG 0
18#define LOG_TAG "Camera3-BufferManager"
19#define ATRACE_TAG ATRACE_TAG_CAMERA
20
21#include <gui/ISurfaceComposer.h>
22#include <private/gui/ComposerService.h>
23#include <utils/Log.h>
24#include <utils/Trace.h>
25#include "utils/CameraTraces.h"
26#include "Camera3BufferManager.h"
27
28namespace android {
29
30namespace camera3 {
31
Mathias Agopian2752e5b2017-02-27 18:26:48 -080032Camera3BufferManager::Camera3BufferManager() {
Zhijun He125684a2015-12-26 15:07:30 -080033}
34
35Camera3BufferManager::~Camera3BufferManager() {
36}
37
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -070038status_t Camera3BufferManager::registerStream(wp<Camera3OutputStream>& stream,
39 const StreamInfo& streamInfo) {
Zhijun He125684a2015-12-26 15:07:30 -080040 ATRACE_CALL();
41
42 int streamId = streamInfo.streamId;
43 int streamSetId = streamInfo.streamSetId;
44
45 if (streamId == CAMERA3_STREAM_ID_INVALID || streamSetId == CAMERA3_STREAM_SET_ID_INVALID) {
46 ALOGE("%s: Stream id (%d) or stream set id (%d) is invalid",
47 __FUNCTION__, streamId, streamSetId);
48 return BAD_VALUE;
49 }
50 if (streamInfo.totalBufferCount > kMaxBufferCount || streamInfo.totalBufferCount == 0) {
51 ALOGE("%s: Stream id (%d) with stream set id (%d) total buffer count %zu is invalid",
52 __FUNCTION__, streamId, streamSetId, streamInfo.totalBufferCount);
53 return BAD_VALUE;
54 }
55 if (!streamInfo.isConfigured) {
56 ALOGE("%s: Stream (%d) is not configured", __FUNCTION__, streamId);
57 return BAD_VALUE;
58 }
59
60 // For Gralloc v1, try to allocate a buffer and see if it is successful, otherwise, stream
61 // buffer sharing for this newly added stream is not supported. For Gralloc v0, we don't
62 // need check this, as the buffers are not really shared between streams, the buffers are
63 // allocated for each stream individually, the allocation failure will be checked in
64 // getBufferForStream() call.
65 if (mGrallocVersion > HARDWARE_DEVICE_API_VERSION(0,1)) {
66 // TODO: To be implemented.
67
68 // In case allocation fails, return invalid operation
69 return INVALID_OPERATION;
70 }
71
72 Mutex::Autolock l(mLock);
Zhijun He125684a2015-12-26 15:07:30 -080073
74 // Check if this stream was registered with different stream set ID, if so, error out.
75 for (size_t i = 0; i < mStreamSetMap.size(); i++) {
76 ssize_t streamIdx = mStreamSetMap[i].streamInfoMap.indexOfKey(streamId);
77 if (streamIdx != NAME_NOT_FOUND &&
78 mStreamSetMap[i].streamInfoMap[streamIdx].streamSetId != streamInfo.streamSetId) {
79 ALOGE("%s: It is illegal to register the same stream id with different stream set",
80 __FUNCTION__);
81 return BAD_VALUE;
82 }
83 }
84 // Check if there is an existing stream set registered; if not, create one; otherwise, add this
85 // stream info to the existing stream set entry.
86 ssize_t setIdx = mStreamSetMap.indexOfKey(streamSetId);
87 if (setIdx == NAME_NOT_FOUND) {
88 ALOGV("%s: stream set %d is not registered to stream set map yet, create it.",
89 __FUNCTION__, streamSetId);
90 // Create stream info map, then add to mStreamsetMap.
91 StreamSet newStreamSet;
92 setIdx = mStreamSetMap.add(streamSetId, newStreamSet);
93 }
94 // Update stream set map and water mark.
95 StreamSet& currentStreamSet = mStreamSetMap.editValueAt(setIdx);
96 ssize_t streamIdx = currentStreamSet.streamInfoMap.indexOfKey(streamId);
97 if (streamIdx != NAME_NOT_FOUND) {
98 ALOGW("%s: stream %d was already registered with stream set %d",
99 __FUNCTION__, streamId, streamSetId);
100 return OK;
101 }
102 currentStreamSet.streamInfoMap.add(streamId, streamInfo);
103 currentStreamSet.handoutBufferCountMap.add(streamId, 0);
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700104 currentStreamSet.attachedBufferCountMap.add(streamId, 0);
105 mStreamMap.add(streamId, stream);
Zhijun He125684a2015-12-26 15:07:30 -0800106
Zhijun He8d1a1542016-01-29 20:28:21 -0800107 // The max allowed buffer count should be the max of buffer count of each stream inside a stream
108 // set.
109 if (streamInfo.totalBufferCount > currentStreamSet.maxAllowedBufferCount) {
110 currentStreamSet.maxAllowedBufferCount = streamInfo.totalBufferCount;
Zhijun He125684a2015-12-26 15:07:30 -0800111 }
112
113 return OK;
114}
115
116status_t Camera3BufferManager::unregisterStream(int streamId, int streamSetId) {
117 ATRACE_CALL();
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700118
Zhijun He125684a2015-12-26 15:07:30 -0800119 Mutex::Autolock l(mLock);
120 ALOGV("%s: unregister stream %d with stream set %d", __FUNCTION__,
121 streamId, streamSetId);
Zhijun He125684a2015-12-26 15:07:30 -0800122
123 if (!checkIfStreamRegisteredLocked(streamId, streamSetId)){
124 ALOGE("%s: stream %d with set id %d wasn't properly registered to this buffer manager!",
125 __FUNCTION__, streamId, streamSetId);
126 return BAD_VALUE;
127 }
128
129 // De-list all the buffers associated with this stream first.
130 StreamSet& currentSet = mStreamSetMap.editValueFor(streamSetId);
Zhijun He125684a2015-12-26 15:07:30 -0800131 BufferCountMap& handOutBufferCounts = currentSet.handoutBufferCountMap;
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700132 BufferCountMap& attachedBufferCounts = currentSet.attachedBufferCountMap;
Zhijun He125684a2015-12-26 15:07:30 -0800133 InfoMap& infoMap = currentSet.streamInfoMap;
Zhijun He125684a2015-12-26 15:07:30 -0800134 handOutBufferCounts.removeItem(streamId);
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700135 attachedBufferCounts.removeItem(streamId);
Zhijun He125684a2015-12-26 15:07:30 -0800136
137 // Remove the stream info from info map and recalculate the buffer count water mark.
138 infoMap.removeItem(streamId);
Zhijun He8d1a1542016-01-29 20:28:21 -0800139 currentSet.maxAllowedBufferCount = 0;
Zhijun He125684a2015-12-26 15:07:30 -0800140 for (size_t i = 0; i < infoMap.size(); i++) {
Zhijun He8d1a1542016-01-29 20:28:21 -0800141 if (infoMap[i].totalBufferCount > currentSet.maxAllowedBufferCount) {
142 currentSet.maxAllowedBufferCount = infoMap[i].totalBufferCount;
Zhijun He125684a2015-12-26 15:07:30 -0800143 }
144 }
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700145 mStreamMap.removeItem(streamId);
146
Zhijun He8d1a1542016-01-29 20:28:21 -0800147 // Lazy solution: when a stream is unregistered, the streams will be reconfigured, reset
148 // the water mark and let it grow again.
149 currentSet.allocatedBufferWaterMark = 0;
Zhijun He125684a2015-12-26 15:07:30 -0800150
151 // Remove this stream set if all its streams have been removed.
Shuzhen Wangfd76cf52017-05-15 10:01:04 -0700152 if (handOutBufferCounts.size() == 0 && infoMap.size() == 0) {
Zhijun He125684a2015-12-26 15:07:30 -0800153 mStreamSetMap.removeItem(streamSetId);
154 }
155
156 return OK;
157}
158
159status_t Camera3BufferManager::getBufferForStream(int streamId, int streamSetId,
160 sp<GraphicBuffer>* gb, int* fenceFd) {
161 ATRACE_CALL();
162
163 Mutex::Autolock l(mLock);
164 ALOGV("%s: get buffer for stream %d with stream set %d", __FUNCTION__,
165 streamId, streamSetId);
Zhijun He125684a2015-12-26 15:07:30 -0800166
167 if (!checkIfStreamRegisteredLocked(streamId, streamSetId)) {
168 ALOGE("%s: stream %d is not registered with stream set %d yet!!!",
169 __FUNCTION__, streamId, streamSetId);
170 return BAD_VALUE;
171 }
172
173 StreamSet &streamSet = mStreamSetMap.editValueFor(streamSetId);
Zhijun He8d1a1542016-01-29 20:28:21 -0800174 BufferCountMap& handOutBufferCounts = streamSet.handoutBufferCountMap;
175 size_t& bufferCount = handOutBufferCounts.editValueFor(streamId);
176 if (bufferCount >= streamSet.maxAllowedBufferCount) {
177 ALOGE("%s: bufferCount (%zu) exceeds the max allowed buffer count (%zu) of this stream set",
178 __FUNCTION__, bufferCount, streamSet.maxAllowedBufferCount);
179 return INVALID_OPERATION;
180 }
181
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700182 BufferCountMap& attachedBufferCounts = streamSet.attachedBufferCountMap;
183 size_t& attachedBufferCount = attachedBufferCounts.editValueFor(streamId);
184 if (attachedBufferCount > bufferCount) {
185 // We've already attached more buffers to this stream than we currently have
186 // outstanding, so have the stream just use an already-attached buffer
187 bufferCount++;
188 return ALREADY_EXISTS;
189 }
190 ALOGV("Stream %d set %d: Get buffer for stream: Allocate new", streamId, streamSetId);
191
Zhijun He125684a2015-12-26 15:07:30 -0800192 if (mGrallocVersion < HARDWARE_DEVICE_API_VERSION(1,0)) {
Shuzhen Wangfd76cf52017-05-15 10:01:04 -0700193 const StreamInfo& info = streamSet.streamInfoMap.valueFor(streamId);
194 GraphicBufferEntry buffer;
195 buffer.fenceFd = -1;
196 buffer.graphicBuffer = new GraphicBuffer(
197 info.width, info.height, PixelFormat(info.format), info.combinedUsage,
198 std::string("Camera3BufferManager pid [") +
199 std::to_string(getpid()) + "]");
200 status_t res = buffer.graphicBuffer->initCheck();
Mathias Agopian2752e5b2017-02-27 18:26:48 -0800201
Shuzhen Wangfd76cf52017-05-15 10:01:04 -0700202 ALOGV("%s: allocating a new graphic buffer (%dx%d, format 0x%x) %p with handle %p",
203 __FUNCTION__, info.width, info.height, info.format,
204 buffer.graphicBuffer.get(), buffer.graphicBuffer->handle);
205 if (res < 0) {
206 ALOGE("%s: graphic buffer allocation failed: (error %d %s) ",
207 __FUNCTION__, res, strerror(-res));
208 return res;
Zhijun He125684a2015-12-26 15:07:30 -0800209 }
Shuzhen Wangfd76cf52017-05-15 10:01:04 -0700210 ALOGV("%s: allocation done", __FUNCTION__);
Zhijun He125684a2015-12-26 15:07:30 -0800211
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700212 // Increase the hand-out and attached buffer counts for tracking purposes.
Zhijun He125684a2015-12-26 15:07:30 -0800213 bufferCount++;
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700214 attachedBufferCount++;
Zhijun He80fa6192016-02-08 12:02:25 -0800215 // Update the water mark to be the max hand-out buffer count + 1. An additional buffer is
216 // added to reduce the chance of buffer allocation during stream steady state, especially
217 // for cases where one stream is active, the other stream may request some buffers randomly.
218 if (bufferCount + 1 > streamSet.allocatedBufferWaterMark) {
219 streamSet.allocatedBufferWaterMark = bufferCount + 1;
Zhijun He8d1a1542016-01-29 20:28:21 -0800220 }
Zhijun He125684a2015-12-26 15:07:30 -0800221 *gb = buffer.graphicBuffer;
222 *fenceFd = buffer.fenceFd;
223 ALOGV("%s: get buffer (%p) with handle (%p).",
224 __FUNCTION__, buffer.graphicBuffer.get(), buffer.graphicBuffer->handle);
225
226 // Proactively free buffers for other streams if the current number of allocated buffers
227 // exceeds the water mark. This only for Gralloc V1, for V2, this logic can also be handled
228 // in returnBufferForStream() if we want to free buffer more quickly.
229 // TODO: probably should find out all the inactive stream IDs, and free the firstly found
230 // buffers for them.
231 StreamId firstOtherStreamId = CAMERA3_STREAM_ID_INVALID;
232 if (streamSet.streamInfoMap.size() > 1) {
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700233 bool freeBufferIsAttached = false;
Zhijun He125684a2015-12-26 15:07:30 -0800234 for (size_t i = 0; i < streamSet.streamInfoMap.size(); i++) {
235 firstOtherStreamId = streamSet.streamInfoMap[i].streamId;
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700236 if (firstOtherStreamId != streamId) {
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700237 size_t otherBufferCount =
238 streamSet.handoutBufferCountMap.valueFor(firstOtherStreamId);
239 size_t otherAttachedBufferCount =
240 streamSet.attachedBufferCountMap.valueFor(firstOtherStreamId);
241 if (otherAttachedBufferCount > otherBufferCount) {
242 freeBufferIsAttached = true;
243 break;
244 }
Zhijun He125684a2015-12-26 15:07:30 -0800245 }
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700246 firstOtherStreamId = CAMERA3_STREAM_ID_INVALID;
Zhijun He125684a2015-12-26 15:07:30 -0800247 }
248 if (firstOtherStreamId == CAMERA3_STREAM_ID_INVALID) {
249 return OK;
250 }
251
252 // This will drop the reference to one free buffer, which will effectively free one
Shuzhen Wangfd76cf52017-05-15 10:01:04 -0700253 // buffer for the inactive streams.
254 size_t totalAllocatedBufferCount = 0;
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700255 for (size_t i = 0; i < streamSet.attachedBufferCountMap.size(); i++) {
256 totalAllocatedBufferCount += streamSet.attachedBufferCountMap[i];
Zhijun He125684a2015-12-26 15:07:30 -0800257 }
258 if (totalAllocatedBufferCount > streamSet.allocatedBufferWaterMark) {
Zhijun He80fa6192016-02-08 12:02:25 -0800259 ALOGV("%s: free a buffer from stream %d", __FUNCTION__, firstOtherStreamId);
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700260 if (freeBufferIsAttached) {
261 ALOGV("Stream %d: Freeing buffer: detach", firstOtherStreamId);
262 sp<Camera3OutputStream> stream =
263 mStreamMap.valueFor(firstOtherStreamId).promote();
264 if (stream == nullptr) {
265 ALOGE("%s: unable to promote stream %d to detach buffer", __FUNCTION__,
266 firstOtherStreamId);
267 return INVALID_OPERATION;
268 }
269
270 // Detach and then drop the buffer.
271 //
272 // Need to unlock because the stream may also be calling
273 // into the buffer manager in parallel to signal buffer
274 // release, or acquire a new buffer.
275 {
276 mLock.unlock();
277 sp<GraphicBuffer> buffer;
278 stream->detachBuffer(&buffer, /*fenceFd*/ nullptr);
279 mLock.lock();
280 }
281 size_t& otherAttachedBufferCount =
282 streamSet.attachedBufferCountMap.editValueFor(firstOtherStreamId);
283 otherAttachedBufferCount--;
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700284 }
Zhijun He125684a2015-12-26 15:07:30 -0800285 }
286 }
287 } else {
288 // TODO: implement this.
289 return BAD_VALUE;
290 }
291
292 return OK;
293}
294
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700295status_t Camera3BufferManager::onBufferReleased(int streamId, int streamSetId) {
296 ATRACE_CALL();
297 Mutex::Autolock l(mLock);
298
299 ALOGV("Stream %d set %d: Buffer released", streamId, streamSetId);
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700300
301 if (!checkIfStreamRegisteredLocked(streamId, streamSetId)){
302 ALOGV("%s: signaling buffer release for an already unregistered stream "
303 "(stream %d with set id %d)", __FUNCTION__, streamId, streamSetId);
304 return OK;
305 }
306
307 if (mGrallocVersion < HARDWARE_DEVICE_API_VERSION(1,0)) {
308 StreamSet& streamSet = mStreamSetMap.editValueFor(streamSetId);
309 BufferCountMap& handOutBufferCounts = streamSet.handoutBufferCountMap;
310 size_t& bufferCount = handOutBufferCounts.editValueFor(streamId);
311 bufferCount--;
312 ALOGV("%s: Stream %d set %d: Buffer count now %zu", __FUNCTION__, streamId, streamSetId,
313 bufferCount);
314 } else {
315 // TODO: implement gralloc V1 support
316 return BAD_VALUE;
317 }
318
319 return OK;
320}
321
Shuzhen Wangfd76cf52017-05-15 10:01:04 -0700322status_t Camera3BufferManager::onBuffersRemoved(int streamId, int streamSetId, size_t count) {
Zhijun He125684a2015-12-26 15:07:30 -0800323 ATRACE_CALL();
324 Mutex::Autolock l(mLock);
Shuzhen Wangfd76cf52017-05-15 10:01:04 -0700325
326 ALOGV("Stream %d set %d: Buffer removed", streamId, streamSetId);
Zhijun He125684a2015-12-26 15:07:30 -0800327
328 if (!checkIfStreamRegisteredLocked(streamId, streamSetId)){
Shuzhen Wangfd76cf52017-05-15 10:01:04 -0700329 ALOGV("%s: signaling buffer removal for an already unregistered stream "
330 "(stream %d with set id %d)", __FUNCTION__, streamId, streamSetId);
Zhijun He125684a2015-12-26 15:07:30 -0800331 return OK;
332 }
333
334 if (mGrallocVersion < HARDWARE_DEVICE_API_VERSION(1,0)) {
Zhijun He125684a2015-12-26 15:07:30 -0800335 StreamSet& streamSet = mStreamSetMap.editValueFor(streamSetId);
Shuzhen Wangfd76cf52017-05-15 10:01:04 -0700336 BufferCountMap& handOutBufferCounts = streamSet.handoutBufferCountMap;
337 size_t& totalHandoutCount = handOutBufferCounts.editValueFor(streamId);
338 BufferCountMap& attachedBufferCounts = streamSet.attachedBufferCountMap;
339 size_t& totalAttachedCount = attachedBufferCounts.editValueFor(streamId);
340
341 if (count > totalHandoutCount) {
342 ALOGE("%s: Removed buffer count %zu greater than current handout count %zu",
343 __FUNCTION__, count, totalHandoutCount);
344 return BAD_VALUE;
345 }
346 if (count > totalAttachedCount) {
347 ALOGE("%s: Removed buffer count %zu greater than current attached count %zu",
348 __FUNCTION__, count, totalAttachedCount);
349 return BAD_VALUE;
Zhijun He125684a2015-12-26 15:07:30 -0800350 }
351
Shuzhen Wangfd76cf52017-05-15 10:01:04 -0700352 totalHandoutCount -= count;
353 totalAttachedCount -= count;
354 ALOGV("%s: Stream %d set %d: Buffer count now %zu, attached buffer count now %zu",
355 __FUNCTION__, streamId, streamSetId, totalHandoutCount, totalAttachedCount);
Zhijun He125684a2015-12-26 15:07:30 -0800356 } else {
Shuzhen Wangfd76cf52017-05-15 10:01:04 -0700357 // TODO: implement gralloc V1 support
Zhijun He125684a2015-12-26 15:07:30 -0800358 return BAD_VALUE;
359 }
360
361 return OK;
362}
363
364void Camera3BufferManager::dump(int fd, const Vector<String16>& args) const {
365 Mutex::Autolock l(mLock);
366
367 (void) args;
368 String8 lines;
369 lines.appendFormat(" Total stream sets: %zu\n", mStreamSetMap.size());
370 for (size_t i = 0; i < mStreamSetMap.size(); i++) {
371 lines.appendFormat(" Stream set %d has below streams:\n", mStreamSetMap.keyAt(i));
372 for (size_t j = 0; j < mStreamSetMap[i].streamInfoMap.size(); j++) {
373 lines.appendFormat(" Stream %d\n", mStreamSetMap[i].streamInfoMap[j].streamId);
374 }
Zhijun He8d1a1542016-01-29 20:28:21 -0800375 lines.appendFormat(" Stream set max allowed buffer count: %zu\n",
376 mStreamSetMap[i].maxAllowedBufferCount);
Zhijun He125684a2015-12-26 15:07:30 -0800377 lines.appendFormat(" Stream set buffer count water mark: %zu\n",
378 mStreamSetMap[i].allocatedBufferWaterMark);
379 lines.appendFormat(" Handout buffer counts:\n");
380 for (size_t m = 0; m < mStreamSetMap[i].handoutBufferCountMap.size(); m++) {
381 int streamId = mStreamSetMap[i].handoutBufferCountMap.keyAt(m);
382 size_t bufferCount = mStreamSetMap[i].handoutBufferCountMap.valueAt(m);
383 lines.appendFormat(" stream id: %d, buffer count: %zu.\n",
384 streamId, bufferCount);
385 }
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700386 lines.appendFormat(" Attached buffer counts:\n");
387 for (size_t m = 0; m < mStreamSetMap[i].attachedBufferCountMap.size(); m++) {
388 int streamId = mStreamSetMap[i].attachedBufferCountMap.keyAt(m);
389 size_t bufferCount = mStreamSetMap[i].attachedBufferCountMap.valueAt(m);
390 lines.appendFormat(" stream id: %d, attached buffer count: %zu.\n",
391 streamId, bufferCount);
392 }
Zhijun He125684a2015-12-26 15:07:30 -0800393 }
394 write(fd, lines.string(), lines.size());
395}
396
397bool Camera3BufferManager::checkIfStreamRegisteredLocked(int streamId, int streamSetId) const {
398 ssize_t setIdx = mStreamSetMap.indexOfKey(streamSetId);
399 if (setIdx == NAME_NOT_FOUND) {
400 ALOGV("%s: stream set %d is not registered to stream set map yet!",
401 __FUNCTION__, streamSetId);
402 return false;
403 }
404
405 ssize_t streamIdx = mStreamSetMap.valueAt(setIdx).streamInfoMap.indexOfKey(streamId);
406 if (streamIdx == NAME_NOT_FOUND) {
407 ALOGV("%s: stream %d is not registered to stream info map yet!", __FUNCTION__, streamId);
408 return false;
409 }
410
Zhijun He8d1a1542016-01-29 20:28:21 -0800411 size_t bufferWaterMark = mStreamSetMap[setIdx].maxAllowedBufferCount;
Zhijun He125684a2015-12-26 15:07:30 -0800412 if (bufferWaterMark == 0 || bufferWaterMark > kMaxBufferCount) {
413 ALOGW("%s: stream %d with stream set %d is not registered correctly to stream set map,"
414 " as the water mark (%zu) is wrong!",
415 __FUNCTION__, streamId, streamSetId, bufferWaterMark);
416 return false;
417 }
418
419 return true;
420}
421
Zhijun He125684a2015-12-26 15:07:30 -0800422} // namespace camera3
423} // namespace android