Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8013079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:32:04+00:00 2026-06-04T19:32:04+00:00

I’ve been searching Google and StackOverflow exhaustively and cannot find this. Maybe I’m missing

  • 0

I’ve been searching Google and StackOverflow exhaustively and cannot find this. Maybe I’m missing something obvious. Thanks!

(This is because the Java implementation of the preview callback [even with buffer] is too inefficient.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:32:06+00:00Added an answer on June 4, 2026 at 7:32 pm

    I made a little investigation on topic. This presentation (from p.277, Chinese) helped a lot.

    Camera preview call chain

    As others mentioned, you can get a buffer using a Camera.setPreviewCallback method.
    Here’s how it happens there (a verbose version):

    1. User calls Camera.startPreview() which is a native function.
    2. android_hardware_Camera_startPreview calls startPreview method of C++ Camera class.
    3. Camera calls a startPreview method of ICamera interface
    4. ICamera makes an IPC call to remote client.
    5. It calls a setCameraMode method of CameraService class.
    6. CameraService sets a window to display a preview and calls a startPreview method of CameraHardwareInterface class.
    7. The latter tries to call a start_preview method on particular camera_device_t device.
      I didn’t looked up further but it should perform a call to the driver.
    8. When image arrives, dataCallback of CameraService is invoked.
    9. It passes data to handlePreviewData method of client.
    10. Client either copies the buffer or sends it directly to the ICameraClient.
    11. ICameraClient sends it over IPC to the Camera.
    12. Camera calls a registered listener and passes buffer to JNI.
    13. It invokes a callback in Java class. If user provided a buffer with Camera.addCallbackBuffer then it copies to the buffer first.
    14. Finally Java class Camera handles the message and invokes a onPreviewFrame method of Camera.PreviewCallback.

    As you can see 2 IPC calls were invoked and buffer was copied at least twice on steps 10, 11. First instance of raw buffer which is returned by camera_device_t is hosted in another process and you cannot access it due to security checks in CameraService.

    Preview surface

    However, when you set a preview surface using either Camera.setPreviewTexture or Camera.setPreviewDisplay it is be passed directly to the camera device and refreshed in realtime without participation of all the chain above. As it’s documentation says:

    Handle onto a raw buffer that is being managed by the screen compositor.

    Java class Surface has a method to retrieve it’s contents:

    public static native Bitmap screenshot(int width, int height, int minLayer, int maxLayer);
    

    But this API is hidden. See i.e. this question for a way to use it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.