0

I have a Surface object in Android containing screen data. From what I understand, it is sort of a handle onto a frame/pixel buffer.

How can I send this object (or some representation of it) over a network to, say, a web server?

SasukeIsCool
  • 227
  • 4
  • 11

1 Answers1

3

A Surface is a pool of graphics buffers with an associated queue. It has a producer-consumer interface, and the consumer can live in a different process -- buffers are sent by handle with Binder IPC. A longer explanation can be found in the graphics architecture doc.

Sending the object over the network isn't useful without also sending the associated graphics data. Since the graphics data will be about a million times larger than the object (literally, for display-sized buffers), you will usually want to focus on sending a compressed form of the images, rather than passing an object with multiple raw graphics buffers around.

The problem reduces to uploading PNG or JPEG images, or for higher volumes possibly MPEG video or VNC.

fadden
  • 51,356
  • 5
  • 116
  • 166
  • I really only want the buffer data. Is there a way I can get this using Binder IPC? – SasukeIsCool Jul 27 '15 at 10:48
  • Binder is used to send small amounts of data between processes on a single device, not send data across a network. Unless you have a very fast network connection, you'll benefit from compressing the data first, both in terms of speed and in using a graphics format that the web server will recognize. The best way to do that depends on where the data is coming from, how you want to transmit it, and what minimum version of Android you want to support. – fadden Jul 27 '15 at 15:29
  • Do you mind having a look at [my new question](http://stackoverflow.com/questions/31687259/bitmap-from-imagereader-always-blank-when-trying-to-capture-screen)? Thanks to your answer, I realised that a SurfaceView isn't what I wanted and went with another approach – SasukeIsCool Jul 28 '15 at 21:22