mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-23 16:56:41 +00:00
Reuse callback buffers
This commit is contained in:
@@ -469,7 +469,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public int submitDecodeUnit(byte[] frameData) {
|
public int submitDecodeUnit(byte[] frameData, int frameLength) {
|
||||||
totalFrames++;
|
totalFrames++;
|
||||||
|
|
||||||
long timestampUs = System.nanoTime() / 1000;
|
long timestampUs = System.nanoTime() / 1000;
|
||||||
@@ -594,7 +594,7 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
|||||||
|
|
||||||
// The H264Utils.writeSPS function safely handles
|
// The H264Utils.writeSPS function safely handles
|
||||||
// Annex B NALUs (including NALUs with escape sequences)
|
// Annex B NALUs (including NALUs with escape sequences)
|
||||||
ByteBuffer escapedNalu = H264Utils.writeSPS(sps, frameData.length);
|
ByteBuffer escapedNalu = H264Utils.writeSPS(sps, frameLength);
|
||||||
buf.put(escapedNalu);
|
buf.put(escapedNalu);
|
||||||
|
|
||||||
if (queueInputBuffer(inputBufferIndex,
|
if (queueInputBuffer(inputBufferIndex,
|
||||||
@@ -634,10 +634,10 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Copy data from our buffer list into the input buffer
|
// Copy data from our buffer list into the input buffer
|
||||||
buf.put(frameData);
|
buf.put(frameData, 0, frameLength);
|
||||||
|
|
||||||
if (!queueInputBuffer(inputBufferIndex,
|
if (!queueInputBuffer(inputBufferIndex,
|
||||||
0, frameData.length,
|
0, frameLength,
|
||||||
timestampUs, codecFlags)) {
|
timestampUs, codecFlags)) {
|
||||||
return MoonBridge.DR_NEED_IDR;
|
return MoonBridge.DR_NEED_IDR;
|
||||||
}
|
}
|
||||||
|
|||||||
Submodule moonlight-common updated: ea7e5975c3...525a8ac322
Reference in New Issue
Block a user