PDA

View Full Version : How to capture android camera to 2 screen views and stream over wifi



kshepitzki
07-04-2016, 08:51 AM
I am building an Android app where I need to capture the camera preview and display it on 2 views on the display (one view is flipped and rotated). In addition I need to stream the captured video preview over Direct WiFi to another device.

These 3 activities need to happen in real time and there is great importance to video latency which should be as small as the Android platform is capable on every device (on my Samsung A8, the max frame rate for FullHD capture is 30fps, so with the 4 buffers Android uses in its camera-to-screen pipeline, the latency between the source image and the display is around 120ms which is fine for this device).

I tried using normal TextureView with Camera and Camera2 API but did not find a way to display 2 different instances of the camera preview.

I tried using OpenGL which lets me display 2 instances of the view but I don't know how to capture a byte stream for sending over WiFi. I already implemented the Direct WiFi link, but I am not sure how to produce a streaming source with OpenGL.

My question is can I achieve these multiple requirements OpenGL?