Skip to content
This repository has been archived by the owner on Dec 22, 2020. It is now read-only.

Android App crashing while stroing videoFrame into videobuffer, showing BufferOverflowException in bytebuffercapture.put(buf) #248

Open
abhinavbhadauria-bigstep opened this issue Dec 13, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@abhinavbhadauria-bigstep

@OverRide
public void onCaptureVideoFrame(int videoFrameType, int width, int height, int bufferLength, int yStride, int uStride, int vStride, int rotation, long renderTimeMs) {
byte[] buf = new byte[bufferLength];
byteBufferCapture.limit(bufferLength);
byteBufferCapture.get(buf);
byteBufferCapture.flip();

    for (MediaDataVideoObserver observer : videoObserverList) {
        observer.onCaptureVideoFrame(buf, videoFrameType, width, height, bufferLength, yStride, uStride, vStride, rotation, renderTimeMs);
    }

    byteBufferCapture.put(buf);
    byteBufferCapture.flip();

    if (beCaptureVideoShot) {
        beCaptureVideoShot = false;

        getVideoSnapshot(width, height, rotation, bufferLength, buf, captureFilePath, yStride, uStride, vStride);
    }
}

@Override
public void onPreEncodeVideoFrame(int videoFrameType, int width, int height, int bufferLength, int yStride, int uStride, int vStride, int rotation, long renderTimeMs) {
    byte[] buf = new byte[bufferLength];
    byteBufferCapture.limit(bufferLength);
    byteBufferCapture.get(buf);
    byteBufferCapture.flip();

    for (MediaDataVideoObserver observer : videoObserverList) {
        observer.onPreEncodeVideoFrame(buf, videoFrameType, width, height, bufferLength, yStride, uStride, vStride, rotation, renderTimeMs);
    }

    byteBufferCapture.put(buf);
    byteBufferCapture.flip();

    if (beCaptureVideoShot) {
        beCaptureVideoShot = false;

        getVideoSnapshot(width, height, rotation, bufferLength, buf, captureFilePath, yStride, uStride, vStride);
    }
}
@abhinavbhadauria-bigstep abhinavbhadauria-bigstep added the bug Something isn't working label Dec 13, 2020
@yoreland
Copy link

which sdk version you are currently using?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants