2
* Copyright (C) 2011 The Android Open Source Project
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
19
#include <sys/types.h>
21
#include <utils/Errors.h>
24
#include "SurfaceTextureLayer.h"
27
// ---------------------------------------------------------------------------
30
SurfaceTextureLayer::SurfaceTextureLayer()
34
SurfaceTextureLayer::~SurfaceTextureLayer() {
37
status_t SurfaceTextureLayer::connect(int api, QueueBufferOutput* output) {
38
status_t err = BufferQueue::connect(api, output);
39
if (err == NO_ERROR) {
41
case NATIVE_WINDOW_API_MEDIA:
42
case NATIVE_WINDOW_API_CAMERA:
43
// Camera preview and videos are rate-limited on the producer
44
// side. If enabled for this build, we use async mode to always
45
// show the most recent frame at the cost of requiring an
47
#ifndef NEVER_DEFAULT_TO_ASYNC_MODE
48
err = setSynchronousMode(false);
51
// fall through to set synchronous mode when not defaulting to
54
err = setSynchronousMode(true);
57
if (err != NO_ERROR) {
64
// ---------------------------------------------------------------------------
65
}; // namespace android