I am trying to display a filtered camera preview, using onPreviewFrame() callback.
The problem is that when i remove this line: mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
to hide the preview, the app crashes. The log reads: 08-19 15:57:51.042: ERROR/CameraService(59): registerBuffers failed with status -38
What does this mean? Is this documented anywhere?
I am using the CameraPreview from the SDK APIDemos: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/CameraPreview.html
SURFACE_TYPE_PUSH_BUFFERS generates several buffers for the SurfaceView. Components are locking (fill with data) and pushing (display data) these buffers deep in the OS code. Especially OpenMax (camera hardware device interface) is using "graphic buffers"="push buffers" to fill data and display data. To be specific, the camera hardware can fill a push buffer directly and die graphics hardware can display a push buffer directly (they share these buffers). Conclusion: The OS forces you to create a SurfaceView with push buffers. Then it can use the buffers for the camera device.
In Google's Camera guide you can find a brief mention of this. According to the guide SURFACE_TYPE_PUSH_BUFFERS
is a deprecated setting necessary for pre-3.0 devices.
Look in the code example in the "Creating a preview class" section, at the bottom of the constructor it says:
// deprecated setting, but required on Android versions prior to 3.0
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
It's a good idea to read the camera guide carefully if you haven't done so, it contains some important stuff that's not in the API documentation of the Camera classes.
What does this mean?
It means that you did not properly configure the SurfaceView
via the SurfaceHolder
.
Is this documented anywhere?
What is "this"? Here is the documentation for SurfaceView
, SurfaceHolder
, SURFACE_TYPE_PUSH_BUFFERS
, and Camera
.
If your real question is "where is it documented that Camera
requires SURFACE_TYPE_PUSH_BUFFERS
", I suspect that is undocumented. You use SURFACE_TYPE_PUSH_BUFFERS
for camera preview and video playback, and perhaps other situations as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With