Skip to content
This repository was archived by the owner on Dec 22, 2020. It is now read-only.
This repository was 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

@abhinavbhadauria-bigstep

Description

@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);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions