Code example for Camera

Methods: addCallbackBuffer

0
        } catch (IOException ex) {
            Log.e(TAG, "deallocate: failed to deallocate camera, " + ex);
            return; 
        } 
    } 
 
    @Override 
    public void onPreviewFrame(byte[] data, Camera camera) {
        mPreviewBufferLock.lock();
        try { 
            if (!mIsRunning) {
                return; 
            } 
            if (data.length == mExpectedFrameSize) {
                int rotation = getDeviceOrientation();
                if (rotation != mDeviceOrientation) {
                    mDeviceOrientation = rotation;
                    Log.d(TAG,
                          "onPreviewFrame: device orientation=" + 
                          mDeviceOrientation + ", camera orientation=" +
                          mCameraOrientation);