title: get data of each android.hardware.camera2 frame before it is displayed on the surfacetexture
body: <p>In my android application, I need to get each frame that is returned by the  android.hardware.camera2, make some processing with it's data and only then display it on the surfacetexture.
  This question is similar to mine, but it didn't help me:
  <a href="https://stackoverflow.com/questions/25462277/camera-preview-image-data-processing-with-android-l-and-camera2-api">Camera preview image data processing with Android L and Camera2 API</a></p>
  
  <p>I've tried to get the frame from here (as suggested in the answer to the question):</p>
  
  <pre><code>private final ImageReader.OnImageAvailableListener mOnImageAvailableListener
              = new ImageReader.OnImageAvailableListener() {
  
          @Override
          public void onImageAvailable(ImageReader reader) {
  
              Log.d("Img", "onImageAvailable");
              mBackgroundHandler.post(new ImageSaver(reader.acquireNextImage(), mFile));
          }
  
      };
  </code></pre>
  
  <p>This was not useful, as the callback is called only after the user performed capture of image. And I don't need it only on capture, I need to get each frame that is sent to the camerapreview surface.
  I wonder, maybe the farme can be taken here (from the texture):</p>
  
  <pre><code>public void onSurfaceTextureUpdated(SurfaceTexture texture) {
              Log.d("Img", "onSurfaceTextureUpdated");
  
          }
  </code></pre>
  
  <p>If yes, how?</p>
  
  <p>I'm using this sample from google, as a basis: </p>
  
  <p><a href="https://github.com/googlesamples/android-Camera2Basic" rel="nofollow noreferrer">https://github.com/googlesamples/android-Camera2Basic</a></p>