Skip to content

MediaCodec BufferOverflowException #1

Description

@renruigang

你好,进行编码推流报错:
java.nio.BufferOverflowException
at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:264)
at java.nio.ByteBuffer.put(ByteBuffer.java:642)
at com.lisi.titan.TitanVideoEncoder.encodeByteBuffer(TitanVideoEncoder.java:276)
at com.lisi.titan.TitanVideoEncoder.encode(TitanVideoEncoder.java:226)
at com.lisi.titan.TitanCameraSession$3.onImageAvailable(TitanCameraSession.java:619)
at android.media.ImageReader$ListenerHandler.handleMessage(ImageReader.java:658)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.os.HandlerThread.run(HandlerThread.java:61)

ByteBuffer buffer;
try {
buffer = codec.getInputBuffer(index);
} catch (IllegalStateException e) {
Log.e(TAG, "getInputBuffers failed", e);
return -1;
}

    buffer.clear();
    buffer.put(videoFrame);

是不是缓存太小的原因,要怎么修改呢?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions